[stringtemplate-interest] Output error?
Glenn Williams
glw at iosemantics.com
Fri May 5 07:09:47 PDT 2006
The following code from the String Template Documentation page is returning "<type> <name>" when it should be returning "int foo". If I load this from a single file the output is "vardef(type,name) ::= <type> <name>;". What am I doing wrong?
/// template
group simple;
vardef(type,name) ::= "<type> <name>;"
method(type,name,args) ::= <<
<type> <name>(<args; separator=",">) {
<statements; separator="\n">
}
>>
/// code
StringTemplateGroup groupf;
try
{
groupf = new StringTemplateGroup( new FileReader(
"simple.st" ) );
StringTemplate t = groupf.getInstanceOf( "vardef" );
t.setAttribute( "type", "int" );
t.setAttribute( "name", "foo" );
System.out.println( t );
}
catch ( FileNotFoundException e )
{
e.printStackTrace();
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org:8080/pipermail/stringtemplate-interest/attachments/20060505/e9b2c4b0/attachment.html
More information about the stringtemplate-interest
mailing list