[stringtemplate-interest] File based templates and maps.

Terence Parr parrt at cs.usfca.edu
Fri Oct 20 13:59:53 PDT 2006


On Oct 19, 2006, at 11:53 PM, John Snyders wrote:

> There are many characters that can't be used as a map key without  
> enclosing
> in ().
> I don't think it matters if the map is declared in code or in the  
> group
> file.

  actually yes that is true-- the key is a string so doesn't matter  
during the definition.  When you pull it out though, we are  
overloading the dot operator which requires an identifier.

> It has to do with what is allowed after . in an attribute reference
> atom DOT ID is allowed where atom is ID, STRING, INT, or  
> ANONYMOUS_TEMPLATE.
>
> So if your map key is "a:.b" or even "first" $map.a:.b$ and  
> $map.first$
> won't work.

does $map.("a:.b")$ work?

> So I'm not sure this (integer keys) is a bug but I'm still confused  
> as to
> why ST needs to parse integers at all.

  yes, ST should not parse integers.  $map.("1")$ should work.

Ter


More information about the stringtemplate-interest mailing list