[antlr-interest] Re: 3 curly brackets commet

Rolf Schumacher mailinglist at august.de
Thu Apr 15 13:28:05 PDT 2004


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_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
>
>
>
> 
>
>
>
>  
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 1730 bytes
Desc: S/MIME Cryptographic Signature
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20040415/a9c59236/smime.bin


More information about the antlr-interest mailing list