[antlr-interest] invalid StringTemplate % shorthand syntax: '%s'
Terence Parr
parrt at cs.usfca.edu
Sun Apr 6 18:15:56 PDT 2008
lexer *actions* and lexer::header stuff with % were recently
discovered to require some kind of double escape ;)
Ter
On Apr 6, 2008, at 5:32 PM, Aurelian Melinte wrote:
> Hello,
>
> I am getting the above mentioned error although I have escaped all
> the occurrences of % with \% but I still have a few of those
> errors. The only unescaped '%' are in the lexer:
>
> MOD : '%' ;
> MODEQUAL : '%=' ;
>
> If someone can answer these questions, I would be grateful:
>
> 1. Why do I have to escape the % in C code? Are there any other
> characters that need to be escaped?
>
> 2. How do I escape it in the lexer tokens?
>
> The grammar generating these errors can be found here: http://
> www.freeshells.ch/~amelinte/CPP_parser32m.g.
>
> It is an attempt to adapt the C++ grammar authored by Mr. Wigg to
> ANTLR3; it generates other errors too, but for now I would like to
> get rid of these %-related errors.
>
> On another note, this grammar crashes ANTLR.
>
> Best regards,
>
> Aurelian Melinte
>
>
More information about the antlr-interest
mailing list