[stringtemplate-interest] Missing convenience ctor in
StringTemplateGroup(?)
Terence Parr
parrt at cs.usfca.edu
Thu Sep 22 11:05:33 PDT 2005
On Aug 15, 2005, at 10:26 AM, Oliver Zeigermann wrote:
> I thought it might be convenient to have something that resolves the
> file a group is specified in in the same way as with string templates.
> While now you can use the ctor
>
> public StringTemplateGroup(Reader r)
>
> to make clear that the group is specified in a file, something like
> that might be more convenient:
>
> public StringTemplateGroup(String name, boolean groupFormat);
Hi. This is mainly for legacy confusion issues. The old stuff pre-
group format used strings for args to the groups. I used the Reader
stuff to make it clear. Perhaps I should have done a new subclass
instead. :(
Ter
>
> Right now I saw myself forced to write something like
>
> static Reader getGroup(String name) {
> ClassLoader cl = Thread.currentThread
> ().getContextClassLoader();
> InputStream is = cl.getResourceAsStream(name + ".stg");
> if (is == null) {
> return null;
> }
> BufferedReader reader = new BufferedReader(new
> InputStreamReader(is));
> return reader;
> }
>
> to map the name to a reader.
>
> Why isn't this part of StringTemplate?
>
> Or did I get it all wrong?
>
> Thanks for any hints/comments and cheers
>
> Oliver
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org:8080/mailman/listinfo/stringtemplate-interest
>
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
More information about the stringtemplate-interest
mailing list