[stringtemplate-interest] ST4 inheritance without a group header?

Gerald Rosenberg gerald at certiv.net
Tue Feb 23 17:34:12 PST 2010


On 2/23/2010 4:37 PM, Terence Parr wrote:
> On Feb 23, 2010, at 1:07 PM, Gerald Rosenberg wrote:
>    
>> Don't Ruby and Python use source statements to specify the import.
>>      
> well,For both import and superclass they do, but I'm under the impression you can monkey with the inheritance at runtime.
>    

I don't think their tools don't handle those circumstances statically; 
only under debug.

>
>> You mean a grammar file option?
> nope. something inside the stg file:
>
> options {super="another.stg"}
>    

FWIW, my preference would be for the old group statement syntax.  Not 
sure that the options syntax is clearer, and it does not address the 
ambiguity of whether a group statement is proper or not (and now whether 
an options statement is proper or not).  Would have to somehow grep into 
the template to infer whether it is ST3 or 4 and dynamically switch 
parsers, though that still would not be entirely unambiguous - yuk.

>>> It still brings up the question of how do you know where the supergroup lives on the disk.
>> Not sure the problem.  You already impose a directory structure - could
>> just pass the template root path as a parameter to STGroupFile and
>> STGroupDir and support relative paths in the templates, right?
> well, I was able to rip out all of that STGroupLoader crap from v3 because I didn't have to allow people to give me some kind of a classpath=like mechanism defined supergroups. the supergroup could be from a socket a database another directory etc.
>    

I would think that anything that looks like a file store must support 
URI access by now.  Oracle even supports simple URI access (not 
JDBC-based) to its repository, which can be mapped onto a standard 
table.  Anyone who insists on a raw socket should be required to provide 
a URI wrapper, etc.



More information about the stringtemplate-interest mailing list