[stringtemplate-interest] Help with recursive template application
Terence Parr
parrt at cs.usfca.edu
Thu Aug 20 11:53:22 PDT 2009
On Aug 19, 2009, at 6:28 PM, Vincent Dupuis wrote:
> Hi,
>
> I'm trying to pass a "parent" value in a recursive template
> application
> but without success. Here are my templates:
>
> group templates;
>
> mainTemplate(listOfClasses) ::= <<
> <listOfClasses:classDeclaration("TopClass"); separator="\n">
> >>
you are passing to parameters here: the iterated value and the string.
If there is one parameter, the iteration operator sets that sole
parameter to the iterated value.
T
>
> classDeclaration(parent) ::= <<
> class <it.name> : public <parent>
> {
> <it.listOfSubClasses:classDeclaration({<it.name>});
> separator="\n">
> }
> >>
>
> Considering A, B, and C classes are TopClass and that BB class is an
> inner class of B.
>
> and the output is...
>
> class A : public TopClass
> {
> }
> class B : public TopClass
> {
> class BB : public BB
> {
> }
> }
> class C : public TopClass
> {
> }
>
>
> Why I don't get the right value for class BB ?
> Like:
>
> class BB : public B
> {
> }
>
>
> Somebody knows why?
>
> Thanks,
>
> Vince
>
>
> Créez un personnage à votre image pour votre WL Messenger Venez voir
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest
More information about the stringtemplate-interest
mailing list