[antlr-interest] greedy=false for lexersBy default

Loring Craymer lgcraymer at yahoo.com
Fri May 23 16:09:03 PDT 2008


Ter--

I'm uneasy about this, but then I tend to avoid the greedy=false shortcut in favor of being precise (~'"' instead of . in this case).  Why not make "greedy" a grammar-level option, instead?

--Loring

----- Original Message ----
> From: Terence Parr <parrt at cs.usfca.edu>
> To: antlr-interest Interest <antlr-interest at antlr.org>
> Sent: Friday, May 23, 2008 3:32:31 PM
> Subject: [antlr-interest] greedy=false for lexersBy default
> 
> hi,
> 
>   I'm thinking of changing lexers to use greedy=false by default so  
> that things like
> 
> STRING : '"' ('\\' '"'|.)* '"' ;
> 
>   so I don't have to say
> 
> STRING : '"' (options {greedy=false;}:'\\' '"'|.)* '"' ;
> 
> I think with a dot in there it works now:
> 
> CMT : '//' .* '\n' ;
> 
> Any objections to me flipping this real quick for 3.1?
> 
> Ter



      



More information about the antlr-interest mailing list