For this rule,
identifier
: isToken | IDENTIFIER;
ANTLR generates code that would never calls the isToken rule
(target=CSharp2):
public MYParser.identifier_return identifier() // throws
RecognitionException [1]
{
.
// . : ( isToken | IDENTIFIER )
int alt30 = 2;
int LA30_0 = input.LA(1);
if ( (LA30_0 == IDENTIFIER) ) // <== token must be IDENTIFIER
to call isToken???
{
int LA30_1 = input.LA(2);
if ( ((isToken(input.LT(1)))) ) // <== why must LA30_0 ==
IDENTIFIER to call isToken?
{
alt30 = 1;
}
else if ( (true) )
{
alt30 = 2;
}
.
else // <== since not IDENTIFIER, why
not call isToken here???
{
NoViableAltException nvae_d30s0 =
new NoViableAltException("", 30, 0, input);
throw nvae_d30s0;
}
I would think it's something to do with DFA optimization? Perhaps that's
why IDENTIFIER is checked first.
But, if IDENTIFIER is false, why not call isToken??? Afterall, the rule
is IDENTIFIER ****OR***** isToken.
Thanks,
Trober
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.