Fix build errors in newly generated code

This commit is contained in:
Sam Harwell 2014-06-30 22:58:34 -05:00
parent c860ff779f
commit ded0a6a04f
12 changed files with 90 additions and 31 deletions

View File

@ -72,6 +72,7 @@
<Compile Include="AntlrInputStream.cs" />
<Compile Include="Atn\AbstractPredicateTransition.cs" />
<Compile Include="Atn\ActionTransition.cs" />
<Compile Include="Atn\AmbiguityInfo.cs" />
<Compile Include="Atn\ArrayPredictionContext.cs" />
<Compile Include="Atn\ATN.cs" />
<Compile Include="Atn\ATNConfig.cs" />
@ -87,9 +88,13 @@
<Compile Include="Atn\BasicState.cs" />
<Compile Include="Atn\BlockEndState.cs" />
<Compile Include="Atn\BlockStartState.cs" />
<Compile Include="Atn\ContextSensitivityInfo.cs" />
<Compile Include="Atn\DecisionEventInfo.cs" />
<Compile Include="Atn\DecisionInfo.cs" />
<Compile Include="Atn\DecisionState.cs" />
<Compile Include="Atn\EmptyPredictionContext.cs" />
<Compile Include="Atn\EpsilonTransition.cs" />
<Compile Include="Atn\ErrorInfo.cs" />
<Compile Include="Atn\ILexerAction.cs" />
<Compile Include="Atn\LexerActionExecutor.cs" />
<Compile Include="Atn\LexerActionType.cs" />
@ -104,17 +109,21 @@
<Compile Include="Atn\LexerSkipAction.cs" />
<Compile Include="Atn\LexerTypeAction.cs" />
<Compile Include="Atn\LL1Analyzer.cs" />
<Compile Include="Atn\LookaheadEventInfo.cs" />
<Compile Include="Atn\LoopEndState.cs" />
<Compile Include="Atn\NotSetTransition.cs" />
<Compile Include="Atn\OrderedATNConfigSet.cs" />
<Compile Include="Atn\ParseInfo.cs" />
<Compile Include="Atn\ParserATNSimulator.cs" />
<Compile Include="Atn\PlusBlockStartState.cs" />
<Compile Include="Atn\PlusLoopbackState.cs" />
<Compile Include="Atn\PrecedencePredicateTransition.cs" />
<Compile Include="Atn\PredicateEvalInfo.cs" />
<Compile Include="Atn\PredicateTransition.cs" />
<Compile Include="Atn\PredictionContext.cs" />
<Compile Include="Atn\PredictionContextCache.cs" />
<Compile Include="Atn\PredictionMode.cs" />
<Compile Include="Atn\ProfilingATNSimulator.cs" />
<Compile Include="Atn\RangeTransition.cs" />
<Compile Include="Atn\RuleStartState.cs" />
<Compile Include="Atn\RuleStopState.cs" />

View File

@ -56,6 +56,7 @@
<Compile Include="AntlrInputStream.cs" />
<Compile Include="Atn\AbstractPredicateTransition.cs" />
<Compile Include="Atn\ActionTransition.cs" />
<Compile Include="Atn\AmbiguityInfo.cs" />
<Compile Include="Atn\ArrayPredictionContext.cs" />
<Compile Include="Atn\ATN.cs" />
<Compile Include="Atn\ATNConfig.cs" />
@ -71,9 +72,13 @@
<Compile Include="Atn\BasicState.cs" />
<Compile Include="Atn\BlockEndState.cs" />
<Compile Include="Atn\BlockStartState.cs" />
<Compile Include="Atn\ContextSensitivityInfo.cs" />
<Compile Include="Atn\DecisionEventInfo.cs" />
<Compile Include="Atn\DecisionInfo.cs" />
<Compile Include="Atn\DecisionState.cs" />
<Compile Include="Atn\EmptyPredictionContext.cs" />
<Compile Include="Atn\EpsilonTransition.cs" />
<Compile Include="Atn\ErrorInfo.cs" />
<Compile Include="Atn\ILexerAction.cs" />
<Compile Include="Atn\LexerActionExecutor.cs" />
<Compile Include="Atn\LexerActionType.cs" />
@ -88,17 +93,21 @@
<Compile Include="Atn\LexerSkipAction.cs" />
<Compile Include="Atn\LexerTypeAction.cs" />
<Compile Include="Atn\LL1Analyzer.cs" />
<Compile Include="Atn\LookaheadEventInfo.cs" />
<Compile Include="Atn\LoopEndState.cs" />
<Compile Include="Atn\NotSetTransition.cs" />
<Compile Include="Atn\OrderedATNConfigSet.cs" />
<Compile Include="Atn\ParseInfo.cs" />
<Compile Include="Atn\ParserATNSimulator.cs" />
<Compile Include="Atn\PlusBlockStartState.cs" />
<Compile Include="Atn\PlusLoopbackState.cs" />
<Compile Include="Atn\PrecedencePredicateTransition.cs" />
<Compile Include="Atn\PredicateEvalInfo.cs" />
<Compile Include="Atn\PredicateTransition.cs" />
<Compile Include="Atn\PredictionContext.cs" />
<Compile Include="Atn\PredictionContextCache.cs" />
<Compile Include="Atn\PredictionMode.cs" />
<Compile Include="Atn\ProfilingATNSimulator.cs" />
<Compile Include="Atn\RangeTransition.cs" />
<Compile Include="Atn\RuleStartState.cs" />
<Compile Include="Atn\RuleStopState.cs" />

View File

@ -55,6 +55,7 @@
<Compile Include="AntlrInputStream.cs" />
<Compile Include="Atn\AbstractPredicateTransition.cs" />
<Compile Include="Atn\ActionTransition.cs" />
<Compile Include="Atn\AmbiguityInfo.cs" />
<Compile Include="Atn\ArrayPredictionContext.cs" />
<Compile Include="Atn\ATN.cs" />
<Compile Include="Atn\ATNConfig.cs" />
@ -70,9 +71,13 @@
<Compile Include="Atn\BasicState.cs" />
<Compile Include="Atn\BlockEndState.cs" />
<Compile Include="Atn\BlockStartState.cs" />
<Compile Include="Atn\ContextSensitivityInfo.cs" />
<Compile Include="Atn\DecisionEventInfo.cs" />
<Compile Include="Atn\DecisionInfo.cs" />
<Compile Include="Atn\DecisionState.cs" />
<Compile Include="Atn\EmptyPredictionContext.cs" />
<Compile Include="Atn\EpsilonTransition.cs" />
<Compile Include="Atn\ErrorInfo.cs" />
<Compile Include="Atn\ILexerAction.cs" />
<Compile Include="Atn\LexerActionExecutor.cs" />
<Compile Include="Atn\LexerActionType.cs" />
@ -87,17 +92,21 @@
<Compile Include="Atn\LexerSkipAction.cs" />
<Compile Include="Atn\LexerTypeAction.cs" />
<Compile Include="Atn\LL1Analyzer.cs" />
<Compile Include="Atn\LookaheadEventInfo.cs" />
<Compile Include="Atn\LoopEndState.cs" />
<Compile Include="Atn\NotSetTransition.cs" />
<Compile Include="Atn\OrderedATNConfigSet.cs" />
<Compile Include="Atn\ParseInfo.cs" />
<Compile Include="Atn\ParserATNSimulator.cs" />
<Compile Include="Atn\PlusBlockStartState.cs" />
<Compile Include="Atn\PlusLoopbackState.cs" />
<Compile Include="Atn\PrecedencePredicateTransition.cs" />
<Compile Include="Atn\PredicateEvalInfo.cs" />
<Compile Include="Atn\PredicateTransition.cs" />
<Compile Include="Atn\PredictionContext.cs" />
<Compile Include="Atn\PredictionContextCache.cs" />
<Compile Include="Atn\PredictionMode.cs" />
<Compile Include="Atn\ProfilingATNSimulator.cs" />
<Compile Include="Atn\RangeTransition.cs" />
<Compile Include="Atn\RuleStartState.cs" />
<Compile Include="Atn\RuleStopState.cs" />

View File

@ -55,6 +55,7 @@
<Compile Include="AntlrInputStream.cs" />
<Compile Include="Atn\AbstractPredicateTransition.cs" />
<Compile Include="Atn\ActionTransition.cs" />
<Compile Include="Atn\AmbiguityInfo.cs" />
<Compile Include="Atn\ArrayPredictionContext.cs" />
<Compile Include="Atn\ATN.cs" />
<Compile Include="Atn\ATNConfig.cs" />
@ -70,9 +71,13 @@
<Compile Include="Atn\BasicState.cs" />
<Compile Include="Atn\BlockEndState.cs" />
<Compile Include="Atn\BlockStartState.cs" />
<Compile Include="Atn\ContextSensitivityInfo.cs" />
<Compile Include="Atn\DecisionEventInfo.cs" />
<Compile Include="Atn\DecisionInfo.cs" />
<Compile Include="Atn\DecisionState.cs" />
<Compile Include="Atn\EmptyPredictionContext.cs" />
<Compile Include="Atn\EpsilonTransition.cs" />
<Compile Include="Atn\ErrorInfo.cs" />
<Compile Include="Atn\ILexerAction.cs" />
<Compile Include="Atn\LexerActionExecutor.cs" />
<Compile Include="Atn\LexerActionType.cs" />
@ -87,17 +92,21 @@
<Compile Include="Atn\LexerSkipAction.cs" />
<Compile Include="Atn\LexerTypeAction.cs" />
<Compile Include="Atn\LL1Analyzer.cs" />
<Compile Include="Atn\LookaheadEventInfo.cs" />
<Compile Include="Atn\LoopEndState.cs" />
<Compile Include="Atn\NotSetTransition.cs" />
<Compile Include="Atn\OrderedATNConfigSet.cs" />
<Compile Include="Atn\ParseInfo.cs" />
<Compile Include="Atn\ParserATNSimulator.cs" />
<Compile Include="Atn\PlusBlockStartState.cs" />
<Compile Include="Atn\PlusLoopbackState.cs" />
<Compile Include="Atn\PrecedencePredicateTransition.cs" />
<Compile Include="Atn\PredicateEvalInfo.cs" />
<Compile Include="Atn\PredicateTransition.cs" />
<Compile Include="Atn\PredictionContext.cs" />
<Compile Include="Atn\PredictionContextCache.cs" />
<Compile Include="Atn\PredictionMode.cs" />
<Compile Include="Atn\ProfilingATNSimulator.cs" />
<Compile Include="Atn\RangeTransition.cs" />
<Compile Include="Atn\RuleStartState.cs" />
<Compile Include="Atn\RuleStopState.cs" />

View File

@ -58,6 +58,7 @@
<Compile Include="AntlrInputStream.cs" />
<Compile Include="Atn\AbstractPredicateTransition.cs" />
<Compile Include="Atn\ActionTransition.cs" />
<Compile Include="Atn\AmbiguityInfo.cs" />
<Compile Include="Atn\ArrayPredictionContext.cs" />
<Compile Include="Atn\ATN.cs" />
<Compile Include="Atn\ATNConfig.cs" />
@ -73,9 +74,13 @@
<Compile Include="Atn\BasicState.cs" />
<Compile Include="Atn\BlockEndState.cs" />
<Compile Include="Atn\BlockStartState.cs" />
<Compile Include="Atn\ContextSensitivityInfo.cs" />
<Compile Include="Atn\DecisionEventInfo.cs" />
<Compile Include="Atn\DecisionInfo.cs" />
<Compile Include="Atn\DecisionState.cs" />
<Compile Include="Atn\EmptyPredictionContext.cs" />
<Compile Include="Atn\EpsilonTransition.cs" />
<Compile Include="Atn\ErrorInfo.cs" />
<Compile Include="Atn\ILexerAction.cs" />
<Compile Include="Atn\LexerActionExecutor.cs" />
<Compile Include="Atn\LexerActionType.cs" />
@ -90,17 +95,21 @@
<Compile Include="Atn\LexerSkipAction.cs" />
<Compile Include="Atn\LexerTypeAction.cs" />
<Compile Include="Atn\LL1Analyzer.cs" />
<Compile Include="Atn\LookaheadEventInfo.cs" />
<Compile Include="Atn\LoopEndState.cs" />
<Compile Include="Atn\NotSetTransition.cs" />
<Compile Include="Atn\OrderedATNConfigSet.cs" />
<Compile Include="Atn\ParseInfo.cs" />
<Compile Include="Atn\ParserATNSimulator.cs" />
<Compile Include="Atn\PlusBlockStartState.cs" />
<Compile Include="Atn\PlusLoopbackState.cs" />
<Compile Include="Atn\PrecedencePredicateTransition.cs" />
<Compile Include="Atn\PredicateEvalInfo.cs" />
<Compile Include="Atn\PredicateTransition.cs" />
<Compile Include="Atn\PredictionContext.cs" />
<Compile Include="Atn\PredictionContextCache.cs" />
<Compile Include="Atn\PredictionMode.cs" />
<Compile Include="Atn\ProfilingATNSimulator.cs" />
<Compile Include="Atn\RangeTransition.cs" />
<Compile Include="Atn\RuleStartState.cs" />
<Compile Include="Atn\RuleStopState.cs" />

View File

@ -59,6 +59,7 @@
<Compile Include="AntlrInputStream.cs" />
<Compile Include="Atn\AbstractPredicateTransition.cs" />
<Compile Include="Atn\ActionTransition.cs" />
<Compile Include="Atn\AmbiguityInfo.cs" />
<Compile Include="Atn\ArrayPredictionContext.cs" />
<Compile Include="Atn\ATN.cs" />
<Compile Include="Atn\ATNConfig.cs" />
@ -74,9 +75,13 @@
<Compile Include="Atn\BasicState.cs" />
<Compile Include="Atn\BlockEndState.cs" />
<Compile Include="Atn\BlockStartState.cs" />
<Compile Include="Atn\ContextSensitivityInfo.cs" />
<Compile Include="Atn\DecisionEventInfo.cs" />
<Compile Include="Atn\DecisionInfo.cs" />
<Compile Include="Atn\DecisionState.cs" />
<Compile Include="Atn\EmptyPredictionContext.cs" />
<Compile Include="Atn\EpsilonTransition.cs" />
<Compile Include="Atn\ErrorInfo.cs" />
<Compile Include="Atn\ILexerAction.cs" />
<Compile Include="Atn\LexerActionExecutor.cs" />
<Compile Include="Atn\LexerActionType.cs" />
@ -91,17 +96,21 @@
<Compile Include="Atn\LexerSkipAction.cs" />
<Compile Include="Atn\LexerTypeAction.cs" />
<Compile Include="Atn\LL1Analyzer.cs" />
<Compile Include="Atn\LookaheadEventInfo.cs" />
<Compile Include="Atn\LoopEndState.cs" />
<Compile Include="Atn\NotSetTransition.cs" />
<Compile Include="Atn\OrderedATNConfigSet.cs" />
<Compile Include="Atn\ParseInfo.cs" />
<Compile Include="Atn\ParserATNSimulator.cs" />
<Compile Include="Atn\PlusBlockStartState.cs" />
<Compile Include="Atn\PlusLoopbackState.cs" />
<Compile Include="Atn\PrecedencePredicateTransition.cs" />
<Compile Include="Atn\PredicateEvalInfo.cs" />
<Compile Include="Atn\PredicateTransition.cs" />
<Compile Include="Atn\PredictionContext.cs" />
<Compile Include="Atn\PredictionContextCache.cs" />
<Compile Include="Atn\PredictionMode.cs" />
<Compile Include="Atn\ProfilingATNSimulator.cs" />
<Compile Include="Atn\RangeTransition.cs" />
<Compile Include="Atn\RuleStartState.cs" />
<Compile Include="Atn\RuleStopState.cs" />

View File

@ -59,6 +59,7 @@
<Compile Include="AntlrInputStream.cs" />
<Compile Include="Atn\AbstractPredicateTransition.cs" />
<Compile Include="Atn\ActionTransition.cs" />
<Compile Include="Atn\AmbiguityInfo.cs" />
<Compile Include="Atn\ArrayPredictionContext.cs" />
<Compile Include="Atn\ATN.cs" />
<Compile Include="Atn\ATNConfig.cs" />
@ -74,9 +75,13 @@
<Compile Include="Atn\BasicState.cs" />
<Compile Include="Atn\BlockEndState.cs" />
<Compile Include="Atn\BlockStartState.cs" />
<Compile Include="Atn\ContextSensitivityInfo.cs" />
<Compile Include="Atn\DecisionEventInfo.cs" />
<Compile Include="Atn\DecisionInfo.cs" />
<Compile Include="Atn\DecisionState.cs" />
<Compile Include="Atn\EmptyPredictionContext.cs" />
<Compile Include="Atn\EpsilonTransition.cs" />
<Compile Include="Atn\ErrorInfo.cs" />
<Compile Include="Atn\ILexerAction.cs" />
<Compile Include="Atn\LexerActionExecutor.cs" />
<Compile Include="Atn\LexerActionType.cs" />
@ -91,17 +96,21 @@
<Compile Include="Atn\LexerSkipAction.cs" />
<Compile Include="Atn\LexerTypeAction.cs" />
<Compile Include="Atn\LL1Analyzer.cs" />
<Compile Include="Atn\LookaheadEventInfo.cs" />
<Compile Include="Atn\LoopEndState.cs" />
<Compile Include="Atn\NotSetTransition.cs" />
<Compile Include="Atn\OrderedATNConfigSet.cs" />
<Compile Include="Atn\ParseInfo.cs" />
<Compile Include="Atn\ParserATNSimulator.cs" />
<Compile Include="Atn\PlusBlockStartState.cs" />
<Compile Include="Atn\PlusLoopbackState.cs" />
<Compile Include="Atn\PrecedencePredicateTransition.cs" />
<Compile Include="Atn\PredicateEvalInfo.cs" />
<Compile Include="Atn\PredicateTransition.cs" />
<Compile Include="Atn\PredictionContext.cs" />
<Compile Include="Atn\PredictionContextCache.cs" />
<Compile Include="Atn\PredictionMode.cs" />
<Compile Include="Atn\ProfilingATNSimulator.cs" />
<Compile Include="Atn\RangeTransition.cs" />
<Compile Include="Atn\RuleStartState.cs" />
<Compile Include="Atn\RuleStopState.cs" />

View File

@ -65,7 +65,7 @@ namespace Antlr4.Runtime.Atn
/// instances, indexed by decision
/// number.
/// </returns>
[NotNull]
[return: NotNull]
public virtual DecisionInfo[] GetDecisionInfo()
{
return atnSimulator.GetDecisionInfo();
@ -85,7 +85,7 @@ namespace Antlr4.Runtime.Atn
/// A list of decision numbers which required one or more
/// full-context predictions during parsing.
/// </returns>
[NotNull]
[return: NotNull]
public virtual IList<int> GetLLDecisions()
{
DecisionInfo[] decisions = atnSimulator.GetDecisionInfo();
@ -95,7 +95,7 @@ namespace Antlr4.Runtime.Atn
long fallBack = decisions[i].LL_Fallback;
if (fallBack > 0)
{
Ll.AddItem(i);
Ll.Add(i);
}
}
return Ll;

View File

@ -32,6 +32,7 @@ using Antlr4.Runtime;
using Antlr4.Runtime.Atn;
using Antlr4.Runtime.Dfa;
using Sharpen;
using Stopwatch = System.Diagnostics.Stopwatch;
namespace Antlr4.Runtime.Atn
{
@ -96,11 +97,10 @@ namespace Antlr4.Runtime.Atn
this.currentDecision = decision;
this.currentState = null;
this.conflictingAltResolvedBySLL = ATN.InvalidAltNumber;
long start = Sharpen.Runtime.NanoTime();
Stopwatch stopwatch = Stopwatch.StartNew();
// expensive but useful info
int alt = base.AdaptivePredict(input, decision, outerContext);
long stop = Sharpen.Runtime.NanoTime();
decisions[decision].timeInPrediction += (stop - start);
decisions[decision].timeInPrediction += stopwatch.ElapsedTicks * 100;
decisions[decision].invocations++;
int SLL_k = _sllStopIndex - _startIndex + 1;
decisions[decision].SLL_TotalLook += SLL_k;
@ -150,7 +150,7 @@ namespace Antlr4.Runtime.Atn
if (reachState == null)
{
// no reach on current lookahead symbol. ERROR.
decisions[currentDecision].errors.AddItem(new ErrorInfo(currentDecision, previous, _input, _startIndex, _input.Index));
decisions[currentDecision].errors.Add(new ErrorInfo(currentDecision, previous, _input, _startIndex, _input.Index));
}
currentState = reachState;
return reachState;
@ -185,7 +185,7 @@ namespace Antlr4.Runtime.Atn
if (existingTargetState == Error)
{
SimulatorState state = new SimulatorState(currentState.outerContext, previousD, currentState.useContext, currentState.remainingOuterContext);
decisions[currentDecision].errors.AddItem(new ErrorInfo(currentDecision, state, _input, _startIndex, _input.Index));
decisions[currentDecision].errors.Add(new ErrorInfo(currentDecision, state, _input, _startIndex, _input.Index));
}
}
return existingTargetState;
@ -212,7 +212,7 @@ namespace Antlr4.Runtime.Atn
{
bool fullContext = _llStopIndex >= 0;
int stopIndex = fullContext ? _llStopIndex : _sllStopIndex;
decisions[currentDecision].predicateEvals.AddItem(new PredicateEvalInfo(currentState, currentDecision, _input, _startIndex, stopIndex, pred, result, alt));
decisions[currentDecision].predicateEvals.Add(new PredicateEvalInfo(currentState, currentDecision, _input, _startIndex, stopIndex, pred, result, alt));
}
return result;
}
@ -221,7 +221,7 @@ namespace Antlr4.Runtime.Atn
{
if (prediction != conflictingAltResolvedBySLL)
{
decisions[currentDecision].contextSensitivities.AddItem(new ContextSensitivityInfo(currentDecision, acceptState, _input, startIndex, stopIndex));
decisions[currentDecision].contextSensitivities.Add(new ContextSensitivityInfo(currentDecision, acceptState, _input, startIndex, stopIndex));
}
base.ReportContextSensitivity(dfa, prediction, acceptState, startIndex, stopIndex);
}
@ -258,9 +258,9 @@ namespace Antlr4.Runtime.Atn
// are showing a conflict, hence an ambiguity, but if they resolve
// to different minimum alternatives we have also identified a
// context sensitivity.
decisions[currentDecision].contextSensitivities.AddItem(new ContextSensitivityInfo(currentDecision, currentState, _input, startIndex, stopIndex));
decisions[currentDecision].contextSensitivities.Add(new ContextSensitivityInfo(currentDecision, currentState, _input, startIndex, stopIndex));
}
decisions[currentDecision].ambiguities.AddItem(new AmbiguityInfo(currentDecision, currentState, _input, startIndex, stopIndex));
decisions[currentDecision].ambiguities.Add(new AmbiguityInfo(currentDecision, currentState, _input, startIndex, stopIndex));
base.ReportAmbiguity(dfa, D, startIndex, stopIndex, exact, ambigAlts, configs);
}

View File

@ -271,7 +271,7 @@ namespace Antlr4.Runtime.Atn
/// operator.
/// </returns>
/// <since>4.3</since>
[NotNull]
[return: NotNull]
public abstract ICollection<SemanticContext> GetOperands();
}

View File

@ -70,7 +70,7 @@ namespace Antlr4.Runtime.Misc
/// IllegalStateException
/// if the current set is read-only
/// </exception>
[NotNull]
[return: NotNull]
IIntSet AddAll(IIntSet set);
/// <summary>
@ -97,7 +97,7 @@ namespace Antlr4.Runtime.Misc
/// may be returned in
/// place of an empty result set.
/// </returns>
[Nullable]
[return: Nullable]
IIntSet And(IIntSet a);
/// <summary>
@ -137,7 +137,7 @@ namespace Antlr4.Runtime.Misc
/// <code>null</code>
/// may be returned in place of an empty result set.
/// </returns>
[Nullable]
[return: Nullable]
IIntSet Complement(IIntSet elements);
/// <summary>
@ -171,7 +171,7 @@ namespace Antlr4.Runtime.Misc
/// may be returned in place of an
/// empty result set.
/// </returns>
[Nullable]
[return: Nullable]
IIntSet Or(IIntSet a);
/// <summary>
@ -211,7 +211,7 @@ namespace Antlr4.Runtime.Misc
/// <code>null</code>
/// may be returned in place of an empty result set.
/// </returns>
[Nullable]
[return: Nullable]
IIntSet Subtract(IIntSet a);
/// <summary>Return the total number of elements represented by the current set.</summary>
@ -295,7 +295,7 @@ namespace Antlr4.Runtime.Misc
/// A list containing all element present in the current set, sorted
/// in ascending numerical order.
/// </returns>
[NotNull]
[return: NotNull]
IList<int> ToList();
/// <summary><inheritDoc></inheritDoc></summary>

View File

@ -57,15 +57,11 @@ namespace Antlr4.Runtime.Misc
{
public static readonly Antlr4.Runtime.Misc.IntervalSet CompleteCharSet = Antlr4.Runtime.Misc.IntervalSet.Of(Lexer.MinCharValue, Lexer.MaxCharValue);
static IntervalSet()
{
CompleteCharSet.SetReadonly(true);
}
public static readonly Antlr4.Runtime.Misc.IntervalSet EmptySet = new Antlr4.Runtime.Misc.IntervalSet();
static IntervalSet()
{
CompleteCharSet.SetReadonly(true);
EmptySet.SetReadonly(true);
}
@ -309,7 +305,7 @@ namespace Antlr4.Runtime.Misc
/// <code>null</code>
/// , it is treated as though it was an empty set.
/// </remarks>
[NotNull]
[return: NotNull]
public static Antlr4.Runtime.Misc.IntervalSet Subtract(Antlr4.Runtime.Misc.IntervalSet left, Antlr4.Runtime.Misc.IntervalSet right)
{
if (left == null || left.IsNil())
@ -339,8 +335,8 @@ namespace Antlr4.Runtime.Misc
resultI++;
continue;
}
Interval beforeCurrent = null;
Interval afterCurrent = null;
Interval? beforeCurrent = null;
Interval? afterCurrent = null;
if (rightInterval.a > resultInterval.a)
{
beforeCurrent = new Interval(resultInterval.a, rightInterval.a - 1);
@ -354,8 +350,8 @@ namespace Antlr4.Runtime.Misc
if (afterCurrent != null)
{
// split the current interval into two
result.intervals.Set(resultI, beforeCurrent);
result.intervals.Add(resultI + 1, afterCurrent);
result.intervals[resultI] = beforeCurrent.Value;
result.intervals.Insert(resultI + 1, afterCurrent.Value);
resultI++;
rightI++;
continue;
@ -363,7 +359,7 @@ namespace Antlr4.Runtime.Misc
else
{
// replace the current interval
result.intervals.Set(resultI, beforeCurrent);
result.intervals[resultI] = beforeCurrent.Value;
resultI++;
continue;
}
@ -373,7 +369,7 @@ namespace Antlr4.Runtime.Misc
if (afterCurrent != null)
{
// replace the current interval
result.intervals.Set(resultI, afterCurrent);
result.intervals[resultI] = afterCurrent.Value;
rightI++;
continue;
}