From a14b1977142da5047d65d26b11326586d520ce3c Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Tue, 25 Mar 2014 14:47:19 -0500 Subject: [PATCH] Fix issues in newly generated code --- runtime/CSharp/Antlr4.Runtime/Atn/ParserATNSimulator.cs | 8 ++++---- runtime/CSharp/Antlr4.Runtime/Recognizer`2.cs | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/runtime/CSharp/Antlr4.Runtime/Atn/ParserATNSimulator.cs b/runtime/CSharp/Antlr4.Runtime/Atn/ParserATNSimulator.cs index 71e68ad6f..c49d1bc2c 100644 --- a/runtime/CSharp/Antlr4.Runtime/Atn/ParserATNSimulator.cs +++ b/runtime/CSharp/Antlr4.Runtime/Atn/ParserATNSimulator.cs @@ -1379,7 +1379,7 @@ namespace Antlr4.Runtime.Atn [return: NotNull] protected internal virtual ATNConfigSet ApplyPrecedenceFilter(ATNConfigSet configs, ParserRuleContext globalContext, PredictionContextCache contextCache) { - IDictionary statesFromAlt1 = new Dictionary(); + Dictionary statesFromAlt1 = new Dictionary(); ATNConfigSet configSet = new ATNConfigSet(); foreach (ATNConfig config in configs) { @@ -1394,7 +1394,7 @@ namespace Antlr4.Runtime.Atn // the configuration was eliminated continue; } - statesFromAlt1.Put(config.State.stateNumber, config.Context); + statesFromAlt1[config.State.stateNumber] = config.Context; if (updatedContext != config.SemanticContext) { configSet.Add(config.Transform(config.State, updatedContext, false), contextCache); @@ -1411,8 +1411,8 @@ namespace Antlr4.Runtime.Atn // already handled continue; } - PredictionContext context = statesFromAlt1.Get(config_1.State.stateNumber); - if (context != null && context.Equals(config_1.Context)) + PredictionContext context; + if (statesFromAlt1.TryGetValue(config_1.State.stateNumber, out context) && context.Equals(config_1.Context)) { // eliminated continue; diff --git a/runtime/CSharp/Antlr4.Runtime/Recognizer`2.cs b/runtime/CSharp/Antlr4.Runtime/Recognizer`2.cs index 13df4c056..c8d896013 100644 --- a/runtime/CSharp/Antlr4.Runtime/Recognizer`2.cs +++ b/runtime/CSharp/Antlr4.Runtime/Recognizer`2.cs @@ -229,8 +229,7 @@ namespace Antlr4.Runtime /// your token objects because you don't have to go modify your lexer /// so that it creates a new Java type. /// - [Obsolete] - [System.ObsoleteAttribute(@"This method is not called by the ANTLR 4 Runtime. Specific implementations of IAntlrErrorStrategy may provide a similar feature when necessary. For example, seeDefaultErrorStrategy.GetTokenErrorDisplay(IToken) .")] + [ObsoleteAttribute(@"This method is not called by the ANTLR 4 Runtime. Specific implementations of IAntlrErrorStrategy may provide a similar feature when necessary. For example, see DefaultErrorStrategy.GetTokenErrorDisplay(IToken).")] public virtual string GetTokenErrorDisplay(IToken t) { if (t == null)