[antlr-interest] How to use inline templating with the StringTemplate interface

Jared Bunting jared.bunting at peachjean.com
Sat Dec 6 13:44:28 PST 2008


assignment : leftValue DEFINES rightValue -> 
template(left={$leftValue.text}, right={$rightValue.text}) "content of 
template here";

should work...  (the use of "template" instead of the template name is 
key...)

-Jared

Imre András wrote:
> Hi,
>
> I'm checking out the templating output feature of Antlr. I started 
> with CMinus.g grammar found in examples-v3.tar.gz. Based on this 
> grammar I created another one, which call templates defined in an 
> external stg file. For example my assignment rule is:
>
> assignment : leftValue DEFINES rightValue -> 
> assignment(left={$leftValue.text}, right={$rightValue.text});
>
> As my grammar is quite simple, I'd like to get rid of the external 
> file. Is there a way I can do all the templating inline?
>
>
> Thanks,
>   András
> ------------------------------------------------------------------------
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>   


More information about the antlr-interest mailing list