[antlr-interest] AST rewrite bug C# target

Gavin Lambert antlr at mirality.co.nz
Sat May 9 03:04:17 PDT 2009


At 20:55 9/05/2009, Floris van Nee wrote:
>There's one more error left though, in rules like:
>type_qualifier returns [List<string> ids]
>:v=VOID
>{
>$ids = new List<String>() { "System", "Void" };
>}
>|qual=qualifier
>{
>$ids = qual;
>}
>;
>
>Here I want to assign the value of qual (which should be of type 
>List<string>) to $ids. In output=AST mode qual is of type 
>qualifier_return, instead of List<string>, but in normal mode it 
>compiles correctly. What am I doing wrong here then?

Assuming that the 'qualifier' rule is defined similarly, then you 
should be using this instead:

   $ids = $qual.ids;



More information about the antlr-interest mailing list