You should always reference rule arguments and return values with a $,
as in $ids. I'm thinking about making a mode that mangles the names of
items that aren't meant to be accessed directly, which is required for
some optimization work I've been planning.

 

Sam

 

From: [email protected]
[mailto:[email protected]] On Behalf Of Floris van Nee
Sent: Friday, May 08, 2009 1:18 PM
To: ANTLR
Subject: [antlr-interest] AST rewrite bug C# target

 

Hi all, 

 

I think I've come across another bug in the C# target when rewriting
ASTs in tree grammars.

 

I have included two files needed to reproduce the bug. The behaviour is
this:

 

It happens when a tree grammar is created with rules which return
values, like:

 

qualifier returns [List<string> ids]

            :           ^(fqual=FQUALIFIER IDENTIFIER+ ARRAY?)

                        {

                                    ids = new List<String>() { "System",
"Void" };

                        }

            ;

 

The C# compiler complains about the variable ids which it cannot find.

Also, when you reference the return value of such a rule somewhere, as
in qual=qualifier, you will have a variable qual with type
qualifier_return, instead of List<string>.

 

I guess this is a bug in the C# target of ANTLR - but if it's not, what
should I do to make the code compile correctly?

I am using the latest version of ANTLR (3.1.3)

 

Thanks,

Floris


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to