[antlr-interest] Do lists work with SteingTemplates?

Ted Villalba ted.villalba at gmail.com
Thu May 24 08:05:08 PDT 2007


Hi,

I've sent a similar post, but perhaps this one is worded better. It even
includes a glossy ascii diagram.
I'm wondering if anyone is using the following += notation to pass a list in
StringTemplates. I've not had any luck getting it to work..
I basically have an AST with the following structure ^('=' tag value+) ,
which creates an AST something like:
          =
     /    |     \
    /     |       \
tag value1  value2...

I'm using a string template to pull these like so:
expression : ^('=' tag (v+=value)+) ->
template4(tag={$tag.text},values={$v}) ;

But this fails to pull any of the values into the list and I get empty lists
back. If I simply pull singular values back, and remove the += list
construct from the grammar, it works fine, for example, the case where tag =
value1. It just fails when tag = value 1 value2. I have not found a way to
capture value2.

Thanks,
Ted
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070524/a5f8a61c/attachment.html 


More information about the antlr-interest mailing list