[antlr-interest] C# generated code refering rules

Johannes Luber jaluber at gmx.de
Thu Jul 5 05:06:29 PDT 2007


Liviu U wrote:
> Ahhhh, makes sense.
> Many thanks  for  the hint!!!!
> 
> PS: There is a small problem when rules not tokens are named: "class"
> "using" ( generally valid C# keywords) , the C# code generation will
> output invalid code!

The problem is simply that rule names are translated 1:1 into function
names. The workaround for now is to change the rule in the grammar into
something else. For consistency of rule naming use the source I
mentioned in my lats email's PS. This problem appears also if you happen
to use a member name of the parser class like "input". Unfortunately
Terence didn't integrate a name mangling option yet which would prefix
all rule names in functions.

Best regards,
Johannes Luber


More information about the antlr-interest mailing list