[antlr-interest] Do lists work with SteingTemplates?
Terence Parr
parrt at cs.usfca.edu
Thu May 24 08:51:34 PDT 2007
On May 24, 2007, at 8:05 AM, Ted Villalba wrote:
> 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.
>
Most likely situation is that value is not returning a template.
Ter
More information about the antlr-interest
mailing list