[antlr-interest] Non-greedy lexer rule in ANTLR4
Michel Krämer
michel at undercouch.de
Fri Oct 12 10:07:25 PDT 2012
Dear all,
Is it possible to write a non-greedy lexer rule that does not contain a
dot in ANTLR4? For example:
ANCHOR
: '<<' ( ~( '>>' | '\r' | '\n' ) )* '>>'
;
I'm using 4.0b2 and the above seems to be greedy.
Alternatively, would it be possible to rewrite this rule so it includes
everything from '<<' to the first '>>' but not more?
Thanks,
Michel
More information about the antlr-interest
mailing list