From 2fc33d97cd4331042a530fee4e6ccf674dd6104b Mon Sep 17 00:00:00 2001 From: Eric Vergnaud Date: Mon, 12 Dec 2016 21:36:41 +0800 Subject: [PATCH] all tests pass! --- .../v4/test/runtime/templates/CSharp.test.stg | 2 +- .../test/runtime/csharp/BaseCSharpTest.java | 59 +------- .../descriptors/PerformanceDescriptors.java | 9 +- .../runtime/CSharp/Antlr4.Runtime/Atn/ATN.cs | 5 +- .../CSharp/Antlr4.Runtime/Atn/LL1Analyzer.cs | 75 +++++----- .../CSharp/Antlr4.Runtime/Atn/MergeCache.cs | 22 ++- .../Antlr4.Runtime/Atn/ParserATNSimulator.cs | 39 ++--- .../Antlr4.Runtime/Atn/SemanticContext.cs | 139 +----------------- .../Antlr4.Runtime/DefaultErrorStrategy.cs | 3 +- .../Antlr4.Runtime/Dfa/DFASerializer.cs | 4 +- .../runtime/CSharp/Antlr4.Runtime/Parser.cs | 4 +- 11 files changed, 100 insertions(+), 261 deletions(-) diff --git a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/CSharp.test.stg b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/CSharp.test.stg index aac1b8186..56c7c87e9 100644 --- a/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/CSharp.test.stg +++ b/runtime-testsuite/resources/org/antlr/v4/test/runtime/templates/CSharp.test.stg @@ -76,7 +76,7 @@ GetExpectedTokenNames() ::= "this.GetExpectedTokens().ToString(this.Vocabulary)" RuleInvocationStack() ::= "GetRuleInvocationStackAsString()" -LL_EXACT_AMBIG_DETECTION() ::= <> +LL_EXACT_AMBIG_DETECTION() ::= <> ParserToken(parser, token) ::= <%.%> diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/BaseCSharpTest.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/BaseCSharpTest.java index ded2c9904..d9c393623 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/BaseCSharpTest.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/csharp/BaseCSharpTest.java @@ -13,7 +13,6 @@ import org.antlr.v4.runtime.WritableToken; import org.antlr.v4.runtime.misc.Utils; import org.antlr.v4.test.runtime.ErrorQueue; import org.antlr.v4.test.runtime.RuntimeTestSupport; -import org.antlr.v4.test.runtime.SpecialRuntimeTestAssert; import org.antlr.v4.tool.ANTLRMessage; import org.antlr.v4.tool.GrammarSemanticsMessage; import org.junit.rules.TestRule; @@ -54,7 +53,7 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; -public class BaseCSharpTest implements RuntimeTestSupport, SpecialRuntimeTestAssert { +public class BaseCSharpTest implements RuntimeTestSupport /*, SpecialRuntimeTestAssert*/ { public static final String newline = System.getProperty("line.separator"); public static final String pathSep = System.getProperty("path.separator"); @@ -788,64 +787,8 @@ public class BaseCSharpTest implements RuntimeTestSupport, SpecialRuntimeTestAss org.junit.Assert.assertEquals(msg, a, b); } - @Override - public void assertEqualStrings(String a, String b) { - assertEquals(a, b); - } - protected static void assertEquals(String a, String b) { - a = absorbExpectedDifferences(a); - b = absorbActualDifferences(b); org.junit.Assert.assertEquals(a, b); } - protected static void assertNull(String a) { - a = absorbActualDifferences(a); - org.junit.Assert.assertNull(a); - } - - private static String absorbExpectedDifferences(String a) { - if(a==null) - return a; - // work around the lack of requiresFullContext field in DFAState - if(a.startsWith("Decision")) - a = a.replaceAll("\\^", ""); - // work around the algo difference for full context - a = stripOutUnwantedLinesWith(a, "reportAttemptingFullContext","reportContextSensitivity", "reportAmbiguity"); - if(a.isEmpty()) { - a = null; - } - return a; - } - - private static String absorbActualDifferences(String a) { - if(a==null) return a; - // work around the algo difference for full context - // work around the algo difference for semantic predicates - a = stripOutUnwantedLinesWith(a, "reportContextSensitivity","eval=false"); - if(a.isEmpty()) { - a = null; - } - return a; - } - - private static String stripOutUnwantedLinesWith(String a, String ... unwanteds) { - String[] lines = a.split("\n"); - StringBuilder sb = new StringBuilder(); - for(String line : lines) { - boolean wanted = true; - for(String unwanted : unwanteds) { - if(line.contains(unwanted) ) { - wanted = false; - break; - } - } - if(!wanted) - continue; - sb.append(line); - sb.append("\n"); - } - return sb.toString(); - } - } diff --git a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/PerformanceDescriptors.java b/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/PerformanceDescriptors.java index 6ce50578f..b92bc9f83 100644 --- a/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/PerformanceDescriptors.java +++ b/runtime-testsuite/test/org/antlr/v4/test/runtime/descriptors/PerformanceDescriptors.java @@ -107,8 +107,7 @@ public class PerformanceDescriptors { @Override public boolean ignore(String targetName) { -// return !Arrays.asList("Java", "Python2", "Python3", "Node").contains(targetName); - return !Arrays.asList("Java").contains(targetName); + return !Arrays.asList("Java", "CSharp", "Python2", "Python3", "Node").contains(targetName); } } @@ -190,6 +189,12 @@ public class PerformanceDescriptors { */ @CommentHasStringValue public String input; + + @Override + public boolean ignore(String targetName) { + // passes, but still too slow in Python and JavaScript + return !Arrays.asList("Java", "CSharp").contains(targetName); + } } public static class DropLoopEntryBranchInLRRule_5 extends DropLoopEntryBranchInLRRule { diff --git a/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Atn/ATN.cs b/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Atn/ATN.cs index ca2f2c8fc..4a93fcf96 100644 --- a/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Atn/ATN.cs +++ b/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Atn/ATN.cs @@ -139,9 +139,8 @@ namespace Antlr4.Runtime.Atn /// 's rule. /// [return: NotNull] - public virtual IntervalSet NextTokens(ATNState s, PredictionContext ctx) + public virtual IntervalSet NextTokens(ATNState s, RuleContext ctx) { - Args.NotNull("ctx", ctx); LL1Analyzer anal = new LL1Analyzer(this); IntervalSet next = anal.Look(s, ctx); return next; @@ -163,7 +162,7 @@ namespace Antlr4.Runtime.Atn { return s.nextTokenWithinRule; } - s.nextTokenWithinRule = NextTokens(s, PredictionContext.EMPTY); + s.nextTokenWithinRule = NextTokens(s, null); s.nextTokenWithinRule.SetReadonly(true); return s.nextTokenWithinRule; } diff --git a/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Atn/LL1Analyzer.cs b/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Atn/LL1Analyzer.cs index 15870f628..e7a7d4a41 100644 --- a/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Atn/LL1Analyzer.cs +++ b/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Atn/LL1Analyzer.cs @@ -138,9 +138,9 @@ namespace Antlr4.Runtime.Atn /// . /// [return: NotNull] - public virtual IntervalSet Look(ATNState s, PredictionContext ctx) + public virtual IntervalSet Look(ATNState s, RuleContext ctx) { - return Look(s, s.atn.ruleToStopState[s.ruleIndex], ctx); + return Look(s, null, ctx); } /// @@ -189,13 +189,12 @@ namespace Antlr4.Runtime.Atn /// . /// [return: NotNull] - public virtual IntervalSet Look(ATNState s, ATNState stopState, PredictionContext ctx) + public virtual IntervalSet Look(ATNState s, ATNState stopState, RuleContext ctx) { IntervalSet r = new IntervalSet(); bool seeThruPreds = true; - // ignore preds; get all lookahead - bool addEOF = true; - Look(s, stopState, ctx, r, new HashSet(), new BitSet(), seeThruPreds, addEOF); + PredictionContext lookContext = ctx != null ? PredictionContext.FromRuleContext(s.atn, ctx) : null; + Look(s, stopState, lookContext, r, new HashSet(), new BitSet(), seeThruPreds, true); return r; } @@ -301,36 +300,37 @@ namespace Antlr4.Runtime.Atn } if (s is RuleStopState) { - if (ctx.IsEmpty && !ctx.IsEmpty) + if (ctx == null) + { + look.Add(TokenConstants.EPSILON); + return; + } + else if (ctx.IsEmpty && addEOF) { - if (addEOF) - { - look.Add(TokenConstants.EOF); - } + look.Add(TokenConstants.EOF); return; } - bool removed = calledRuleStack.Get(s.ruleIndex); - try - { - calledRuleStack.Clear(s.ruleIndex); - for (int i = 0; i < ctx.Size; i++) - { - if (ctx.GetReturnState(i) == PredictionContext.EMPTY_RETURN_STATE) - { - continue; - } - ATNState returnState = atn.states[ctx.GetReturnState(i)]; - // System.out.println("popping back to "+retState); - Look(returnState, stopState, ctx.GetParent(i), look, lookBusy, calledRuleStack, seeThruPreds, addEOF); - } - } - finally - { - if (removed) - { - calledRuleStack.Set(s.ruleIndex); - } - } + if (ctx != PredictionContext.EMPTY) + { + for (int i = 0; i < ctx.Size; i++) + { + ATNState returnState = atn.states[ctx.GetReturnState(i)]; + bool removed = calledRuleStack.Get(returnState.ruleIndex); + try + { + calledRuleStack.Clear(returnState.ruleIndex); + Look(returnState, stopState, ctx.GetParent(i), look, lookBusy, calledRuleStack, seeThruPreds, addEOF); + } + finally + { + if (removed) + { + calledRuleStack.Set(returnState.ruleIndex); + } + } + } + return; + } } int n = s.NumberOfTransitions; for (int i_1 = 0; i_1 < n; i_1++) @@ -343,15 +343,15 @@ namespace Antlr4.Runtime.Atn { continue; } - PredictionContext newContext = ctx.GetChild(ruleTransition.followState.stateNumber); + PredictionContext newContext = SingletonPredictionContext.Create(ctx, ruleTransition.followState.stateNumber); try { - calledRuleStack.Set(ruleTransition.ruleIndex); + calledRuleStack.Set(ruleTransition.target.ruleIndex); Look(t.target, stopState, newContext, look, lookBusy, calledRuleStack, seeThruPreds, addEOF); } finally { - calledRuleStack.Clear(ruleTransition.ruleIndex); + calledRuleStack.Clear(ruleTransition.target.ruleIndex); } } else @@ -375,13 +375,12 @@ namespace Antlr4.Runtime.Atn } else { - if (t.GetType() == typeof(WildcardTransition)) + if (t is WildcardTransition) { look.AddAll(IntervalSet.Of(TokenConstants.MinUserTokenType, atn.maxTokenType)); } else { - // System.out.println("adding "+ t); IntervalSet set = t.Label; if (set != null) { diff --git a/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Atn/MergeCache.cs b/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Atn/MergeCache.cs index 01c3db94b..8d6955fbd 100644 --- a/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Atn/MergeCache.cs +++ b/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Atn/MergeCache.cs @@ -1,16 +1,34 @@ using System; +using System.Collections.Generic; + namespace Antlr4.Runtime.Atn { public class MergeCache { + Dictionary> data = new Dictionary>(); + public PredictionContext Get(PredictionContext a, PredictionContext b) { - throw new NotImplementedException(); + Dictionary first; + if (!data.TryGetValue(a, out first)) + return null; + PredictionContext value; + if (first.TryGetValue(b, out value)) + return value; + else + return null; + } public void Put(PredictionContext a, PredictionContext b, PredictionContext value) { - throw new NotImplementedException(); + Dictionary first; + if (!data.TryGetValue(a, out first)) + { + first = new Dictionary(); + data[a] = first; + } + first[b] = value; } } } diff --git a/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Atn/ParserATNSimulator.cs b/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Atn/ParserATNSimulator.cs index 83cf7ffce..b43eeb4cd 100644 --- a/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Atn/ParserATNSimulator.cs +++ b/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Atn/ParserATNSimulator.cs @@ -1230,11 +1230,14 @@ namespace Antlr4.Runtime.Atn * filter the prediction context for alternatives predicting alt>1 * (basically a graph subtraction algorithm). */ - PredictionContext context = statesFromAlt1[config.state.stateNumber]; - if (context != null && context.Equals(config.context)) + PredictionContext ctx; + if (statesFromAlt1.TryGetValue(config.state.stateNumber, out ctx)) { - // eliminated - continue; + if (ctx != null && ctx.Equals(config.context)) + { + // eliminated + continue; + } } } @@ -1275,7 +1278,7 @@ namespace Antlr4.Runtime.Atn { if (ambigAlts[c.alt]) { - altToPred[c.alt] = SemanticContext.Or(altToPred[c.alt], c.semanticContext); + altToPred[c.alt] = SemanticContext.OrOp(altToPred[c.alt], c.semanticContext); } } @@ -1556,7 +1559,8 @@ namespace Antlr4.Runtime.Atn int depth, bool treatEofAsEpsilon) { - if (debug) Console.WriteLine("closure(" + config.ToString(parser, true) + ")"); + if (debug) + Console.WriteLine("closure(" + config.ToString(parser, true) + ")"); if (config.state is RuleStopState) { @@ -1960,7 +1964,7 @@ namespace Antlr4.Runtime.Atn } } else { - SemanticContext newSemCtx = SemanticContext.And(config.semanticContext, pt.Predicate); + SemanticContext newSemCtx = SemanticContext.AndOp(config.semanticContext, pt.Predicate); c = new ATNConfig(config, pt.target, newSemCtx); } } @@ -2011,7 +2015,7 @@ namespace Antlr4.Runtime.Atn } } else { - SemanticContext newSemCtx = SemanticContext.And(config.semanticContext, pt.Predicate); + SemanticContext newSemCtx = SemanticContext.AndOp(config.semanticContext, pt.Predicate); c = new ATNConfig(config, pt.target, newSemCtx); } } @@ -2324,20 +2328,19 @@ namespace Antlr4.Runtime.Atn exact, ambigAlts, configs); } - public void SetPredictionMode(PredictionMode mode) + public PredictionMode PredictionMode { - this.mode = mode; + get + { + return this.mode; + } + set + { + this.mode = value; + } } - public PredictionMode GetPredictionMode() - { - return mode; - } - - /** - * @since 4.3 - */ public Parser getParser() { return parser; diff --git a/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Atn/SemanticContext.cs b/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Atn/SemanticContext.cs index 2c03a6737..36f1d66f4 100644 --- a/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Atn/SemanticContext.cs +++ b/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Atn/SemanticContext.cs @@ -30,99 +30,19 @@ using System; using System.Collections.Generic; using System.Linq; -using Antlr4.Runtime; -using Antlr4.Runtime.Atn; using Antlr4.Runtime.Misc; using Antlr4.Runtime.Sharpen; namespace Antlr4.Runtime.Atn { - /// - /// A tree structure used to record the semantic context in which - /// an ATN configuration is valid. - /// - /// - /// A tree structure used to record the semantic context in which - /// an ATN configuration is valid. It's either a single predicate, - /// a conjunction - /// p1&&p2 - /// , or a sum of products - /// p1||p2 - /// . - ///

I have scoped the - /// - /// , - /// - /// , and - /// - /// subclasses of - /// - /// within the scope of this outer class.

- ///
public abstract class SemanticContext { - /// - /// The default - /// - /// , which is semantically equivalent to - /// a predicate of the form - /// - /// - /// true}?}. - /// public static readonly SemanticContext NONE = new SemanticContext.Predicate(); - /// - /// For context independent predicates, we evaluate them without a local - /// context (i.e., null context). - /// - /// - /// For context independent predicates, we evaluate them without a local - /// context (i.e., null context). That way, we can evaluate them without - /// having to create proper rule-specific context during prediction (as - /// opposed to the parser, which creates them naturally). In a practical - /// sense, this avoids a cast exception from RuleContext to myruleContext. - ///

For context dependent predicates, we must pass in a local context so that - /// references such as $arg evaluate properly as _localctx.arg. We only - /// capture context dependent predicates in the context in which we begin - /// prediction, so we passed in the outer context here in case of context - /// dependent predicate evaluation.

- ///
public abstract bool Eval(Recognizer parser, RuleContext parserCallStack) where ATNInterpreter : ATNSimulator; - /// Evaluate the precedence predicates for the context and reduce the result. - /// Evaluate the precedence predicates for the context and reduce the result. - /// The parser instance. - /// - /// - /// The simplified semantic context after precedence predicates are - /// evaluated, which will be one of the following values. - ///
    - ///
  • - /// - /// : if the predicate simplifies to - /// - /// after - /// precedence predicates are evaluated.
  • - ///
  • - /// - /// : if the predicate simplifies to - /// - /// after - /// precedence predicates are evaluated.
  • - ///
  • - /// this - /// : if the semantic context is not changed as a result of - /// precedence predicate evaluation.
  • - ///
  • A non- - /// - /// - /// - /// : the new simplified - /// semantic context after precedence predicates are evaluated.
  • - ///
- ///
- public virtual SemanticContext EvalPrecedence(Recognizer parser, RuleContext parserCallStack) + + public virtual SemanticContext EvalPrecedence(Recognizer parser, RuleContext parserCallStack) where ATNInterpreter : ATNSimulator { return this; @@ -251,26 +171,8 @@ namespace Antlr4.Runtime.Atn } } - /// - /// This is the base class for semantic context "operators", which operate on - /// a collection of semantic context "operands". - /// - /// - /// This is the base class for semantic context "operators", which operate on - /// a collection of semantic context "operands". - /// - /// 4.3 public abstract class Operator : SemanticContext { - /// Gets the operands for the semantic context operator. - /// Gets the operands for the semantic context operator. - /// - /// a collection of - /// - /// operands for the - /// operator. - /// - /// 4.3 [NotNull] public abstract ICollection Operands { @@ -278,14 +180,6 @@ namespace Antlr4.Runtime.Atn } } - /// - /// A semantic context which is true whenever none of the contained contexts - /// is false. - /// - /// - /// A semantic context which is true whenever none of the contained contexts - /// is false. - /// public class AND : SemanticContext.Operator { [NotNull] @@ -347,12 +241,6 @@ namespace Antlr4.Runtime.Atn return MurmurHash.HashCode(opnds, typeof(SemanticContext.AND).GetHashCode()); } - /// - /// - ///

- /// The evaluation of predicates by this context is short-circuiting, but - /// unordered.

- ///
public override bool Eval(Recognizer parser, RuleContext parserCallStack) { foreach (SemanticContext opnd in opnds) @@ -399,7 +287,7 @@ namespace Antlr4.Runtime.Atn SemanticContext result = operands[0]; for (int i = 1; i < operands.Count; i++) { - result = SemanticContext.And(result, operands[i]); + result = SemanticContext.AndOp(result, operands[i]); } return result; } @@ -410,14 +298,6 @@ namespace Antlr4.Runtime.Atn } } - /// - /// A semantic context which is true whenever at least one of the contained - /// contexts is true. - /// - /// - /// A semantic context which is true whenever at least one of the contained - /// contexts is true. - /// public class OR : SemanticContext.Operator { [NotNull] @@ -479,12 +359,6 @@ namespace Antlr4.Runtime.Atn return MurmurHash.HashCode(opnds, typeof(SemanticContext.OR).GetHashCode()); } - /// - /// - ///

- /// The evaluation of predicates by this context is short-circuiting, but - /// unordered.

- ///
public override bool Eval(Recognizer parser, RuleContext parserCallStack) { foreach (SemanticContext opnd in opnds) @@ -531,7 +405,7 @@ namespace Antlr4.Runtime.Atn SemanticContext result = operands[0]; for (int i = 1; i < operands.Count; i++) { - result = SemanticContext.Or(result, operands[i]); + result = SemanticContext.OrOp(result, operands[i]); } return result; } @@ -542,7 +416,7 @@ namespace Antlr4.Runtime.Atn } } - public static SemanticContext And(SemanticContext a, SemanticContext b) + public static SemanticContext AndOp(SemanticContext a, SemanticContext b) { if (a == null || a == NONE) { @@ -560,8 +434,7 @@ namespace Antlr4.Runtime.Atn return result; } - /// - public static SemanticContext Or(SemanticContext a, SemanticContext b) + public static SemanticContext OrOp(SemanticContext a, SemanticContext b) { if (a == null) { diff --git a/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/DefaultErrorStrategy.cs b/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/DefaultErrorStrategy.cs index 1ce75f2bd..8b9a774d7 100644 --- a/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/DefaultErrorStrategy.cs +++ b/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/DefaultErrorStrategy.cs @@ -620,8 +620,7 @@ namespace Antlr4.Runtime ATNState currentState = recognizer.Interpreter.atn.states[recognizer.State]; ATNState next = currentState.Transition(0).target; ATN atn = recognizer.Interpreter.atn; - IntervalSet expectingAtLL2 = atn.NextTokens(next, PredictionContext.FromRuleContext(atn, recognizer.RuleContext)); - // System.out.println("LT(2) set="+expectingAtLL2.toString(recognizer.getTokenNames())); + IntervalSet expectingAtLL2 = atn.NextTokens(next, recognizer.RuleContext); if (expectingAtLL2.Contains(currentSymbolType)) { ReportMissingToken(recognizer); diff --git a/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Dfa/DFASerializer.cs b/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Dfa/DFASerializer.cs index 5633d531b..2d72fda3a 100644 --- a/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Dfa/DFASerializer.cs +++ b/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Dfa/DFASerializer.cs @@ -132,7 +132,7 @@ namespace Antlr4.Runtime.Dfa protected internal virtual string GetEdgeLabel(int i) { - return vocabulary.GetDisplayName(i); + return vocabulary.GetDisplayName(i - 1); } internal virtual string GetStateString(DFAState s) @@ -143,7 +143,7 @@ namespace Antlr4.Runtime.Dfa } int n = s.stateNumber; - string baseStateStr = (s.isAcceptState ? ":" : "") + "s" + n ; + string baseStateStr = (s.isAcceptState ? ":" : "") + "s" + n + (s.requiresFullContext ? "^" : ""); if ( s.isAcceptState ) { if ( s.predicates!=null ) { return baseStateStr + "=>" + Arrays.ToString(s.predicates); diff --git a/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Parser.cs b/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Parser.cs index 74f8b6ead..522d6251e 100644 --- a/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Parser.cs +++ b/runtime/CSharp/runtime/CSharp/Antlr4.Runtime/Parser.cs @@ -1163,9 +1163,9 @@ namespace Antlr4.Runtime public virtual void DumpDFA() { bool seenOne = false; - for (int d = 0; d < Interpreter.atn.decisionToDFA.Length; d++) + for (int d = 0; d < Interpreter.decisionToDFA.Length; d++) { - DFA dfa = Interpreter.atn.decisionToDFA[d]; + DFA dfa = Interpreter.decisionToDFA[d]; if (dfa.states.Count>0) { if (seenOne)