[stringtemplate-interest] "Allowing enclosing attributes to pass through"

Terence Parr parrt at cs.usfca.edu
Mon Nov 30 13:03:55 PST 2009


On Nov 30, 2009, at 12:17 PM, Brain, Jim wrote:

> I’m having trouble getting my attributes to pass through to an sub template:
>  
>             StringTemplateGroup stg = new StringTemplateGroup("Source");
>             stg.defineTemplate("Banner","$stuff: {$it$;\n}$");
>             StringTemplate st = stg.defineTemplate("Parser","$Banner(stuff=\"Jim\", ...)$");
>             st.setAttribute("stuff","Jack");
>             System.out.println(st.toString());
>  
> I refactored Parser into Parser and Banner, but now when I pass stuff=”” into Banner, it completely hides the stuff value set in the Parser template.  Is there any way to unhide?

Only one value visible per name so passing stuff into Banner hides Parser's version. no way to see outer value.
Ter

>  I read the same named section from the documentation, which suggested the ‘…’ notation, but that does not appear to change the behavior.
>  
> Jim
>  
>  
> _______________________________________________
> 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