[antlr-interest] AST rewrite bug C# target

Floris van Nee floris.vannee at gmail.com
Fri May 8 11:17:46 PDT 2009


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090508/511307ce/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Vnvd.g
Type: application/octet-stream
Size: 9637 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20090508/511307ce/attachment.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: VnvdRewriteAstTest.g
Type: application/octet-stream
Size: 5814 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20090508/511307ce/attachment-0001.obj 


More information about the antlr-interest mailing list