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

shmuel siegel antlr at shmuelhome.mine.nu
Sat Mar 21 12:51:48 PDT 2009


Terence Parr wrote:
> http://www.antlr.org/jira/browse/ANTLR-392
>
> any objections?
>
> Ter
>
>
>   
Why is "." being singled out to be non-greedy (other than the idea that 
it is presumably stupid for it to be greedy). It seems that it will 
cause confusion if the option is not extended to all patterns.

Consider

case1: A* A B;
and,
case2: .* A B;

Should case1 fail because it is greedy but case2 would succeed?



More information about the antlr-interest mailing list