[antlr-interest] Greedy Lexer

Mihai Danila viridium at gmail.com
Wed Sep 30 06:12:53 PDT 2009


I have this simple grammar:

expr: token+;
token: And | Number | String;

And: '.AND.';
Number: Digit ;
String: '"' (~('"')*) '"';
fragment Digit: ('0'..'9');


My question: though ANTLR parses "123".AND."45" correctly, it doesn't parse
expressions of the form 123.AND.45 correctly. What is the remedy for this?
(Other than adding spaces in between the tokens.)


Thanks,
Mihai
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090930/f754046a/attachment.html 


More information about the antlr-interest mailing list