Hi Peter, The TraceIn/TraceOut methods in Parser and BaseRecognizer have different signatures (2 parameters vs. 3). The code generator emits calls to the one in Parser, which is supposed to forward the calls to BaseRecognizer. From what I can tell from the code generation templates, the methods in BaseRecognizer should not have the ConditionalAttribute applied to them. I'll remove the attribute for the next build, which will restore the expected behavior to the methods in Parser and Lexer.
Thanks for the report. :) Sam -----Original Message----- From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-boun...@antlr.org] On Behalf Of Peter Kooiman Sent: Saturday, April 02, 2011 11:42 AM To: antlr-interest@antlr.org Subject: [antlr-interest] [CSharp3] TraceIn/TraceOut and ANTLR_TRACE conditional After struggling a bit to get tracing working in my parser by defining ANTLR_TRACE and getting nowhere, I realized the following, which may or may not be intended: Both the Parser and Lexer classes inherit from BaseRecognizer and override (well, hide) the BaseRecognizer TraceIn and TraceOut methods. These overrides call base.Traceout / base.TraceIn, BUT, since during library compilation ANTLR_TRACE is not defined, these base method calls become no-ops. The result is, that while BaseRecognizer has usable TraceIn and TraceOut methods, the TraceIn and TraceOut methods of both Parser and Lexer become essentially no-ops. This is the MSIL for Parser::TraceIn in Antlr3.Runtime.dll: .method public hidebysig newslot virtual instance void TraceIn(string ruleName, int32 ruleIndex) cil managed { .custom instance void [mscorlib]System.Diagnostics.ConditionalAttribute::.ctor(string) = ( 01 00 0B 41 4E 54 4C 52 5F 54 52 41 43 45 00 00 ) // ...ANTLR_TRACE.. // Code size 1 (0x1) .maxstack 8 IL_0000: ret } // end of method Parser::TraceIn Fixed easily enough by overriding TraceIn/TraceOut in my parser, but a bit of a pain to figure out, so I thought I'd at least document it here. Regards Peter List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to il-antlr-inter...@googlegroups.com. To unsubscribe from this group, send email to il-antlr-interest+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.