[antlr-interest] Escaping percentage character in lexer::header

Robert Gründler r.gruendler at gmail.com
Tue Jan 3 01:37:39 PST 2012


Hi,

i'm unable to add String literals to the lexer::header section of my
grammar, as it throws an
invalid StringTemplate % shorthand syntax: '%s'exception.

There's a thread in the list where Terence Parr replies:

lexer *actions* and lexer::header stuff with % were recently
discovered to require some kind of double escape ;)


I've tried all sorts of escaping strategies, but i can't find a way to do
it properly.

Can anyone clarify how to escape percentage characters in lexer::header
blocks of a grammar?

regards


-robert


More information about the antlr-interest mailing list