Merge pull request #53 from sharwell/cleanup

Cleanup
This commit is contained in:
Sam Harwell 2014-06-30 23:24:41 -05:00
commit d975107e81
30 changed files with 137 additions and 181 deletions

View File

@ -49,7 +49,7 @@ namespace Antlr4.Runtime.Atn
/// <summary>
/// This UUID indicates an extension of
/// <see cref="#ADDED_PRECEDENCE_TRANSITIONS">#ADDED_PRECEDENCE_TRANSITIONS</see>
/// <see cref="BaseSerializedUuid"/>
/// for the addition of lexer actions encoded as a sequence of
/// <see cref="ILexerAction">ILexerAction</see>
/// instances.
@ -100,19 +100,19 @@ namespace Antlr4.Runtime.Atn
/// <summary>
/// Determines if a particular serialized representation of an ATN supports
/// a particular feature, identified by the
/// <see cref="Sharpen.UUID">Sharpen.UUID</see>
/// <see cref="Guid"/>
/// used for serializing
/// the ATN at the time the feature was first introduced.
/// </summary>
/// <param name="feature">
/// The
/// <see cref="Sharpen.UUID">Sharpen.UUID</see>
/// <see cref="Guid"/>
/// marking the first time the feature was
/// supported in the serialized ATN.
/// </param>
/// <param name="actualUuid">
/// The
/// <see cref="Sharpen.UUID">Sharpen.UUID</see>
/// <see cref="Guid"/>
/// of the actual serialized ATN which is
/// currently being deserialized.
/// </param>
@ -878,7 +878,7 @@ namespace Antlr4.Runtime.Atn
}
nextTransition_continue: ;
}
nextTransition_break: ;
if (optimizedTransitions != null)
{
if (state.IsOptimized)
@ -894,7 +894,7 @@ nextTransition_break: ;
}
}
}
nextState_break: ;
return removedEdges;
}

View File

@ -29,7 +29,9 @@
*/
using System.Collections.Generic;
using Antlr4.Runtime.Atn;
using Antlr4.Runtime.Dfa;
using Sharpen;
using Stopwatch = System.Diagnostics.Stopwatch;
namespace Antlr4.Runtime.Atn
{
@ -49,14 +51,14 @@ namespace Antlr4.Runtime.Atn
{
/// <summary>
/// The decision number, which is an index into
/// <see cref="ATN.decisionToState">ATN.decisionToState</see>
/// <see cref="ATN.decisionToState"/>
/// .
/// </summary>
public readonly int decision;
/// <summary>
/// The total number of times
/// <see cref="ParserATNSimulator.AdaptivePredict(Antlr4.Runtime.ITokenStream, int, Antlr4.Runtime.ParserRuleContext)">ParserATNSimulator.AdaptivePredict(Antlr4.Runtime.ITokenStream, int, Antlr4.Runtime.ParserRuleContext)</see>
/// <see cref="ParserATNSimulator.AdaptivePredict(ITokenStream, int, ParserRuleContext)"/>
/// was
/// invoked for this decision.
/// </summary>
@ -64,21 +66,15 @@ namespace Antlr4.Runtime.Atn
/// <summary>
/// The total time spent in
/// <see cref="ParserATNSimulator.AdaptivePredict(Antlr4.Runtime.ITokenStream, int, Antlr4.Runtime.ParserRuleContext)">ParserATNSimulator.AdaptivePredict(Antlr4.Runtime.ITokenStream, int, Antlr4.Runtime.ParserRuleContext)</see>
/// <see cref="ParserATNSimulator.AdaptivePredict(ITokenStream, int, ParserRuleContext)"/>
/// for
/// this decision, in nanoseconds.
/// <p>
/// The value of this field contains the sum of differential results obtained
/// by
/// <see cref="Sharpen.Runtime.NanoTime()">Sharpen.Runtime.NanoTime()</see>
/// , and is not adjusted to compensate for JIT
/// and/or garbage collection overhead. For best accuracy, use a modern JVM
/// implementation that provides precise results from
/// <see cref="Sharpen.Runtime.NanoTime()">Sharpen.Runtime.NanoTime()</see>
/// , and perform profiling in a separate process
/// which is warmed up by parsing the input prior to profiling. If desired,
/// call
/// <see cref="ATNSimulator.ClearDFA()">ATNSimulator.ClearDFA()</see>
/// The value of this field is computed by <see cref="Stopwatch"/>,
/// and is not adjusted to compensate for JIT
/// and/or garbage collection overhead. For best accuracy, perform profiling
/// in a separate process which is warmed up by parsing the input prior to
/// profiling. If desired, call <see cref="ATNSimulator.ClearDFA()"/>
/// to reset the DFA cache to its initial
/// state before starting the profiling measurement pass.</p>
/// </summary>
@ -89,9 +85,9 @@ namespace Antlr4.Runtime.Atn
/// The sum of the lookahead required for SLL prediction for this decision.
/// Note that SLL prediction is used before LL prediction for performance
/// reasons even when
/// <see cref="PredictionMode.Ll">PredictionMode.Ll</see>
/// <see cref="PredictionMode.Ll"/>
/// or
/// <see cref="PredictionMode.LlExactAmbigDetection">PredictionMode.LlExactAmbigDetection</see>
/// <see cref="PredictionMode.LlExactAmbigDetection"/>
/// is used.
/// </remarks>
public long SLL_TotalLook;
@ -122,9 +118,9 @@ namespace Antlr4.Runtime.Atn
/// <summary>
/// Gets the
/// <see cref="LookaheadEventInfo">LookaheadEventInfo</see>
/// <see cref="LookaheadEventInfo"/>
/// associated with the event where the
/// <see cref="SLL_MaxLook">SLL_MaxLook</see>
/// <see cref="SLL_MaxLook"/>
/// value was set.
/// </summary>
public LookaheadEventInfo SLL_MaxLookEvent;
@ -145,9 +141,9 @@ namespace Antlr4.Runtime.Atn
/// Gets the minimum lookahead required for any single LL prediction to
/// complete for this decision. An LL prediction completes when the algorithm
/// reaches a unique prediction, a conflict state (for
/// <see cref="PredictionMode.Ll">PredictionMode.Ll</see>
/// <see cref="PredictionMode.Ll"/>
/// , an ambiguity state (for
/// <see cref="PredictionMode.LlExactAmbigDetection">PredictionMode.LlExactAmbigDetection</see>
/// <see cref="PredictionMode.LlExactAmbigDetection"/>
/// , or a syntax error.
/// </remarks>
public long LL_MinLook;
@ -160,60 +156,60 @@ namespace Antlr4.Runtime.Atn
/// Gets the maximum lookahead required for any single LL prediction to
/// complete for this decision. An LL prediction completes when the algorithm
/// reaches a unique prediction, a conflict state (for
/// <see cref="PredictionMode.Ll">PredictionMode.Ll</see>
/// <see cref="PredictionMode.Ll"/>
/// , an ambiguity state (for
/// <see cref="PredictionMode.LlExactAmbigDetection">PredictionMode.LlExactAmbigDetection</see>
/// <see cref="PredictionMode.LlExactAmbigDetection"/>
/// , or a syntax error.
/// </remarks>
public long LL_MaxLook;
/// <summary>
/// Gets the
/// <see cref="LookaheadEventInfo">LookaheadEventInfo</see>
/// <see cref="LookaheadEventInfo"/>
/// associated with the event where the
/// <see cref="LL_MaxLook">LL_MaxLook</see>
/// <see cref="LL_MaxLook"/>
/// value was set.
/// </summary>
public LookaheadEventInfo LL_MaxLookEvent;
/// <summary>
/// A collection of
/// <see cref="ContextSensitivityInfo">ContextSensitivityInfo</see>
/// <see cref="ContextSensitivityInfo"/>
/// instances describing the
/// context sensitivities encountered during LL prediction for this decision.
/// </summary>
/// <seealso cref="ContextSensitivityInfo">ContextSensitivityInfo</seealso>
/// <seealso cref="ContextSensitivityInfo"/>
public readonly IList<ContextSensitivityInfo> contextSensitivities = new List<ContextSensitivityInfo>();
/// <summary>
/// A collection of
/// <see cref="ErrorInfo">ErrorInfo</see>
/// <see cref="ErrorInfo"/>
/// instances describing the parse errors
/// identified during calls to
/// <see cref="ParserATNSimulator.AdaptivePredict(Antlr4.Runtime.ITokenStream, int, Antlr4.Runtime.ParserRuleContext)">ParserATNSimulator.AdaptivePredict(Antlr4.Runtime.ITokenStream, int, Antlr4.Runtime.ParserRuleContext)</see>
/// <see cref="ParserATNSimulator.AdaptivePredict(ITokenStream, int, ParserRuleContext)"/>
/// for
/// this decision.
/// </summary>
/// <seealso cref="ErrorInfo">ErrorInfo</seealso>
/// <seealso cref="ErrorInfo"/>
public readonly IList<ErrorInfo> errors = new List<ErrorInfo>();
/// <summary>
/// A collection of
/// <see cref="AmbiguityInfo">AmbiguityInfo</see>
/// <see cref="AmbiguityInfo"/>
/// instances describing the
/// ambiguities encountered during LL prediction for this decision.
/// </summary>
/// <seealso cref="AmbiguityInfo">AmbiguityInfo</seealso>
/// <seealso cref="AmbiguityInfo"/>
public readonly IList<AmbiguityInfo> ambiguities = new List<AmbiguityInfo>();
/// <summary>
/// A collection of
/// <see cref="PredicateEvalInfo">PredicateEvalInfo</see>
/// <see cref="PredicateEvalInfo"/>
/// instances describing the
/// results of evaluating individual predicates during prediction for this
/// decision.
/// </summary>
/// <seealso cref="PredicateEvalInfo">PredicateEvalInfo</seealso>
/// <seealso cref="PredicateEvalInfo"/>
public readonly IList<PredicateEvalInfo> predicateEvals = new List<PredicateEvalInfo>();
/// <summary>
@ -231,9 +227,9 @@ namespace Antlr4.Runtime.Atn
/// future parsing of this decision. Otherwise, the SLL parsing algorithm
/// will use ATN transitions exclusively.</p>
/// </remarks>
/// <seealso cref="SLL_ATNTransitions">SLL_ATNTransitions</seealso>
/// <seealso cref="ParserATNSimulator.ComputeTargetState(Antlr4.Runtime.Dfa.DFA, Antlr4.Runtime.Dfa.DFAState, Antlr4.Runtime.ParserRuleContext, int, bool, PredictionContextCache)">ParserATNSimulator.ComputeTargetState(Antlr4.Runtime.Dfa.DFA, Antlr4.Runtime.Dfa.DFAState, Antlr4.Runtime.ParserRuleContext, int, bool, PredictionContextCache)</seealso>
/// <seealso cref="LexerATNSimulator.ComputeTargetState(Antlr4.Runtime.ICharStream, Antlr4.Runtime.Dfa.DFAState, int)">LexerATNSimulator.ComputeTargetState(Antlr4.Runtime.ICharStream, Antlr4.Runtime.Dfa.DFAState, int)</seealso>
/// <seealso cref="SLL_ATNTransitions"/>
/// <seealso cref="ParserATNSimulator.ComputeTargetState"/>
/// <seealso cref="LexerATNSimulator.ComputeTargetState"/>
public long SLL_ATNTransitions;
/// <summary>
@ -246,8 +242,8 @@ namespace Antlr4.Runtime.Atn
/// <p>If the ATN simulator implementation does not use DFA caching for SLL
/// transitions, this value will be 0.</p>
/// </remarks>
/// <seealso cref="ParserATNSimulator.GetExistingTargetState(Antlr4.Runtime.Dfa.DFAState, int)">ParserATNSimulator.GetExistingTargetState(Antlr4.Runtime.Dfa.DFAState, int)</seealso>
/// <seealso cref="LexerATNSimulator.GetExistingTargetState(Antlr4.Runtime.Dfa.DFAState, int)">LexerATNSimulator.GetExistingTargetState(Antlr4.Runtime.Dfa.DFAState, int)</seealso>
/// <seealso cref="ParserATNSimulator.GetExistingTargetState"/>
/// <seealso cref="LexerATNSimulator.GetExistingTargetState"/>
public long SLL_DFATransitions;
/// <summary>
@ -286,9 +282,9 @@ namespace Antlr4.Runtime.Atn
/// future parsing of this decision. Otherwise, the LL parsing algorithm will
/// use ATN transitions exclusively.</p>
/// </remarks>
/// <seealso cref="LL_DFATransitions">LL_DFATransitions</seealso>
/// <seealso cref="ParserATNSimulator.ComputeTargetState(Antlr4.Runtime.Dfa.DFA, Antlr4.Runtime.Dfa.DFAState, Antlr4.Runtime.ParserRuleContext, int, bool, PredictionContextCache)">ParserATNSimulator.ComputeTargetState(Antlr4.Runtime.Dfa.DFA, Antlr4.Runtime.Dfa.DFAState, Antlr4.Runtime.ParserRuleContext, int, bool, PredictionContextCache)</seealso>
/// <seealso cref="LexerATNSimulator.ComputeTargetState(Antlr4.Runtime.ICharStream, Antlr4.Runtime.Dfa.DFAState, int)">LexerATNSimulator.ComputeTargetState(Antlr4.Runtime.ICharStream, Antlr4.Runtime.Dfa.DFAState, int)</seealso>
/// <seealso cref="LL_DFATransitions"/>
/// <seealso cref="ParserATNSimulator.ComputeTargetState"/>
/// <seealso cref="LexerATNSimulator.ComputeTargetState"/>
public long LL_ATNTransitions;
/// <summary>
@ -301,13 +297,13 @@ namespace Antlr4.Runtime.Atn
/// <p>If the ATN simulator implementation does not use DFA caching for LL
/// transitions, this value will be 0.</p>
/// </remarks>
/// <seealso cref="ParserATNSimulator.GetExistingTargetState(Antlr4.Runtime.Dfa.DFAState, int)">ParserATNSimulator.GetExistingTargetState(Antlr4.Runtime.Dfa.DFAState, int)</seealso>
/// <seealso cref="LexerATNSimulator.GetExistingTargetState(Antlr4.Runtime.Dfa.DFAState, int)">LexerATNSimulator.GetExistingTargetState(Antlr4.Runtime.Dfa.DFAState, int)</seealso>
/// <seealso cref="ParserATNSimulator.GetExistingTargetState"/>
/// <seealso cref="LexerATNSimulator.GetExistingTargetState"/>
public long LL_DFATransitions;
/// <summary>
/// Constructs a new instance of the
/// <see cref="DecisionInfo">DecisionInfo</see>
/// <see cref="DecisionInfo"/>
/// class to contain
/// statistics for a particular decision.
/// </summary>

View File

@ -43,8 +43,8 @@ namespace Antlr4.Runtime.Atn
/// algorithm is unable to identify an alternative which would lead to a
/// successful parse.
/// </remarks>
/// <seealso cref="Antlr4.Runtime.Parser.NotifyErrorListeners(Antlr4.Runtime.IToken, string, Antlr4.Runtime.RecognitionException)">Antlr4.Runtime.Parser.NotifyErrorListeners(Antlr4.Runtime.IToken, string, Antlr4.Runtime.RecognitionException)</seealso>
/// <seealso cref="Antlr4.Runtime.IANTLRErrorListener{Symbol}.SyntaxError{T}(Antlr4.Runtime.Recognizer{Symbol, ATNInterpreter}, object, int, int, string, Antlr4.Runtime.RecognitionException)">Antlr4.Runtime.IANTLRErrorListener&lt;Symbol&gt;.SyntaxError&lt;T&gt;(Antlr4.Runtime.Recognizer&lt;Symbol, ATNInterpreter&gt;, object, int, int, string, Antlr4.Runtime.RecognitionException)</seealso>
/// <seealso cref="Parser.NotifyErrorListeners(IToken, string, RecognitionException)"/>
/// <seealso cref="IAntlrErrorListener{TSymbol}.SyntaxError"/>
/// <since>4.3</since>
public class ErrorInfo : DecisionEventInfo
{

View File

@ -567,7 +567,6 @@ namespace Antlr4.Runtime.Atn
c = config.Transform(t.target, true);
break;
}
goto case TransitionType.Epsilon;
}
case TransitionType.Epsilon:

View File

@ -59,7 +59,7 @@ namespace Antlr4.Runtime.Atn
/// <see cref="hashCode">hashCode</see>
/// since the hash code is an element
/// of the performance-critical
/// <see cref="LexerATNConfig.hashCode">LexerATNConfig#hashCode</see>
/// <see cref="ATNConfig.GetHashCode()"/>
/// operation.
/// </summary>
private readonly int hashCode;

View File

@ -38,7 +38,7 @@ namespace Antlr4.Runtime.Atn
/// Implements the
/// <code>channel</code>
/// lexer action by calling
/// <see cref="Antlr4.Runtime.Lexer.Channel(int)">Antlr4.Runtime.Lexer.Channel(int)</see>
/// <see cref="Lexer.Channel"/>
/// with the assigned channel.
/// </summary>
/// <author>Sam Harwell</author>
@ -54,7 +54,7 @@ namespace Antlr4.Runtime.Atn
/// </summary>
/// <param name="channel">
/// The channel value to pass to
/// <see cref="Antlr4.Runtime.Lexer.Channel(int)">Antlr4.Runtime.Lexer.Channel(int)</see>
/// <see cref="Lexer.Channel"/>
/// .
/// </param>
public LexerChannelAction(int channel)
@ -102,7 +102,7 @@ namespace Antlr4.Runtime.Atn
/// <summary>
/// <inheritDoc></inheritDoc>
/// <p>This action is implemented by calling
/// <see cref="Antlr4.Runtime.Lexer.Channel(int)">Antlr4.Runtime.Lexer.Channel(int)</see>
/// <see cref="Lexer.Channel"/>
/// with the
/// value provided by
/// <see cref="GetChannel()">GetChannel()</see>

View File

@ -95,7 +95,7 @@ namespace Antlr4.Runtime.Atn
/// <summary>
/// <inheritDoc></inheritDoc>
/// <p>This action is implemented by calling
/// <see cref="Antlr4.Runtime.Lexer.Type(int)">Antlr4.Runtime.Lexer.Type(int)</see>
/// <see cref="Lexer.Type"/>
/// with the
/// value provided by
/// <see cref="GetType()">GetType()</see>

View File

@ -180,7 +180,7 @@ namespace Antlr4.Runtime.Atn
/// it adds a new DFA object to that array.
/// <see cref="AddDFAEdge(Antlr4.Runtime.Dfa.DFAState, int, Antlr4.Runtime.Dfa.DFAState)">AddDFAEdge(Antlr4.Runtime.Dfa.DFAState, int, Antlr4.Runtime.Dfa.DFAState)</see>
/// locks on the DFA for the current decision when setting the
/// <see cref="DFAState#edges">DFAState#edges</see>
/// <see cref="DFAState.edges"/>
/// field.
/// <see cref="AddDFAState(Antlr4.Runtime.Dfa.DFA, ATNConfigSet, PredictionContextCache)">AddDFAState(Antlr4.Runtime.Dfa.DFA, ATNConfigSet, PredictionContextCache)</see>
/// locks on
@ -204,10 +204,10 @@ namespace Antlr4.Runtime.Atn
/// . Once into the DFA, the DFA simulation does not reference the
/// <see cref="Antlr4.Runtime.Dfa.DFA.states">Antlr4.Runtime.Dfa.DFA.states</see>
/// map. It follows the
/// <see cref="DFAState#edges">DFAState#edges</see>
/// <see cref="DFAState.edges"/>
/// field to new
/// targets. The DFA simulator will either find
/// <see cref="DFAState#edges">DFAState#edges</see>
/// <see cref="DFAState.edges"/>
/// to be
/// <code>null</code>
/// , to be non-
@ -240,13 +240,13 @@ namespace Antlr4.Runtime.Atn
/// parser.
/// <see cref="Antlr4.Runtime.Recognizer{Symbol, ATNInterpreter}.Interpreter()">getInterpreter()</see>
/// .
/// <see cref="PredictionMode(PredictionMode)">setPredictionMode</see>
/// <see cref="PredictionMode"/>
/// <code>(</code>
/// <see cref="PredictionMode.Sll">PredictionMode.Sll</see>
/// <see cref="Atn.PredictionMode.Sll"/>
/// <code>)</code>
/// ;
/// parser.
/// <see cref="Antlr4.Runtime.Parser.ErrorHandler(IAntlrErrorStrategy)">setErrorHandler</see>
/// <see cref="Parser.ErrorHandler"/>
/// (new
/// <see cref="Antlr4.Runtime.BailErrorStrategy">Antlr4.Runtime.BailErrorStrategy</see>
/// ());
@ -1444,7 +1444,7 @@ namespace Antlr4.Runtime.Atn
/// set.
/// <ol>
/// <li>Evaluate the precedence predicates for each configuration using
/// <see cref="SemanticContext.EvalPrecedence(Antlr4.Runtime.Recognizer{Symbol, ATNInterpreter}, Antlr4.Runtime.RuleContext)">SemanticContext.EvalPrecedence(Antlr4.Runtime.Recognizer&lt;Symbol, ATNInterpreter&gt;, Antlr4.Runtime.RuleContext)</see>
/// <see cref="SemanticContext.EvalPrecedence{Symbol, ATNInterpreter}(Antlr4.Runtime.Recognizer{Symbol, ATNInterpreter}, Antlr4.Runtime.RuleContext)"/>
/// .</li>
/// <li>Remove all configurations which predict an alternative greater than
/// 1, for which another configuration that predicts alternative 1 is in the
@ -1709,13 +1709,13 @@ namespace Antlr4.Runtime.Atn
/// evaluate the following but it may change in the future:</p>
/// <ul>
/// <li>Precedence predicates (represented by
/// <see cref="PrecedencePredicate">PrecedencePredicate</see>
/// <see cref="SemanticContext.PrecedencePredicate"/>
/// ) are not currently evaluated
/// through this method.</li>
/// <li>Operator predicates (represented by
/// <see cref="AND">AND</see>
/// <see cref="SemanticContext.AND"/>
/// and
/// <see cref="OR">OR</see>
/// <see cref="SemanticContext.OR"/>
/// ) are evaluated as a single semantic
/// context, rather than evaluating the operands individually.
/// Implementations which require evaluation results from individual

View File

@ -93,8 +93,8 @@ namespace Antlr4.Runtime.Atn
/// <see cref="predictedAlt">predictedAlt</see>
/// for more information.
/// </param>
/// <seealso cref="ParserATNSimulator.EvalSemanticContext(SemanticContext, Antlr4.Runtime.ParserRuleContext, int)">ParserATNSimulator.EvalSemanticContext(SemanticContext, Antlr4.Runtime.ParserRuleContext, int)</seealso>
/// <seealso cref="SemanticContext.Eval(Antlr4.Runtime.Recognizer{Symbol, ATNInterpreter}, Antlr4.Runtime.RuleContext)">SemanticContext.Eval(Antlr4.Runtime.Recognizer&lt;Symbol, ATNInterpreter&gt;, Antlr4.Runtime.RuleContext)</seealso>
/// <seealso cref="ParserATNSimulator.EvalSemanticContext(SemanticContext, ParserRuleContext, int)"/>
/// <seealso cref="SemanticContext.Eval"/>
public PredicateEvalInfo(SimulatorState state, int decision, ITokenStream input, int startIndex, int stopIndex, SemanticContext semctx, bool evalResult, int predictedAlt)
: base(decision, state, input, startIndex, stopIndex, state.useContext)
{

View File

@ -137,7 +137,7 @@ namespace Antlr4.Runtime.Atn
/// The hash code is only a function of the
/// <see cref="ATNState.stateNumber">ATNState.stateNumber</see>
/// and
/// <see cref="ATNConfig#context">ATNConfig#context</see>
/// <see cref="ATNConfig.Context"/>
/// .
/// </summary>
public override int GetHashCode(ATNConfig o)
@ -381,19 +381,19 @@ namespace Antlr4.Runtime.Atn
/// and singleton subsets with
/// non-conflicting configurations. Two configurations conflict if they have
/// identical
/// <see cref="ATNConfig.state">ATNConfig#state</see>
/// <see cref="ATNConfig.State"/>
/// and
/// <see cref="ATNConfig.context">ATNConfig#context</see>
/// <see cref="ATNConfig.Context"/>
/// values
/// but different
/// <see cref="ATNConfig.Alt()">ATNConfig.Alt()</see>
/// <see cref="ATNConfig.Alt"/>
/// value, e.g.
/// <code>(s, i, ctx, _)</code>
/// and
/// <code>(s, j, ctx, _)</code>
/// for
/// <code>i!=j</code>
/// .
/// .</p>
/// <p/>
/// Reduce these configuration subsets to the set of possible alternatives.
/// You can compute the alternative subsets in one pass as follows:
@ -861,9 +861,9 @@ namespace Antlr4.Runtime.Atn
/// :
/// <pre>
/// map[c.
/// <see cref="ATNConfig.state">state</see>
/// <see cref="ATNConfig.State"/>
/// ] U= c.
/// <see cref="ATNConfig.Alt()">getAlt()</see>
/// <see cref="ATNConfig.Alt"/>
/// </pre>
/// </remarks>
[return: NotNull]

View File

@ -65,7 +65,7 @@ namespace Antlr4.Runtime
/// <code>myparser.setErrorHandler(new BailErrorStrategy());</code>
/// </p>
/// </summary>
/// <seealso cref="Parser.ErrorHandler(IAntlrErrorStrategy)">Parser.ErrorHandler(IAntlrErrorStrategy)</seealso>
/// <seealso cref="Parser.ErrorHandler"/>
public class BailErrorStrategy : DefaultErrorStrategy
{
/// <summary>

View File

@ -49,9 +49,9 @@ namespace Antlr4.Runtime
/// . If your
/// parser requires the token stream filter tokens to only those on a particular
/// channel, such as
/// <see cref="IToken.DefaultChannel">IToken.DefaultChannel</see>
/// <see cref="TokenConstants.DefaultChannel"/>
/// or
/// <see cref="IToken.HiddenChannel">IToken.HiddenChannel</see>
/// <see cref="TokenConstants.HiddenChannel"/>
/// , use a filtering token stream such a
/// <see cref="CommonTokenStream">CommonTokenStream</see>
/// .</p>
@ -104,7 +104,7 @@ namespace Antlr4.Runtime
/// <summary>
/// Indicates whether the
/// <see cref="IToken.Eof">IToken.Eof</see>
/// <see cref="TokenConstants.Eof"/>
/// token has been fetched from
/// <see cref="tokenSource">tokenSource</see>
/// and added to
@ -129,7 +129,7 @@ namespace Antlr4.Runtime
/// : The check to prevent adding multiple EOF symbols into
/// <see cref="tokens">tokens</see>
/// is trivial with this field.</li>
/// <ul>
/// </ul>
/// </summary>
protected internal bool fetchedEOF;

View File

@ -43,7 +43,7 @@ namespace Antlr4.Runtime
/// <summary>
/// An empty
/// <see cref="Antlr4.Runtime.Misc.Tuple2{T1, T2}">Antlr4.Runtime.Misc.Tuple2&lt;T1, T2&gt;</see>
/// <see cref="Tuple{T1, T2}"/>
/// which is used as the default value of
/// <see cref="source">source</see>
/// for tokens that do not have a source.
@ -51,38 +51,22 @@ namespace Antlr4.Runtime
protected internal static readonly Tuple<ITokenSource, ICharStream> EmptySource = Tuple.Create<ITokenSource, ICharStream>(null, null);
/// <summary>
/// This is the backing field for
/// <see cref="Type()">Type()</see>
/// and
/// <see cref="Type(int)">Type(int)</see>
/// .
/// This is the backing field for the <see cref="Type"/> property.
/// </summary>
protected internal int type;
/// <summary>
/// This is the backing field for
/// <see cref="Line()">Line()</see>
/// and
/// <see cref="Line(int)">Line(int)</see>
/// .
/// This is the backing field for the <see cref="Line"/> property.
/// </summary>
protected internal int line;
/// <summary>
/// This is the backing field for
/// <see cref="Column()">Column()</see>
/// and
/// <see cref="Column(int)">Column(int)</see>
/// .
/// This is the backing field for the <see cref="Column"/> property.
/// </summary>
protected internal int charPositionInLine = -1;
/// <summary>
/// This is the backing field for
/// <see cref="Channel()">Channel()</see>
/// and
/// <see cref="Channel(int)">Channel(int)</see>
/// .
/// This is the backing field for the <see cref="Channel"/> property.
/// </summary>
protected internal int channel = TokenConstants.DefaultChannel;
@ -99,47 +83,30 @@ namespace Antlr4.Runtime
/// <see cref="CommonTokenFactory">CommonTokenFactory</see>
/// from
/// the same source and input stream share a reference to the same
/// <see cref="Antlr4.Runtime.Misc.Tuple2{T1, T2}">Antlr4.Runtime.Misc.Tuple2&lt;T1, T2&gt;</see>
/// <see cref="Tuple{T1, T2}"/>
/// containing these values.</p>
/// </summary>
[NotNull]
protected internal Tuple<ITokenSource, ICharStream> source;
/// <summary>
/// This is the backing field for
/// <see cref="Text()">Text()</see>
/// when the token text is
/// explicitly set in the constructor or via
/// <see cref="Text(string)">Text(string)</see>
/// .
/// This is the backing field for the <see cref="Text"/> property.
/// </summary>
/// <seealso cref="Text()">Text()</seealso>
/// <seealso cref="Text"/>
protected internal string text;
/// <summary>
/// This is the backing field for
/// <see cref="TokenIndex()">TokenIndex()</see>
/// and
/// <see cref="TokenIndex(int)">TokenIndex(int)</see>
/// .
/// This is the backing field for the <see cref="TokenIndex"/> property.
/// </summary>
protected internal int index = -1;
/// <summary>
/// This is the backing field for
/// <see cref="StartIndex()">StartIndex()</see>
/// and
/// <see cref="SetStartIndex(int)">SetStartIndex(int)</see>
/// .
/// This is the backing field for the <see cref="StartIndex"/> property.
/// </summary>
protected internal int start;
/// <summary>
/// This is the backing field for
/// <see cref="StopIndex()">StopIndex()</see>
/// and
/// <see cref="SetStopIndex(int)">SetStopIndex(int)</see>
/// .
/// This is the backing field for the <see cref="StopIndex"/> property.
/// </summary>
protected internal int stop;
@ -202,7 +169,7 @@ namespace Antlr4.Runtime
/// <see cref="text">text</see>
/// field and
/// the
/// <see cref="Antlr4.Runtime.Misc.Tuple2{T1, T2}">Antlr4.Runtime.Misc.Tuple2&lt;T1, T2&gt;</see>
/// <see cref="Tuple{T1, T2}"/>
/// stored in
/// <see cref="source">source</see>
/// . Otherwise,

View File

@ -55,7 +55,7 @@ namespace Antlr4.Runtime
/// <summary>
/// Indicates whether
/// <see cref="CommonToken.Text(string)">CommonToken.Text(string)</see>
/// <see cref="CommonToken.Text"/>
/// should be called after
/// constructing tokens to explicitly set the text. This is useful for cases
/// where the input stream might not be able to provide arbitrary substrings

View File

@ -54,12 +54,12 @@ namespace Antlr4.Runtime
/// <p>
/// By default, tokens are placed on the default channel
/// (
/// <see cref="IToken.DefaultChannel">IToken.DefaultChannel</see>
/// <see cref="TokenConstants.DefaultChannel"/>
/// ), but may be reassigned by using the
/// <code>-&gt;channel(HIDDEN)</code>
/// lexer command, or by using an embedded action to
/// call
/// <see cref="Lexer.Channel(int)">Lexer.Channel(int)</see>
/// <see cref="Lexer.Channel"/>
/// .
/// </p>
/// <p>
@ -78,7 +78,7 @@ namespace Antlr4.Runtime
/// Specifies the channel to use for filtering tokens.
/// <p>
/// The default value is
/// <see cref="IToken.DefaultChannel">IToken.DefaultChannel</see>
/// <see cref="TokenConstants.DefaultChannel"/>
/// , which matches the
/// default channel assigned to tokens created by the lexer.</p>
/// </remarks>
@ -89,7 +89,7 @@ namespace Antlr4.Runtime
/// <see cref="CommonTokenStream">CommonTokenStream</see>
/// using the specified token
/// source and the default token channel (
/// <see cref="IToken.DefaultChannel">IToken.DefaultChannel</see>
/// <see cref="TokenConstants.DefaultChannel"/>
/// ).
/// </summary>
/// <param name="tokenSource">The token source.</param>
@ -109,7 +109,7 @@ namespace Antlr4.Runtime
/// or have the
/// <see cref="IToken.Type()">IToken.Type()</see>
/// equal to
/// <see cref="IToken.Eof">IToken.Eof</see>
/// <see cref="TokenConstants.Eof"/>
/// will be returned by the
/// token stream lookahead methods.
/// </summary>

View File

@ -40,7 +40,7 @@ namespace Antlr4.Runtime
{
/// <summary>
/// Provides a default instance of
/// <see cref="ConsoleErrorListener">ConsoleErrorListener</see>
/// <see cref="ConsoleErrorListener{Symbol}"/>
/// .
/// </summary>
public static readonly ConsoleErrorListener<Symbol> Instance = new ConsoleErrorListener<Symbol>();

View File

@ -527,7 +527,7 @@ namespace Antlr4.Runtime
/// , it will have
/// call chain:</p>
/// <pre>
/// stat &rarr; expr &rarr; atom
/// stat &#x2192; expr &#x2192; atom
/// </pre>
/// and it will be trying to match the
/// <code>')'</code>

View File

@ -97,7 +97,7 @@ namespace Antlr4.Runtime.Dfa
/// which is not stored in
/// <see cref="states">states</see>
/// . The
/// <see cref="DFAState#edges">DFAState#edges</see>
/// <see cref="DFAState.edges"/>
/// array for this start state contains outgoing edges
/// supplying individual start states corresponding to specific precedence
/// values.
@ -199,7 +199,7 @@ namespace Antlr4.Runtime.Dfa
/// ; otherwise, it is initialized to a new
/// <see cref="DFAState">DFAState</see>
/// with an empty outgoing
/// <see cref="DFAState#edges">DFAState#edges</see>
/// <see cref="DFAState.edges"/>
/// array to
/// store the start states for individual precedence values.</li>
/// <li>The

View File

@ -48,7 +48,7 @@ namespace Antlr4.Runtime.Dfa
/// input a1a2..an, the DFA is in a state that represents the
/// subset T of the states of the ATN that are reachable from the
/// ATN's start state along some path labeled a1a2..an."
/// In conventional NFA&rarr;DFA conversion, therefore, the subset T
/// In conventional NFA&#x2192;DFA conversion, therefore, the subset T
/// would be a bitset representing the set of states the
/// ATN could be in. We need to track the alt predicted by each
/// state as well, however. More importantly, we need to maintain

View File

@ -124,7 +124,7 @@ namespace Antlr4.Runtime
/// Gets the name of the underlying input source. This method returns a
/// non-null, non-empty string. If such a name is not known, this method
/// returns
/// <see cref="IIntStream.UnknownSourceName">IIntStream.UnknownSourceName</see>
/// <see cref="IntStreamConstants.UnknownSourceName"/>
/// .
/// </remarks>
string SourceName

View File

@ -42,7 +42,7 @@ namespace Antlr4.Runtime
/// <see cref="IToken">IToken</see>
/// objects.
/// <p>If the final token in the list is an
/// <see cref="IToken.Eof">IToken.Eof</see>
/// <see cref="TokenConstants.Eof"/>
/// token, it will be used
/// as the EOF token for every call to
/// <see cref="NextToken()">NextToken()</see>
@ -89,11 +89,7 @@ namespace Antlr4.Runtime
protected internal IToken eofToken;
/// <summary>
/// This is the backing field for
/// <see cref="TokenFactory()">TokenFactory()</see>
/// and
/// <see cref="setTokenFactory">setTokenFactory</see>
/// .
/// This is the backing field for the <see cref="TokenFactory"/> property.
/// </summary>
private ITokenFactory _factory = CommonTokenFactory.Default;

View File

@ -244,7 +244,7 @@ namespace Antlr4.Runtime.Misc
/// <see cref="Size()">Size()</see>
/// is 1;
/// otherwise, returns
/// <see cref="Antlr4.Runtime.IToken.InvalidType">Antlr4.Runtime.IToken.InvalidType</see>
/// <see cref="TokenConstants.InvalidType"/>
/// .
/// </summary>
/// <returns>
@ -252,7 +252,7 @@ namespace Antlr4.Runtime.Misc
/// <see cref="Size()">Size()</see>
/// is 1;
/// otherwise, returns
/// <see cref="Antlr4.Runtime.IToken.InvalidType">Antlr4.Runtime.IToken.InvalidType</see>
/// <see cref="TokenConstants.InvalidType"/>
/// .
/// </returns>
int GetSingleElement();

View File

@ -554,7 +554,7 @@ namespace Antlr4.Runtime.Misc
/// <returns>
/// the maximum value contained in the set. If the set is empty, this
/// method returns
/// <see cref="Antlr4.Runtime.IToken.InvalidType">Antlr4.Runtime.IToken.InvalidType</see>
/// <see cref="TokenConstants.InvalidType"/>
/// .
/// </returns>
public virtual int GetMaxElement()
@ -572,7 +572,7 @@ namespace Antlr4.Runtime.Misc
/// <returns>
/// the minimum value contained in the set. If the set is empty, this
/// method returns
/// <see cref="Antlr4.Runtime.IToken.InvalidType">Antlr4.Runtime.IToken.InvalidType</see>
/// <see cref="TokenConstants.InvalidType"/>
/// .
/// </returns>
public virtual int GetMinElement()

View File

@ -143,10 +143,10 @@ namespace Antlr4.Runtime.Misc
}
}
/// <summary>Convert array of strings to string&rarr;index map.</summary>
/// <summary>Convert array of strings to string&#x2192;index map.</summary>
/// <remarks>
/// Convert array of strings to string&rarr;index map. Useful for
/// converting rulenames to name&rarr;ruleindex map.
/// Convert array of strings to string&#x2192;index map. Useful for
/// converting rulenames to name&#x2192;ruleindex map.
/// </remarks>
public static IDictionary<string, int> ToMap(string[] keys)
{

View File

@ -239,11 +239,11 @@ namespace Antlr4.Runtime
/// <remarks>
/// You may have multiple, named streams of rewrite operations.
/// I'm calling these things "programs."
/// Maps String (name) &rarr; rewrite (List)
/// Maps String (name) &#x2192; rewrite (List)
/// </remarks>
protected internal readonly IDictionary<string, IList<TokenStreamRewriter.RewriteOperation>> programs;
/// <summary>Map String (program name) &rarr; Integer index</summary>
/// <summary>Map String (program name) &#x2192; Integer index</summary>
protected internal readonly IDictionary<string, int> lastRewriteTokenIndexes;
public TokenStreamRewriter(ITokenStream tokens)
@ -578,7 +578,7 @@ namespace Antlr4.Runtime
/// insert with replace and delete this replace.
/// 3. throw exception if index in same range as previous replace
/// Don't actually delete; make op null in list. Easier to walk list.
/// Later we can throw as we add to index &rarr; op map.
/// Later we can throw as we add to index &#x2192; op map.
/// Note that I.2 R.2-2 will wipe out I.2 even though, technically, the
/// inserted stuff would be before the replace range. But, if you
/// add tokens in front of a method body '{' and then delete the method

View File

@ -134,7 +134,7 @@ namespace Antlr4.Runtime.Tree.Pattern
/// <code>label</code>
/// .
/// <p>For example, for pattern
/// <code><id:ID></code>
/// <code>&lt;id:ID&gt;</code>
/// ,
/// <code>get("id")</code>
/// returns the
@ -146,9 +146,9 @@ namespace Antlr4.Runtime.Tree.Pattern
/// <code>null</code>
/// .</p>
/// <p>Pattern tags like
/// <code><ID></code>
/// <code>&lt;ID&gt;</code>
/// and
/// <code><expr></code>
/// <code>&lt;expr&gt;</code>
/// without labels are
/// considered to be labeled with
/// <code>ID</code>
@ -194,15 +194,15 @@ namespace Antlr4.Runtime.Tree.Pattern
/// the result will contain <em>all</em> of the following.</p>
/// <ul>
/// <li>Parse tree nodes matching tags of the form
/// <code><foo:anyRuleName></code>
/// <code>&lt;foo:anyRuleName&gt;</code>
/// and
/// <code><foo:AnyTokenName></code>
/// <code>&lt;foo:AnyTokenName&gt;</code>
/// .</li>
/// <li>Parse tree nodes matching tags of the form
/// <code><anyLabel:foo></code>
/// <code>&lt;anyLabel:foo&gt;</code>
/// .</li>
/// <li>Parse tree nodes matching tags of the form
/// <code><foo></code>
/// <code>&lt;foo&gt;</code>
/// .</li>
/// </ul>
/// </remarks>
@ -227,9 +227,9 @@ namespace Antlr4.Runtime.Tree.Pattern
return nodes;
}
/// <summary>Return a mapping from label &rarr; [list of nodes].</summary>
/// <summary>Return a mapping from label &#x2192; [list of nodes].</summary>
/// <remarks>
/// Return a mapping from label &rarr; [list of nodes].
/// Return a mapping from label &#x2192; [list of nodes].
/// <p>The map includes special entries corresponding to the names of rules and
/// tokens referenced in tags in the original pattern. For additional
/// information, see the description of

View File

@ -38,7 +38,7 @@ namespace Antlr4.Runtime.Tree.Pattern
{
/// <summary>
/// A pattern like
/// <code><ID> = <expr>;</code>
/// <code>&lt;ID&gt; = &lt;expr&gt;;</code>
/// converted to a
/// <see cref="Antlr4.Runtime.Tree.IParseTree">Antlr4.Runtime.Tree.IParseTree</see>
/// by

View File

@ -45,7 +45,7 @@ namespace Antlr4.Runtime.Tree.Pattern
/// <p>Patterns are strings of source input text with special tags representing
/// token or rule references such as:</p>
/// <p>
/// <code><ID> = <expr>;</code>
/// <code>&lt;ID&gt; = &lt;expr&gt;;</code>
/// </p>
/// <p>Given a pattern start rule such as
/// <code>statement</code>
@ -61,12 +61,12 @@ namespace Antlr4.Runtime.Tree.Pattern
/// routines can compare an actual
/// <see cref="Antlr4.Runtime.Tree.IParseTree">Antlr4.Runtime.Tree.IParseTree</see>
/// from a parse with this pattern. Tag
/// <code><ID></code>
/// <code>&lt;ID&gt;</code>
/// matches
/// any
/// <code>ID</code>
/// token and tag
/// <code><expr></code>
/// <code>&lt;expr&gt;</code>
/// references the result of the
/// <code>expr</code>
/// rule (generally an instance of
@ -95,7 +95,7 @@ namespace Antlr4.Runtime.Tree.Pattern
/// object that
/// contains the parse tree, the parse tree pattern, and a map from tag name to
/// matched nodes (more below). A subtree that fails to match, returns with
/// <see cref="ParseTreeMatch#mismatchedNode">ParseTreeMatch#mismatchedNode</see>
/// <see cref="ParseTreeMatch.GetMismatchedNode"/>
/// set to the first tree node that did not
/// match.</p>
/// <p>For efficiency, you can compile a tree pattern in string form to a
@ -118,7 +118,7 @@ namespace Antlr4.Runtime.Tree.Pattern
/// <see cref="ParseTreePatternMatcher">ParseTreePatternMatcher</see>
/// constructor are used to parse the pattern in string form. The lexer converts
/// the
/// <code><ID> = <expr>;</code>
/// <code>&lt;ID&gt; = &lt;expr&gt;;</code>
/// into a sequence of four tokens (assuming lexer
/// throws out whitespace or puts it on a hidden channel). Be aware that the
/// input stream is reset for the lexer (but not the parser; a
@ -127,7 +127,7 @@ namespace Antlr4.Runtime.Tree.Pattern
/// fields you have put into the lexer might get changed when this mechanism asks
/// it to scan the pattern string.</p>
/// <p>Normally a parser does not accept token
/// <code><expr></code>
/// <code>&lt;expr&gt;</code>
/// as a valid
/// <code>expr</code>
/// but, from the parser passed in, we create a special version of
@ -135,7 +135,7 @@ namespace Antlr4.Runtime.Tree.Pattern
/// <see cref="Antlr4.Runtime.Atn.ATN">Antlr4.Runtime.Atn.ATN</see>
/// ) that allows imaginary
/// tokens representing rules (
/// <code><expr></code>
/// <code>&lt;expr&gt;</code>
/// ) to match entire rules. We call
/// these <em>bypass alternatives</em>.</p>
/// <p>Delimiters are
@ -342,7 +342,7 @@ namespace Antlr4.Runtime.Tree.Pattern
// System.out.println("pattern tree = "+tree.toStringTree(parserInterp));
throw (RecognitionException)e.InnerException;
}
catch (RecognitionException re)
catch (RecognitionException)
{
throw;
}
@ -391,7 +391,7 @@ namespace Antlr4.Runtime.Tree.Pattern
/// <code>patternTree</code>
/// , filling
/// <code>match.</code>
/// <see cref="ParseTreeMatch#labels">labels</see>
/// <see cref="ParseTreeMatch.GetLabels"/>
/// .
/// </summary>
/// <returns>
@ -440,7 +440,7 @@ namespace Antlr4.Runtime.Tree.Pattern
}
else
{
if (t1.GetText().Equals(t2.GetText()))
if (t1.GetText().Equals(t2.GetText(), StringComparison.Ordinal))
{
}
else
@ -472,7 +472,6 @@ namespace Antlr4.Runtime.Tree.Pattern
RuleTagToken ruleTagToken = GetRuleTagToken(r2);
if (ruleTagToken != null)
{
ParseTreeMatch m = null;
if (r1.GetRuleIndex() == r2.GetRuleIndex())
{
// track label->list-of-nodes for both rule name and label (if any)
@ -519,7 +518,7 @@ namespace Antlr4.Runtime.Tree.Pattern
/// Is
/// <code>t</code>
///
/// <code>(expr <expr>)</code>
/// <code>(expr &lt;expr&gt;)</code>
/// subtree?
/// </summary>
protected internal virtual RuleTagToken GetRuleTagToken(IParseTree t)
@ -599,7 +598,7 @@ namespace Antlr4.Runtime.Tree.Pattern
/// <summary>
/// Split
/// <code><ID> = <e:expr> ;</code>
/// <code>&lt;ID&gt; = &lt;e:expr&gt; ;</code>
/// into 4 chunks for tokenizing by
/// <see cref="Tokenize(string)">Tokenize(string)</see>
/// .

View File

@ -39,7 +39,7 @@ namespace Antlr4.Runtime.Tree.Pattern
/// <see cref="Antlr4.Runtime.IToken">Antlr4.Runtime.IToken</see>
/// object representing an entire subtree matched by a parser
/// rule; e.g.,
/// <code><expr></code>
/// <code>&lt;expr&gt;</code>
/// . These tokens are created for
/// <see cref="TagChunk">TagChunk</see>
/// chunks where the tag corresponds to a parser rule.
@ -146,7 +146,7 @@ namespace Antlr4.Runtime.Tree.Pattern
/// <summary>
/// <inheritDoc></inheritDoc>
/// <p>Rule tag tokens are always placed on the
/// <see cref="Antlr4.Runtime.IToken.DefaultChannel">Antlr4.Runtime.IToken.DefaultChannel</see>
/// <see cref="TokenConstants.DefaultChannel"/>
/// .</p>
/// </summary>
public virtual int Channel

View File

@ -187,7 +187,6 @@ namespace Antlr4.Runtime.Tree.Xpath
throw new ArgumentException("Unknowth path element " + el);
}
}
loop_continue: ;
}
loop_break: ;
return elements.ToArray();