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
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.