[stringtemplate-interest] mapping templates

Terence Parr parrt at cs.usfca.edu
Thu Oct 8 13:32:18 PDT 2009


ooops, what about args that are part of the map? here's an ANTLR  
example usage:

<bitsets:bitset(name={FOLLOW_<it.name>_in_<it.inName><it.tokenIndex>},  
words64=it.bits)>

I want to set some args as well as the "it".

I do it again here:

<foo:parameterScope(scope=it)>

But, scope is only arg so it's same as:

<foo:parameterScope()>

or

<parameterScope(foo)>

So, anybody else use the args in map call?  I'm thinking it's  
confusing and we should remove.  E.g., in what context is "it"  
evaluated above?

I could rephrase as

<bitsets:{b | <bitset(name= 
{FOLLOW_<b.name>_in_<b.inName><it.tokenIndex>}, words64=b.bits)>}>

so we don't need I guess. Objections?

Ter
On Oct 7, 2009, at 12:28 PM, Terence Parr wrote:

> Hi, there is a syntax bugaboo in ST v3.
>
> <names:bold()> means apply bold to each element of names but t=foo()
> in an arg list or wherever means invoke foo and put ST into t.  Seems
> like foo should be a template name and foo() should be an invocation.
> That would imply we'd chnage to:
>
> <names:bold>
>
> Makes more sense if you ask me.  Other thoughts?
>
> Ter
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest



More information about the stringtemplate-interest mailing list