[antlr-interest] proposal: make .* and .+ always nongreedy

Terence Parr parrt at cs.usfca.edu
Sat Mar 21 12:18:14 PDT 2009


On Mar 21, 2009, at 12:17 PM, Sam Harwell wrote:

> Absolutely (as in I like the idea, no objection). You can always  
> add .*
> (nothing) or .* EOF if you want to match to the end. Clearly someone  
> who
> writes .* (anything not EOF) is not trying to read to the end. :)
>
> The following is not greedy/works great already:
>
> ML_COMMENT
> 	:	'/*' .* '*/'
> 	;

yeah, lexer is nongreedy by default; goin to be consistent now.
T


More information about the antlr-interest mailing list