Browse thread
Error location in Camlp4
- Sham K
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2008-04-24 (12:47) |
From: | Sham K <shaawm@g...> |
Subject: | Error location in Camlp4 |
Hello Everyone, I have written a tokenizer (using parser constructs in camlp4) which tokenizes a character stream of a string. I use this to define a lexer (using Token.lexer_func_of_parser) as shown in turorials and manuals on camlp4. Then I make use of EXTEND statements to interpret token stream to according to some syntax to build some Abstract syntax tree. All this works fine. However, whenever there is error I just get "Stdpp.Exc_located" with no indications of the location of error. (It is just (_,_) ) The camlp4 manual says that in the action part of rules, a variable loc is always defined which can be used to raise errors. But the complier complains that loc is not defined when I try to use loc in try ... with statements. Can someone explain how I can print error locations. It works with standard lexer plexer, but not with my lexer. I do not quite see what else I should include in my lexer to enable error location reporting. Thanks for your time. Sham