[antlr-interest] Template grammars - argument specifying constructed template
Nikolas Everett
nik9000 at gmail.com
Sat Jan 5 20:23:26 PST 2008
I think I've answered my own question:
example1: ^(A example2[this.getTemplateLib().getInstanceOf("example1")]) ->
{example2.st};
example2[StringTemplate template]: ^(B C) {$template.setAttribute($C.text);}
-> {template};
I haven't tested it thoroughly, but it looks to work. I hate to drop lots
of java code in my grammar, but it does get the job done.
--Nik
On Jan 5, 2008 10:41 PM, Nikolas Everett < nik9000 at gmail.com> wrote:
> I'm trying to do this:
>
> example[String templateName]
> : ^(E (^X A M) P L E) -> ($templateName)(e={$E.text}, m={$M.text))
> ;
>
> Is there an easy way to do this without some kind of odd hack using
> stringtemplate's indirection?
>
> Thanks,
>
> --Nik
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080105/c34d0d3f/attachment.html
More information about the antlr-interest
mailing list