[stringtemplate-interest] Attaching model to stringtemplate group
Terence Parr
parrt at cs.usfca.edu
Sat Sep 22 16:54:33 PDT 2007
On Sep 17, 2007, at 8:23 AM, Johannes Luber wrote:
> Hello!
>
> I know what properties a model has to have, so it can be used with
> StringTemplate, I've got a stringtemplate group working (via STST),
> but
> I can't remember how to close the last gap - namely how to attach the
> model data to the templates. Do I have to create StringTemplate
> objects
> manually and feed them with data or is there any automatism like in
> ANTLR?
Hi Johannes,
I am not sure what you're asking here. There is no attaching a model
to the templates. You must send in data via setAttribute() to every
template and for all of the attributes that you intend to use in the
template.
ST by itself requires you to manually set attributes and so on with
code, I'm afraid. Perhaps that is what you are asking. ANTLR
actions allow you to say %foo() to load template foo and then %x.y =
"hi" to set attribute y of template x to "hi".
Ter
More information about the stringtemplate-interest
mailing list