[antlr-interest] Re: 3 curly brackets commet

idontwantanidwith2000init idontwantanidwith2000init at yahoo.com
Thu Apr 15 13:55:40 PDT 2004


Ok, you are right:
CURLY_COMMENT1: CURLY_COMMENT '}'*

BTW if you wan't to ensure int a[] = { 1,2,3 } parenthes are correct 
it's a matter of stack in the lexer or a matter for the parser to 
check.

--- In antlr-interest at yahoogroups.com, Rolf Schumacher 
<mailinglist at a...> wrote:
> As far as I can see, this might have a dangeling '}' in cases like
> 
> {{{ int a[] = { 1,2,3 } }}}
> 
> Rolf
> 
> idontwantanidwith2000init wrote:
> 
> >How about:
> >
> 
>CURLY_COMMENT: '{'(WHITE_SPACE)'{'(WHITE_SPACE*'{'COMMENT'}'(WHITE_S
P
> >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
> >
> >
> >
> > 
> >
> >
> >
> >  
> >



 
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