[antlr-interest] How to use a value more than once?
Dr. Kocher, Hartmut
h.kocher at pharmatechnik.de
Tue Dec 20 12:17:55 PST 2005
Hi,
I'm trying to build a first prototype using ANTLR3 and ST.
I need to reuse a value more than once because I want it to use in two
different templates.
Here's an artificial example to keep it short:
I parsed two properties name and text (Identifier and String).
Something like:
rules : rule*;
rule : name text -> ...???;
Now I have two templates. One generates code like
private MyClass _<name>;
The other template generates:
void Init() {
_<name> = new MyClass();
_<name>.Text = <text>;
}
This should be repeated for all parsed values.
How can I call two different templates with the same values? The "->"
syntax only allows to call one template at a time. I thought about
filling two lists with expanded templates. Still I don't know how to
call two different templates.
What's the preferred way to handle this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20051220/db515b07/attachment.html
More information about the antlr-interest
mailing list