[antlr-interest] Unterminated html comments
Steve Bennett
stevagewp at gmail.com
Mon Feb 18 14:53:15 PST 2008
On 2/19/08, Steve Bennett <stevagewp at gmail.com> wrote:
> (manually specifying the option didn't change the behaviour of the
> rule, that I can tell).
>
> Any other ideas?
Hey, just tried forcing greedy=true with a slight tweak and it works as desired:
HTML_COMMENT:
(('<!--' .* '-->') => '<!--' .* '-->' { $channel=HIDDEN; })
|(('<!--') => '<!--' (options {greedy=true;}: .)* { $channel=HIDDEN; })
| '<' { $type=LT; };
Seems to pass all the test cases I can think of. (Well, except it's
losing the first character on malformed comments but anyway...)
Steve
More information about the antlr-interest
mailing list