[stringtemplate-interest] Setting the default lexer on the common group loader
ed ed
edeustace at yahoo.com
Sun Jul 19 12:58:13 PDT 2009
Hello,
I've been playing around with StringTemplate 3.2 and enjoying it greatly.
When I started I began using the $ as my expression delimiter. This was working great while developing locally.
I'm now trying to generate a .jar within which I have my bundled Templates. The docs state that you need to use CommonGroupLoader for jar files. (http://www.antlr.org/wiki/display/ST/Group+Files). However the default lexer token for groups is the Angle bracket (<>).
I can see in the docs how to change the delimiter for a template group that I'm creating a new instance of:
http://www.antlr.org/wiki/display/ST/Setting+the+expression+delimiters
But I don't know how to change the default delimiter when using the comon group loader.
This is what I'm trying:
StringTemplateGroupLoader loader = new CommonGroupLoader(FOLDER, new ErrorListener() );
StringTemplateGroup.registerGroupLoader(loader);
StringTemplateGroup.registerDefaultLexer(DefaultTemplateLexer.class);
StringTemplateGroup group = StringTemplateGroup.loadGroup("classgroup");
StringTemplate template = group.getInstanceOf("classGenerator");
template.setAttribute("config", "config" );
log.info(template.toString() );
For a template like so:
group classgroup;
classGenerator(config,setup) ::= <<
hello $config$
hello "config"
hello <config>
>>
I get:
hello $config$
hello "config"
hello config
The closest thing I've found is this:
http://www.antlr.org/pipermail/stringtemplate-interest/2007-May/001046.html
Any tips greatly appreciated,
Best,
Ed
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20090719/51574404/attachment.html
More information about the stringtemplate-interest
mailing list