[antlr-interest] Question regarding stringtemplate usage design
Terence Parr
parrt at cs.usfca.edu
Fri Feb 5 11:12:13 PST 2010
hi, you'd have to return multiple ST manually with returns [...].
T
On Feb 5, 2010, at 2:31 AM, Gustaf Johansson wrote:
> Hi,
>
> I have a antlr parser that is using stringtemplates to "translate" the input.
> Im having problems when i want to reorder the output from the input,
> when this spans multiple rules down.
>
> Simplified example: (this is what i have, but its obviously not working)
>
> prog: a b=ID -> progTempl(a={$a.st}, b={$b.text});
> a: x=ID y=ID -> aTempl(x={$x.text}, y={$y.text});
>
>
> I would like the output to be:
>
> "a.y b a.x"
>
> So the question is basically, how do i return multiple string from a
> stringtemplate?
> Since im using $a.st in the prog rule i get the entire text, but i
> would want it in 2 chunks. So i can insert b "between" the 2 chunks.
>
> Best Regards Gustaf
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
More information about the antlr-interest
mailing list