Hi Dam,

one approach that I have used was to redirect the templates output by
my own java code that I added to the ruls as actions.
So if a rule returns a template, i.e. add that template to a list of
your choice.

@members {
ArrayList<StringTemplate> myTmpls = new ArrayList<StringTemplate>();
}
...


rule1
: f1=foo1 foo2 { myTmpls.add(f1.st); }
;

foo1
: i=IDENT -> foo1Tmpl({value=$i.text})
;

foo2
: ...

So I think you do not have to return the templates up to the
entryRule, you can do whatever you want with them.

Hope that helps,
fridi

Damien Urruty schrieb:
>
>
>
>
> Hi there,
>
> First of all, thanks a lot for this brilliant tool ! I have a problem, and I 
> don't know how to solve it.
>
> I want to generate multiple output files, for example a .h and a .m for 
> Objective-C. The point is that I can bind only one template to my parser, 
> with :
>
> parser.setTemplateLib(tmpl);
>
> when I call parser.entryRule(), then the toString(), I can get only the 
> generated code for this template tmpl.
>
> Is it possible to bind multiple templates, and parse once my input, or do I 
> have to parse it 2 times, assigning a different template each time ?
>
> Hope I'm clear.
>
> Thanks in advance !
>
> Dam.
>                                         
> _________________________________________________________________
> Discutez en direct avec vos amis sur Messenger !
> http://www.windowslive.fr/messenger
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: 
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>   


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to