antlrcs icon indicating copy to clipboard operation
antlrcs copied to clipboard

antlr3 template generating wrong code

Open IRebo opened this issue 4 years ago • 2 comments

Hi,

i was trying to upgrade our project from older antlr 3.4 to the latest 3.5 (tried various version including the latest 3.5.2-rc1) but I keep getting a compilation error of the produced .cs file.

I have found traces of other people running into the same issue and they can describe it better then me :) https://stackoverflow.com/questions/9923639/antlr-grammar-generating-invalid-c-sharp-code https://www.antlr3.org/pipermail/antlr-interest/2012-February/044153.html

But the solution suggested (setting ASTLabelType to StringTemplate) doesnt make much sense as ASTLabelType should be of the AST type.

I have attached a minimal solution for easier diagnosing.

IRebo avatar Mar 19 '20 22:03 IRebo

antlr_test.zip

IRebo avatar Jun 01 '20 10:06 IRebo

curiously i found a solution discussed back in 2011 if anyone else runs into it - https://raw.githubusercontent.com/antlr/website-antlr3/aa6181595356409f8dc624e54715f56bd10707a8/pipermail/antlr-interest/2011-September/042586.html

IRebo avatar Oct 26 '21 23:10 IRebo