[antlr-interest] Re: Bug in ANTLR C# Codegen?

Ney, Richard richard.ney at aspect.com
Tue Nov 5 10:38:14 PST 2002


Michael,

Here is my CSharpCodeGenerator.java. I have coded around the error I
mentioned here by making sure the noViableOption string is actually going to
get printed to the file. Sorry about the mix-up on version. I have
downloaded 2.7.2a4 but I am currently not using it. I applied the fixes to
the C# codegen for 2.7.2a2. This version also contains a fix to silence the
warning:

warning CS0168: The variable 'pe' is declared but never used 

By adding in a dummy call to pe.getLine(); 

-Richard

-----Original Message-----
From: micheal_jor [mailto:open.zone at virgin.net] 
Sent: Tuesday, November 05, 2002 7:31 AM
To: antlr-interest at yahoogroups.com
Subject: [antlr-interest] Re: Bug in ANTLR C# Codegen?


Hi Richard,

> After I posted my fix to the unreachable code warnings I tested the
new
> ANTLR on some other grammar files and found what appears to be a
bug that is
> causing a throw exception statement to no get inserted.

Firstly, thank you for the code fixes you contributed for inclusion 
in the C# codegen. I would be grateful if you could send your updated 
CSharpCodeGenerator.java file (and all other affected files) with all 
the fixes incorporated. It is much easier to integrate whole file 
fixes in our environment.

As for the new bug you are reporting, are you testing with ANTLR 
2.7.2a4 ("...the new ANTLR...") ?. If so, please be aware that the C# 
codegen is still being updated for 2.7.2a4. Nevertheless, thanks for 
testing it with the latest version and we are grateful for all early 
adopter test reports.  ;-)

> In this case when
> genBlockFinish gets called it is passed a CSharpBlockFinishingInfo
class and
> what appears to be a valid noViableAction string containing an
exception.
> What appears strange is that the fields in the howToFinish instance
of the
> class states that both an IF and SWITCH were generated and the it
doesn't
> need a Error Clause. Based on the values for those fields the
noViableAction
> will never get printed to the output file.
> 
> Has anyone else encountered this or is my fix to the warning the
only thing
> that has exposed this?

I certainly haven't come across this before, perhaps others on the 
list have?. Is this behavior present in other langauges -- C++ and/or 
Java?

I would be grateful for a simple grammar file that exposes this 
behaviour. I suspect we would need a grammar file and detailed 
comments that allow us to re-create the behaviour and also explains 
why the behaviour is wrong.

Thanks,

Micheal




 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: CSharpCodeGenerator.java
Type: application/octet-stream
Size: 119024 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20021105/8be8bad3/CSharpCodeGenerator.obj


More information about the antlr-interest mailing list