[antlr-interest] Non-greedy lexer rule in ANTLR4

Terence Parr parrt at cs.usfca.edu
Fri Oct 12 17:32:02 PDT 2012


it's like an "else" clause as ambiguities resolve to first alt specified.
T
On Oct 12, 2012, at 5:03 PM, Gavin Lambert wrote:

> At 11:56 13/10/2012, Terence Parr wrote:
> >oh. if no newline and such what Bart suggests might be best.  maybe
> >'<<' (~[\r\n] | .)* '>>' which is nongreedy
> 
> Doesn't the "." alt cancel out the first alt?
> 
> -- 
> Gavin Lambert, Mirality Systems
> <http://www.mirality.co.nz/>
> <http://lambert.geek.nz/>
> ----
> Anyone who goes to a psychiatrist ought to have their head examined.
> 
> Few women admit their age.  Few men act theirs.
> 



More information about the antlr-interest mailing list