[stringtemplate-interest] [ST4] How to avoid map key iteration?
Sam Harwell
sharwell at pixelminegames.com
Mon Feb 14 06:35:13 PST 2011
Hi Udo,
The problem is the operation in use when you write it the way you originally
did - the ':' is a map operation as opposed to a pass to a function method.
In theory, the following syntax could solve the problem:
t2(adr,line2={x|<x.zip> <x.city>}) ::= <<
<adr.firstname> <adr.lastname>
<line2(adr)>
>>
I know this syntax doesn't work in ST3, and I'm guessing it doesn't in ST4
either. Considering the way parameters and local variables work in many
languages, I don't think allowing this would be unexpected.
Sam
From: Udo Borkowski [mailto:ub at abego-software.de]
Sent: Monday, February 14, 2011 3:21 AM
To: Sam Harwell
Cc: stringtemplate-interest List
Subject: Re: [stringtemplate-interest] [ST4] How to avoid map key iteration?
Hi Sam,
If you write it this way:
...
<t2(adr=p,line2={<adr.city>, <adr.zip>})>
Good point.
I guess it is just my personal style (and background) that makes me raise
the issue. Inside a subtemplate I'd prefer to access the parameters of the
subtemplate (the {p1,p2|.}) over the access of something outside of the
subtemplate, especially with the dynamic name lookup of ST4 in mind.
Udo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20110214/cca2539d/attachment.html
More information about the stringtemplate-interest
mailing list