[antlr-interest] CSharp2 code generation bug for ANTLRWorks 1.2.3 with -debug
Dukie Banderjee
dukie_banderjee at hotmail.com
Sun Jun 14 18:37:54 PDT 2009
The following grammar produces uncompilable code when generated from ANTLRWorks using -debug in the ANTLR options. I'm not sure which version of ANTLR is being used by ANTLRWorks. If it matters, I have ANTLR 3.1.3 on my machine.
====
grammar EdifactDelfor;
options {
language = 'CSharp2' ;
}
tokens {
}
file : contents+ EOF ;
contents : TEXT
| SEP
| WS
| CSEP
| EOL
;
EOL: '\'';
SEP: '+';
CSEP: ':';
TEXT: ('a'..'z'|'A'..'Z'|'0'..'9'|' '|'-'|','|'.'|'/'|'?')+ ;
WS: ('\r'? '\n')+ ;
====
Here is the culprit code that was generated (in the file() method):
default:
if (cnt1 >= 1) goto loop1;
EarlyExitException eee1 =
new EarlyExitException(1, input);
dbg.RecognitionException(eee); // Note the missing '1': should be eee1
throw eee1;
When I manually change the reference to eee1, the thing compiles.
This bug does not appear when -debug is turned off.
Rob
_________________________________________________________________
Attention all humans. We are your photos. Free us.
http://go.microsoft.com/?linkid=9666046
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090614/0edbb32d/attachment.html
More information about the antlr-interest
mailing list