[stringtemplate-interest] ST4 inheritance without a group header?
Gerald Rosenberg
gerald at certiv.net
Wed Feb 24 12:48:55 PST 2010
On 2/24/2010 10:50 AM, Terence Parr wrote:
>
> Right. I didn't really consider tools that want to handle both. The
> syntax is identical except for the possibility that we make the group
> header optional. In that case, a tool wouldn't know. on the other
> hand, does the tool really care if the syntax is identical except for
> that first line? If you plan on executing templates or something like
> that you need to know, but otherwise I think we can do syntax
> highlighting without it.
What I do - and would prefer to continue doing - is use an unaltered
STParser.g, etc. as the basis for the tool's analysis. As long as I can
get a valid AST and error messages from the parse, I can handle all of
the highlighting, etc. variants with no problem.
> Right. but we need a class path or something so that people can specify the directories to look in.
Templates are always related as families (at least in good practice), so
a path name, relative to a spec'd template root dir should be all that
is required.
STGroup#temlatetRoot(URL templateFamilyRootDir)
Best of both worlds: the root is dynamic - yet can be sufficiently
inferred by the tool to allow static analysis! And, as long as the user
specifies interfaces (which are otherwise optional), the existing
dynamic imports present no problem for static analysis.
> A single file spec is insufficient and we have no place to specify anyway unless you plan on changing the syntax of the group header to specify a file name instead of a simple supergroup name.
>
Don't you already have a requirement that a supergroup or interface name
must match the file name+extension? Won't allowing a relative path
prefix to the supergroup or interface name in the template be all that
is required?
More information about the stringtemplate-interest
mailing list