[antlr-interest] 3 curly brackets commet

mailinglist at august.de mailinglist at august.de
Mon Apr 12 08:48:02 PDT 2004


 How would you detect a comment block that is enclosed in 3 curly brackets?
e.g.:
1. {{{}}} or
2. {{{ comment }}} or
3. {{{} }}} or
4. {{{}} }}} ...

My solution leads to "lexical nondeterminism" though it functions ...

options { k=3; charVocabulary = '\u0020' .. '\u007e';}
CMT: "{{{"
        (
            {LA(3)!='}'}?   "}}"
        |   {LA(2)!='}'}?   '}'
        |                           ~'}'
        )*
        "}}}";

... but as I'm new to antlr I'm not quite sure what I'm doing here.
Avoiding "lexical nondeterminism" as a general advice seems to be helpful.
Would like to keep the goal, not to see this warning.

Any idea better than adding warnWhenFollowAmbig option?

Rolf


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list