[antlr-interest] Re: 3 curly brackets commet

idontwantanidwith2000init idontwantanidwith2000init at yahoo.com
Mon Apr 12 12:19:14 PDT 2004


How about:

CURLY_COMMENT: '{'(WHITE_SPACE)'{'(WHITE_SPACE*'{'COMMENT'}'(WHITE_SP
ACE)*'}'(WHITE_SPACE)*'}'


--- In antlr-interest at yahoogroups.com, mailinglist at a... wrote:
>  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