[stringtemplate-interest] Suggestion for ST Maps

Terence Parr parrt at cs.usfca.edu
Thu Aug 13 17:43:22 PDT 2009


An excellent suggestion. adding to my list

http://www.antlr.org/jira/browse/ST-62

Ter
On Aug 13, 2009, at 10:07 AM, Swapnil Kashikar wrote:

> Hi,
>
> In the Maps we are using the values are pretty complex templates using
> the big string syntax <<...>>
> Further, multiple keys use the exact same templates as values  and we
> have to repeat the big template strings for each of these keys in the
> map.
>
> Now we could factor out the repeated value templates into a different
> named template and refer those in maps to simplify, but still I think,
> it would help if Map syntax itself allows multiple keys to map to same
> value.
> Something like:
>
> ====
> typeInitMap ::= [
>        "int","long","byte","short","char":"0",
>        "float","double":"0.0",
>        "boolean":"false",
>        default:"null" // anything other than an atomic type
> ]
> ====
>
> instead of what current ST requires:
>
> ====
> typeInitMap ::= [
>        "int":"0",
>        "long":"0",
>        "float":"0.0",
>        "double":"0.0",
>        "boolean":"false",
>        "byte":"0",
>        "short":"0",
>        "char":"0",
>        default:"null" // anything other than an atomic type
> ]
> ====
> Note: above is for illustration, not our real ST.
>
> Thanks,
> Swapnil
> _______________________________________________
> 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