[stringtemplate-interest] Variables in Template Parameters
Brain, Jim
JBrain at Aegonusa.com
Mon Nov 9 13:14:51 PST 2009
Is there a way to allow $getter$, which is passed "get$name$()" to expand $name$ to "Name"?
import org.antlr.stringtemplate.*;
public class STTest {
public static void main(String[] args) {
StringTemplateGroup stg = new StringTemplateGroup("Source");
stg.defineTemplate("reader","$type$.$getter$");
StringTemplateGroup stg2 = new StringTemplateGroup("Class");
stg2.setSuperGroup(stg);
StringTemplate st = stg2.defineTemplate("prop","$reader(getter=\"get$name$()\")$");
st.setAttribute("name","Name");
st.setAttribute("type","TYPE");
System.out.println(st.toString());
}
}
When I run this, I get:
TYPE.get$name$()
Which means the attributes are flowing through correctly, but the substitution in the parameter is not occurring.
--
Jim Brain, AFP Architecture, 319-355-2070
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20091109/fa92df40/attachment-0001.html
More information about the stringtemplate-interest
mailing list