[stringtemplate-interest] hastable attribute
Terence Parr
parrt at cs.usfca.edu
Wed Mar 17 10:57:44 PDT 2010
should be in the doc.
> StringTemplate interprets Map objects to have two predefined properties: keys and values that yield a list of all keys and the list of all values, respectively. When applying a template to a map, StringTemplate iterates over the values so that <aMap> is a shorthand for <aMap.values>. Similarly <aMap.keys> walks over the keys. You can list all of the elements in a map like this:
>
> <aMap.keys:{k| <k> maps to <aMap.(k)>}>.
k is source here and aMap.(k) would get you the value (a list).
T
On Mar 16, 2010, at 8:40 AM, Benjamin Ortuzar Seconde wrote:
> In C# I have a hastable. The hastable key is the 'source' name, the hastable value is a List<string>
> How can use StringTemplate to print something similar to:
>
> *Source1:
> - Title1
> - Title2
>
> *Source2:
> - Title3
> - Title4
> ..
>
> OR should I do this in a different way?
>
> Thanks in advance
> _______________________________________________
> 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