[antlr-interest] Trouble with the multiline comment example from FAQ

Dejas Ninethousand dejas9000 at gmail.com
Mon Jul 18 12:44:46 PDT 2011


I've modified the multiline comment example from the FAQ (
http://www.antlr.org/wiki/pages/viewpage.action?pageId=1573) to be:

NESTED_ML_COMMENT
    :   '['
        (options {greedy=false;} : NESTED_ML_COMMENT | . )*
        ']' {$channel=HIDDEN;}
    ;

However, it is not behaving as expected in the ANLTRWorks interpreter.  When
I ask the interpreter to match on:

[]

there is no problem, but when I ask it to match on:

[j]

I get a mismatched token exception.  Any thoughts as to why?

Thanks.


More information about the antlr-interest mailing list