[antlr-interest] Unterminated html comments

Steve Bennett stevagewp at gmail.com
Mon Feb 18 08:17:11 PST 2008


On 2/19/08, Jim Idle <jimi at temporal-wave.com> wrote:
> You probably want the greedy=false option on that .* rule: ( options
> {greedy=false;} : . )*

Hmm, the book says that .* is automatically nongreedy:

"What you really want ...is the terse notation: '.*' and '.+'.
...ANTLR considers them idioms for "Match any symbol until
you see what lies beyond the subrule." ANTLR automatically makes
these two subrules nongreedy. So, you can use '.*' instead of manually
specifying the option."


(manually specifying the option didn't change the behaviour of the
rule, that I can tell).

Any other ideas?

Steve


More information about the antlr-interest mailing list