[antlr-interest] How can I find the line number and column for a semantic error
dhjdhj
dhjdhj at gmail.com
Fri Apr 10 09:16:08 PDT 2009
I understand that if I get a RecognitionException, I can extract the
line and column from the exeception.
However, suppose I'm inside a rule and I decide that I have a semantic
error (i.e, variable types aren't compatible or something). At that
point I want to generate a Semantic Error that will be caught at the
top level but I still need to know (at least) what line the semantic
error occurred. I tried to get that info out of the lexer but it
always returns the last line of the source code so that doesn't help.
I must be missing something non-obvious (to me) and would appreciate
suggestions.
Thanks,
David Jameson
More information about the antlr-interest
mailing list