[antlr-interest] Lexer too greedy - syntactic predicate doesn't work

Roy Brokvam roy.brokvam at gmail.com
Tue May 22 02:18:35 PDT 2007


I don't understand why this doesn't work for input "1.a". No matter how I
try to write the rules, I get this error message:

line 1:2 mismatched character 'a' expecting '1'
line 0:-1 no viable alternative at input '<EOF>'

Regards,
Roy B


grammar Test1;

expr   : One ('.' A)? | OneOne ;

One    : '1' ;
//This doesn't work either:
//One    : ('1.a') => '1' ;
A      : 'a' ;
OneOne : '1.1' ;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070522/b2ba5526/attachment.html 


More information about the antlr-interest mailing list