[antlr-interest] 3 curly brackets commet

Rolf Schumacher mailinglist at august.de
Thu Apr 15 13:29:39 PDT 2004


This solves this thing, thanks for help Terence.

Unfortunatelly it takes me only one step further.
Please look at my question 'part of comment-open in regular text'.

Rolf

Terence Parr wrote:

>On Apr 12, 2004, at 8:48 AM, mailinglist at august.de 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?
>>    
>>
>
>Hi Rolf,
>
>I suggest using greedy=false option:
>
>CMT : "{{{" (options {greedy=false;} : . )* "}}}" ;
>
>with k=3, this should function as you would like :)  Clean too :)
>
>Ter
>--
>Professor Comp. Sci., University of San Francisco
>Creator, ANTLR Parser Generator, http://www.antlr.org
>Cofounder, http://www.jguru.com
>Cofounder, http://www.knowspam.net enjoy email again!
>Cofounder, http://www.peerscope.com pure link sharing
>
>
>
>
>
> 
>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/0364d25d/smime.bin


More information about the antlr-interest mailing list