[antlr-interest] Getting Object[] instead of String[]

Terence Parr parrt at cs.usfca.edu
Wed May 30 17:49:33 PDT 2007


On May 30, 2007, at 5:41 PM, Bernardo Elayda wrote:

> Hi,
>
> I'm using Antlr 3's new stringtemplate combined feature.
>
> I'm trying to pass a list of tokens to a template, where I want the  
> token text listed:
>
> my anltr 3 code:
>
> program myabc=MYABC mydigits+=MYNUM+ -> array2(mytext={$mydigits}) ;
>
>
> my template which is in a stringtempalte group file:
>
> array2(mytext) ::= <<
> static const u16_t fpgadata2[] = {
> <mytext; separator=", ">
> }
> >>
>
> The template lists all the items in the 'mydigits' list with a  
> comma seperated but it's not listing the token text.

what is it listing instead?  that should be a list of tokens.  Have  
you tried

<mytext:{t | <t.text>}; separator=", ">

Ter

> I have a Java hack that gets around this.  I would really like a  
> generic languate neutral solution.  I've looked in the Antlr book  
> and on the Wiki but I couldn't find something that really applied.
>
> Suggestions?
> thx in advance!
> -Bernardo



More information about the antlr-interest mailing list