[stringtemplate-interest] howto set separator in parallel list iteration
Jens Boeykens
jens.boeykens at gmail.com
Mon Jul 7 00:56:53 PDT 2008
Hello!
I have a problem with iterating parallel lists. I use antlr together with
stringtemplate to generate templates. My antlr code looks like this:
altList
: ^( (a+=alternative r+=rewrite)+ )
->altList(alternative={$a}, rewrite = {$r})
;
my stringtemplate:
altList(alternative, rewrite) ::= <<
<alternative,rewrite: {alt,rw | <alt> <rw>}>
>>
This gives
input : INT -> test (a = {$int}) | CHAR -> test (a = {$int})
output: INT -> test (a = {$int}) CHAR -> test (a = {$int})
So parallel iterating works, but the separator '|' is missing in the output
(before CHAR).
What should I change in my template so I can add a separator.
Something like <alternative,rewrite: {alt,rw | <alt> <rw> | }> or
<alternative,rewrite: {alt,rw | <alt> <rw>; separator=" | "}>
doesn't work...
Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org:8080/pipermail/stringtemplate-interest/attachments/20080707/33f65829/attachment.html
More information about the stringtemplate-interest
mailing list