[antlr-interest] Template grammars - argument specifying constructed template
Terence Parr
parrt at cs.usfca.edu
Sun Jan 6 11:48:49 PST 2008
Well, using the template name as a variable is not really a hack is
it? If so, you can predicate the rewrite
a[String name]
: ... -> {name.equals("ick")}? ick(...)
-> {name.equals("foo")}? foo(...)
;
I'd recomm. what you have :)
Ter
On Jan 5, 2008, at 7:41 PM, Nikolas Everett 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
>
More information about the antlr-interest
mailing list