[antlr-interest] help understanding the parsing error
jimi at temporal-wave.com
Fri May 11 11:28:45 PDT 2012
Do not use 'XYZ'. Create a token in the lexer:
XYZ : 'XYZ' ;
And declare it before your ID rule. Do this for all the literals in your
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Mikhail Kruk
> Sent: Friday, May 11, 2012 8:30 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] help understanding the parsing error
> I have a very simple grammar (attached, but here's the relevant part):
> : (simple_expression | dotted_identifier)*
> : 'XYZ' 'HAHA'
> : ID
> : identifier ( DOT identifier )*
> It pretty much works as expected, accepting "XYZ HAHA", "BLAH.TEST"
> and "ABC". But when I try to parse "XYZ.A" or "A.XYZ" it gets confused
> trying to apply simple_expression to 'XYZ'. I don't understand why
> this is happening. Shouldn't backtracking tear right through this?
More information about the antlr-interest