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

Gavin Lambert antlr at mirality.co.nz
Fri Oct 12 17:41:34 PDT 2012

I know, but "anything but CRLF |or| anything [except implicitly 
the '>>' terminator]" still sounds like it's going to swallow 
newlines.  While the first alt won't take them, the second alt 

Unless it's doing something especially clever.

At 13:32 13/10/2012, Terence Parr wrote:
 >it's like an "else" clause as ambiguities resolve to first alt
 >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 
 >> >'<<' (~[\r\n] | .)* '>>' which is nongreedy
 >> Doesn't the "." alt cancel out the first alt?

Gavin Lambert, Mirality Systems
Anyone who goes to a psychiatrist ought to have their head 

Few women admit their age.  Few men act theirs.

More information about the antlr-interest mailing list