[antlr-interest] String Lexer Rule with strange limiters

Roy Brokvam roy.brokvam at gmail.com
Tue May 22 04:11:12 PDT 2007


Try:

LONGSTRING
    :    '[' Inner ']'
    ;

Inner    :    '=' Inner '='
    |    '[' ( EscapeSequence | ~('\\'|']') )* ']'
    ;

Regards,
Roy B

2007/5/22, lists at mainiero.de <lists at mainiero.de>:
>
> Hi,
>
> i have the following lexer rule to detect strings:
>
> LONGSTRING
>         :       '['('=')*'[' ( EscapeSequence | ~('\\'|']') )*
> ']'('=')*']'
>         ;
>
> How can i ensure that the number of = before and after the string are
> the same.
>
> For example:
>
> [==[Hello World]==] would be ok
> [[Hello World]=] won't
>
> thanks, nicolai
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070522/d8026284/attachment.html 


More information about the antlr-interest mailing list