From f6bcbdba610756c1af8b4bc9ba2d3017f72e6535 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Mon, 24 Jun 2013 11:57:06 -0500 Subject: [PATCH] Remove the ParserRuleContext.altNum field (fixes #288) --- runtime/Java/src/org/antlr/v4/runtime/Parser.java | 4 +--- .../Java/src/org/antlr/v4/runtime/ParserRuleContext.java | 6 +----- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/runtime/Java/src/org/antlr/v4/runtime/Parser.java b/runtime/Java/src/org/antlr/v4/runtime/Parser.java index 87fe5740a..8c4c42b75 100644 --- a/runtime/Java/src/org/antlr/v4/runtime/Parser.java +++ b/runtime/Java/src/org/antlr/v4/runtime/Parser.java @@ -59,8 +59,7 @@ public abstract class Parser extends Recognizer { @Override public void visitTerminal(TerminalNode node) { System.out.println("consume "+node.getSymbol()+" rule "+ - getRuleNames()[_ctx.getRuleIndex()]+ - " alt="+_ctx.altNum); + getRuleNames()[_ctx.getRuleIndex()]); } @Override @@ -561,7 +560,6 @@ public abstract class Parser extends Recognizer { } } _ctx = localctx; - _ctx.altNum = altNum; } public void enterRecursionRule(ParserRuleContext localctx, int ruleIndex) { diff --git a/runtime/Java/src/org/antlr/v4/runtime/ParserRuleContext.java b/runtime/Java/src/org/antlr/v4/runtime/ParserRuleContext.java index e12163f30..1803b2be6 100644 --- a/runtime/Java/src/org/antlr/v4/runtime/ParserRuleContext.java +++ b/runtime/Java/src/org/antlr/v4/runtime/ParserRuleContext.java @@ -96,9 +96,6 @@ public class ParserRuleContext extends RuleContext { 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 * completed, this is {@code null}. @@ -288,8 +285,7 @@ public class ParserRuleContext extends RuleContext { List rules = recognizer.getRuleInvocationStack(this); Collections.reverse(rules); return "ParserRuleContext"+rules+"{" + - "altNum=" + altNum + - ", start=" + start + + "start=" + start + ", stop=" + stop + '}'; }