[stringtemplate-interest] [ST4] Specifying delimiter in group files

Terence Parr parrt at cs.usfca.edu
Fri Jan 28 10:27:05 PST 2011


yeah, .st/ dir is better than file.  seems ok to have different delimiters per file and per dir.  Looking at code, though, i see some issues.  not sure i can propagate the delims everywhere "fast enough".  Let's see. if we make it global per group or st file, should be ok.

// group file
delimiters '<', '>'
t(x={<(foo)>) ::= "<x>"
u() ::= "..."

// var.st file
delimiters '<', '>'
var(type, name) ::= "<type> <name>;"

wait, I don't like having a .st/config file *and* a delimiter syntax. but, doing a delim syntax for every .st file in a dir sucks.

Ter

On Jan 28, 2011, at 12:48 AM, Zenaan Harkness wrote:

> On 2011-01-28, Terence Parr <parrt at cs.usfca.edu> wrote:
>> On Jan 27, 2011, at 3:28 PM, Collin Fagan wrote:
>> 
>>> Damn ... i can't think of anything bad. It's seems reasonable to me.
>> 
>> crap! i just thought of something:
>> 
>> group dirs can have group files so they could mix. imagine
>> 
>> templates/
>> 	.stconfig		# says use <...>
>> 	method.st
>> 	class.st
>> 	field.st
>> 	subdir/
>> 		.stconfig # says use `...` inside
>> 		foo.st
>> 	misc.stg		# says use $...$ inside
>> 
>> hmm....should be consistent, right?
> 
> ACK. Definitely the group-specific config should be in group
> files/dirs/config files, not in the code!
> 
> This is a good approach. System default < >, override on per-dir and/
> or per-group-file basis.
> 
> BUT, there is possibility that configuration complexity will increase
> in future, so PLEASE, use .st/config as filename - ie the directory in
> question contains .st/ directory with file named config inside it.
> This follows the git vcs/dvcs 'standard' of a .git/config and
> .git/etc...
> 
> In this way .st/ can have other things put inside it in future, and it
> all stays nice and clean, future-proof; eg perhaps byte-code compiled
> templates cache, "description" file for web server publishing (ala
> .git/description) etc etc
> 
> I think there should be a delimiter override for per-group-file, not
> just per directory. Current config propagates downwards, and can be
> overridden by .st/config and/ or by per-group-file override.
> 
> cheers
> zen



More information about the stringtemplate-interest mailing list