[antlr-interest] printf in target C grammar

Benjamin Niemann pink at odahoda.de
Wed Apr 16 01:34:27 PDT 2008


Hi,

On Wed, Apr 16, 2008 at 5:24 AM, gaochunguang <gaochunguang at 163.com> wrote:
>
>
> IMPORT : 'import' WS name=QIDStar WS? ';'
>           {
>           printf("%s",$name.Text);
>           };
> ANTLRWorks give me [invalid StringTemplate % shorthand syntax: '%s",'] errer
> message. how to write? thanks.

You'll have to escape the '%': printf("\%s",$name.Text);

HTH

-Ben


More information about the antlr-interest mailing list