Merge pull request #290 from sharwell/fix-288

Remove the ParserRuleContext.altNum field (fixes #288)
This commit is contained in:
Sam Harwell 2013-06-24 13:22:53 -07:00
commit ca21368961
2 changed files with 2 additions and 8 deletions

View File

@ -59,8 +59,7 @@ public abstract class Parser extends Recognizer<Token, ParserATNSimulator> {
@Override @Override
public void visitTerminal(TerminalNode node) { public void visitTerminal(TerminalNode node) {
System.out.println("consume "+node.getSymbol()+" rule "+ System.out.println("consume "+node.getSymbol()+" rule "+
getRuleNames()[_ctx.getRuleIndex()]+ getRuleNames()[_ctx.getRuleIndex()]);
" alt="+_ctx.altNum);
} }
@Override @Override
@ -561,7 +560,6 @@ public abstract class Parser extends Recognizer<Token, ParserATNSimulator> {
} }
} }
_ctx = localctx; _ctx = localctx;
_ctx.altNum = altNum;
} }
public void enterRecursionRule(ParserRuleContext localctx, int ruleIndex) { public void enterRecursionRule(ParserRuleContext localctx, int ruleIndex) {

View File

@ -96,9 +96,6 @@ public class ParserRuleContext extends RuleContext {
public Token start, stop; public Token start, stop;
/** Set during parsing to identify which alt of rule parser is in. */
public int altNum;
/** /**
* The exception which forced this rule to return. If the rule successfully * The exception which forced this rule to return. If the rule successfully
* completed, this is {@code null}. * completed, this is {@code null}.
@ -288,8 +285,7 @@ public class ParserRuleContext extends RuleContext {
List<String> rules = recognizer.getRuleInvocationStack(this); List<String> rules = recognizer.getRuleInvocationStack(this);
Collections.reverse(rules); Collections.reverse(rules);
return "ParserRuleContext"+rules+"{" + return "ParserRuleContext"+rules+"{" +
"altNum=" + altNum + "start=" + start +
", start=" + start +
", stop=" + stop + ", stop=" + stop +
'}'; '}';
} }