[antlr-interest] How to the generated code in the "catch" section ?

Johannes Luber jaluber at gmx.de
Wed Feb 27 14:09:51 PST 2008


Ahmed Hamouda schrieb:
> Hi all,
> 
> I generated C# parser and lexer already but I have a small problem.
> 
> That I noticed that the generated parser has “try and catch” for each 
> method but I can’t change in generated code in the “catch” section 
> except by changing it by hand in the parser generated class.
> 
> Is there any way to change it in the Antlr before the generation of code ?

I don't know if ANTLR provides already an option for this, but if you 
build yourself an ANTLR jar then you can try to modify the file 
CSharp.stg yourself. I don't know what you have to change where. The 
problem with this method is that you to manually update the CSharp.stg 
for every new release, as the development may necessitate further changes.

Johannes


More information about the antlr-interest mailing list