Merge pull request #1758 from RobertvanderHulst/master

Fixed portability problems in C# target.  Also cleaned up some XML do…
This commit is contained in:
Terence Parr 2017-03-15 09:14:11 -07:00 committed by GitHub
commit 6d5de2418d
16 changed files with 125 additions and 119 deletions

View File

@ -141,3 +141,4 @@ YYYY/MM/DD, github id, Full name, email
2017/03/08, harry-tallbelt, Igor Vysokopoyasny, harry.tallbelt@gmail.com
2017/03/09, teverett, Tom Everett, tom@khubla.com
2017/03/03, chund, Christian Hund, christian.hund@gmail.com
2017/03/15, robertvanderhulst, Robert van der Hulst, robert@xsharp.eu

View File

@ -287,7 +287,7 @@ namespace Antlr4.Runtime
/// <summary>
/// Alternative to
/// <see cref="ANTLRInputStream"/>
/// <see cref="AntlrInputStream"/>
/// which treats the input as a series of Unicode code points,
/// instead of a series of UTF-16 code units.
///

View File

@ -104,7 +104,7 @@ namespace Antlr4.Runtime.Atn
/// If
/// <paramref name="ctx"/>
/// is
/// <see cref="PredictionContext.EmptyLocal"/>
/// <see cref="PredictionContext.EMPTY"/>
/// , the set of tokens will not include what can follow
/// the rule surrounding
/// <paramref name="s"/>

View File

@ -583,7 +583,7 @@ namespace Antlr4.Runtime.Atn
/// <see cref="StarLoopEntryState"/>
/// states in the specified ATN to set
/// the
/// <see cref="StarLoopEntryState.precedenceRuleDecision"/>
/// <see cref="StarLoopEntryState.isPrecedenceDecision"/>
/// field to the
/// correct value.
/// </summary>

View File

@ -75,6 +75,13 @@ namespace Antlr4.Runtime.Atn
throw new Exception("This ATN simulator does not support clearing the DFA.");
}
protected void ConsoleWriteLine(string format, params object[] arg)
{
#if !PORTABLE
System.Console.WriteLine(format, arg);
#endif
}
public PredictionContextCache getSharedContextCache()
{
return sharedContextCache;

View File

@ -20,7 +20,7 @@ namespace Antlr4.Runtime.Atn
/// determine that the SLL conflict is truly an ambiguity. For example, if none
/// of the ATN configurations in the conflicting SLL configuration set have
/// traversed a global follow transition (i.e.
/// <see cref="ATNConfig.ReachesIntoOuterContext()"/>
/// <see cref="ATNConfig.reachesIntoOuterContext"/>
/// is
/// <see langword="false"/>
/// for all

View File

@ -23,7 +23,7 @@ namespace Antlr4.Runtime.Atn
/// the two-stage parsing strategy to improve parsing performance for that
/// input.</p>
/// </remarks>
/// <seealso cref="ParserATNSimulator.ReportContextSensitivity(Antlr4.Runtime.Dfa.DFA, int, SimulatorState, int, int)"/>
/// <seealso cref="ParserATNSimulator.ReportContextSensitivity(Dfa.DFA, int, ATNConfigSet, int, int)"/>
/// <seealso cref="Antlr4.Runtime.IParserErrorListener.ReportContextSensitivity(Antlr4.Runtime.Parser, Antlr4.Runtime.Dfa.DFA, int, int, int, SimulatorState)"/>
/// <since>4.3</since>
public class ContextSensitivityInfo : DecisionEventInfo

View File

@ -27,8 +27,8 @@ namespace Antlr4.Runtime.Atn
/// the rule index of a precedence rule for which this transition is
/// returning from, where the precedence value is 0; otherwise, -1.
/// </returns>
/// <seealso cref="ATNConfig.PrecedenceFilterSuppressed()"/>
/// <seealso cref="ParserATNSimulator.ApplyPrecedenceFilter(ATNConfigSet, Antlr4.Runtime.ParserRuleContext, PredictionContextCache)"/>
/// <seealso cref="ATNConfig.IsPrecedenceFilterSuppressed"/>
/// <seealso cref="ParserATNSimulator.ApplyPrecedenceFilter(ATNConfigSet)"/>
/// <since>4.4.1</since>
public int OutermostPrecedenceReturn
{

View File

@ -33,7 +33,7 @@ namespace Antlr4.Runtime.Atn
/// <param name="state">
/// The final simulator state reached during prediction
/// prior to reaching the
/// <see cref="ATNSimulator.Error"/>
/// <see cref="ATNSimulator.ERROR"/>
/// state
/// </param>
/// <param name="input">The input token stream</param>

View File

@ -46,7 +46,7 @@ namespace Antlr4.Runtime.Atn
/// , do not check the input index during their execution.
/// Actions like this are position-independent, and may be stored more
/// efficiently as part of the
/// <see cref="ATNConfig.ActionExecutor()"/>
/// <see cref="LexerATNConfig.lexerActionExecutor"/>
/// .</p>
/// </remarks>
/// <returns>

View File

@ -184,7 +184,7 @@ namespace Antlr4.Runtime.Atn
/// If
/// <paramref name="ctx"/>
/// is
/// <see cref="PredictionContext.EmptyLocal"/>
/// <see cref="PredictionContext.EMPTY"/>
/// and
/// <paramref name="stopState"/>
/// or the end of the rule containing
@ -194,7 +194,7 @@ namespace Antlr4.Runtime.Atn
/// is added to the result set. If
/// <paramref name="ctx"/>
/// is not
/// <see cref="PredictionContext.EmptyLocal"/>
/// <see cref="PredictionContext.EMPTY"/>
/// and
/// <paramref name="addEOF"/>
/// is
@ -213,7 +213,7 @@ namespace Antlr4.Runtime.Atn
/// </param>
/// <param name="ctx">
/// The outer context, or
/// <see cref="PredictionContext.EmptyLocal"/>
/// <see cref="PredictionContext.EMPTY"/>
/// if
/// the outer context should not be used.
/// </param>
@ -250,7 +250,7 @@ namespace Antlr4.Runtime.Atn
/// outermost context is reached. This parameter has no effect if
/// <paramref name="ctx"/>
/// is
/// <see cref="PredictionContext.EmptyLocal"/>
/// <see cref="PredictionContext.EMPTY"/>
/// .
/// </param>
protected internal virtual void Look(ATNState s, ATNState stopState, PredictionContext ctx, IntervalSet look, HashSet<ATNConfig> lookBusy, BitSet calledRuleStack, bool seeThruPreds, bool addEOF)

View File

@ -12,11 +12,9 @@ namespace Antlr4.Runtime.Atn
/// <summary>"dup" of ParserInterpreter</summary>
public class LexerATNSimulator : ATNSimulator
{
#if !PORTABLE
public readonly bool debug = false;
public readonly bool dfa_debug = false;
#endif
public static readonly int MIN_DFA_EDGE = 0;
@ -64,6 +62,8 @@ namespace Antlr4.Runtime.Atn
this.recog = recog;
}
public void CopyState(LexerATNSimulator simulator)
{
this.charPositionInLine = simulator.charPositionInLine;
@ -117,12 +117,10 @@ namespace Antlr4.Runtime.Atn
protected int MatchATN(ICharStream input)
{
ATNState startState = atn.modeToStartState[mode];
if (debug)
{
Console.WriteLine("matchATN mode " + mode + " start: " + startState);
ConsoleWriteLine("matchATN mode " + mode + " start: " + startState);
}
int old_mode = mode;
ATNConfigSet s0_closure = ComputeStartState(input, startState);
@ -136,12 +134,10 @@ namespace Antlr4.Runtime.Atn
}
int predict = ExecATN(input, next);
if (debug)
{
Console.WriteLine("DFA after matchATN: " + decisionToDFA[old_mode].ToString());
ConsoleWriteLine("DFA after matchATN: " + decisionToDFA[old_mode].ToString());
}
return predict;
}
@ -150,9 +146,8 @@ namespace Antlr4.Runtime.Atn
//System.out.println("enter exec index "+input.index()+" from "+ds0.configs);
if (debug)
{
Console.WriteLine("start state closure=" + ds0.configSet);
ConsoleWriteLine("start state closure=" + ds0.configSet);
}
if (ds0.isAcceptState)
{
// allow zero-length tokens
@ -167,9 +162,8 @@ namespace Antlr4.Runtime.Atn
{ // while more work
if (debug)
{
Console.WriteLine("execATN loop starting closure: " + s.configSet);
ConsoleWriteLine("execATN loop starting closure: " + s.configSet);
}
// As we move src->trg, src->trg, we keep track of the previous trg to
// avoid looking up the DFA state again, which is expensive.
// If the previous target was already part of the DFA, we might
@ -245,7 +239,7 @@ namespace Antlr4.Runtime.Atn
DFAState target = s.edges[t - MIN_DFA_EDGE];
if (debug && target != null)
{
Console.WriteLine("reuse state " + s.stateNumber + " edge to " + target.stateNumber);
ConsoleWriteLine("reuse state " + s.stateNumber + " edge to " + target.stateNumber);
}
return target;
@ -329,7 +323,7 @@ namespace Antlr4.Runtime.Atn
if (debug)
{
Console.WriteLine("testing " + GetTokenName(t) + " at " + c.ToString(recog, true));
ConsoleWriteLine("testing " + GetTokenName(t) + " at " + c.ToString(recog, true));
}
int n = c.state.NumberOfTransitions;
@ -363,7 +357,7 @@ namespace Antlr4.Runtime.Atn
{
if (debug)
{
Console.WriteLine("ACTION " + lexerActionExecutor);
ConsoleWriteLine("ACTION " + lexerActionExecutor);
}
// seek to after last char in token
@ -417,7 +411,7 @@ namespace Antlr4.Runtime.Atn
{
if (debug)
{
Console.WriteLine("closure(" + config.ToString(recog, true) + ")");
ConsoleWriteLine("closure(" + config.ToString(recog, true) + ")");
}
if (config.state is RuleStopState)
@ -426,10 +420,10 @@ namespace Antlr4.Runtime.Atn
{
if (recog != null)
{
Console.WriteLine("closure at " + recog.RuleNames[config.state.ruleIndex] + " rule stop " + config);
ConsoleWriteLine("closure at " + recog.RuleNames[config.state.ruleIndex] + " rule stop " + config);
}
else {
Console.WriteLine("closure at rule stop " + config);
ConsoleWriteLine("closure at rule stop " + config);
}
}
@ -529,7 +523,7 @@ namespace Antlr4.Runtime.Atn
PredicateTransition pt = (PredicateTransition)t;
if (debug)
{
Console.WriteLine("EVAL rule " + pt.ruleIndex + ":" + pt.predIndex);
ConsoleWriteLine("EVAL rule " + pt.ruleIndex + ":" + pt.predIndex);
}
configs.hasSemanticContext = true;
if (EvaluatePredicate(input, pt.ruleIndex, pt.predIndex, speculative))
@ -688,7 +682,7 @@ namespace Antlr4.Runtime.Atn
if (debug)
{
Console.WriteLine("EDGE " + p + " -> " + q + " upon " + ((char)t));
ConsoleWriteLine("EDGE " + p + " -> " + q + " upon " + ((char)t));
}
lock (p)

View File

@ -284,8 +284,8 @@ namespace Antlr4.Runtime.Atn
this.parser = parser;
this.decisionToDFA = decisionToDFA;
// DOTGenerator dot = new DOTGenerator(null);
// Console.WriteLine(dot.getDOT(atn.rules.get(0), parser.getRuleNames()));
// Console.WriteLine(dot.getDOT(atn.rules.get(1), parser.getRuleNames()));
// ConsoleWriteLine(dot.getDOT(atn.rules.get(0), parser.getRuleNames()));
// ConsoleWriteLine(dot.getDOT(atn.rules.get(1), parser.getRuleNames()));
}
public override void Reset()
@ -306,7 +306,7 @@ namespace Antlr4.Runtime.Atn
{
if (debug || debug_list_atn_decisions)
{
Console.WriteLine("adaptivePredict decision " + decision +
ConsoleWriteLine("adaptivePredict decision " + decision +
" exec LA(1)==" + GetLookaheadName(input) +
" line " + input.LT(1).Line + ":" + input.LT(1).Column);
}
@ -341,7 +341,7 @@ namespace Antlr4.Runtime.Atn
if (outerContext == null) outerContext = ParserRuleContext.EmptyContext;
if (debug || debug_list_atn_decisions)
{
Console.WriteLine("predictATN decision " + dfa.decision +
ConsoleWriteLine("predictATN decision " + dfa.decision +
" exec LA(1)==" + GetLookaheadName(input) +
", outerContext=" + outerContext.ToString(parser));
}
@ -373,7 +373,7 @@ namespace Antlr4.Runtime.Atn
int alt = ExecATN(dfa, s0, input, index, outerContext);
if (debug)
Console.WriteLine("DFA after predictATN: " + dfa.ToString(parser.Vocabulary));
ConsoleWriteLine("DFA after predictATN: " + dfa.ToString(parser.Vocabulary));
return alt;
}
finally
@ -421,14 +421,14 @@ namespace Antlr4.Runtime.Atn
{
if (debug || debug_list_atn_decisions)
{
Console.WriteLine("execATN decision " + dfa.decision +
ConsoleWriteLine("execATN decision " + dfa.decision +
" exec LA(1)==" + GetLookaheadName(input) +
" line " + input.LT(1).Line + ":" + input.LT(1).Column);
}
DFAState previousD = s0;
if (debug) Console.WriteLine("s0 = " + s0);
if (debug) ConsoleWriteLine("s0 = " + s0);
int t = input.LA(1);
@ -467,7 +467,7 @@ namespace Antlr4.Runtime.Atn
BitSet conflictingAlts = D.configSet.conflictingAlts;
if (D.predicates != null)
{
if (debug) Console.WriteLine("DFA state has preds in DFA sim LL failover");
if (debug) ConsoleWriteLine("DFA state has preds in DFA sim LL failover");
int conflictIndex = input.Index;
if (conflictIndex != startIndex)
{
@ -477,7 +477,7 @@ namespace Antlr4.Runtime.Atn
conflictingAlts = EvalSemanticContext(D.predicates, outerContext, true);
if (conflictingAlts.Cardinality() == 1)
{
if (debug) Console.WriteLine("Full LL avoided");
if (debug) ConsoleWriteLine("Full LL avoided");
return conflictingAlts.NextSetBit(0);
}
@ -489,7 +489,7 @@ namespace Antlr4.Runtime.Atn
}
}
if (dfa_debug) Console.WriteLine("ctx sensitive state " + outerContext + " in " + D);
if (dfa_debug) ConsoleWriteLine("ctx sensitive state " + outerContext + " in " + D);
bool fullCtx = true;
ATNConfigSet s0_closure =
ComputeStartState(dfa.atnStartState, outerContext, fullCtx);
@ -587,7 +587,7 @@ namespace Antlr4.Runtime.Atn
if (debug)
{
ICollection<BitSet> altSubSets = PredictionMode.GetConflictingAltSubsets(reach.configs);
Console.WriteLine("SLL altSubSets=" + altSubSets +
ConsoleWriteLine("SLL altSubSets=" + altSubSets +
", configs=" + reach +
", predict=" + predictedAlt + ", allSubsetsConflict=" +
PredictionMode.AllSubsetsConflict(altSubSets) + ", conflictingAlts=" +
@ -656,7 +656,7 @@ namespace Antlr4.Runtime.Atn
{
if (debug || debug_list_atn_decisions)
{
Console.WriteLine("execATNWithFullContext " + s0);
ConsoleWriteLine("execATNWithFullContext " + s0);
}
bool fullCtx = true;
bool foundExactAmbig = false;
@ -667,7 +667,7 @@ namespace Antlr4.Runtime.Atn
int predictedAlt;
while (true)
{ // while more work
// Console.WriteLine("LL REACH "+GetLookaheadName(input)+
// ConsoleWriteLine("LL REACH "+GetLookaheadName(input)+
// " from configs.size="+previous.size()+
// " line "+input.LT(1)Line+":"+input.LT(1).Column);
reach = ComputeReachSet(previous, t, fullCtx);
@ -695,13 +695,13 @@ namespace Antlr4.Runtime.Atn
ICollection<BitSet> altSubSets = PredictionMode.GetConflictingAltSubsets(reach.configs);
if (debug)
{
Console.WriteLine("LL altSubSets=" + altSubSets +
ConsoleWriteLine("LL altSubSets=" + altSubSets +
", predict=" + PredictionMode.GetUniqueAlt(altSubSets) +
", ResolvesToJustOneViableAlt=" +
PredictionMode.ResolvesToJustOneViableAlt(altSubSets));
}
// Console.WriteLine("altSubSets: "+altSubSets);
// ConsoleWriteLine("altSubSets: "+altSubSets);
// System.err.println("reach="+reach+", "+reach.conflictingAlts);
reach.uniqueAlt = GetUniqueAlt(reach);
// unique prediction?
@ -785,7 +785,7 @@ namespace Antlr4.Runtime.Atn
protected virtual ATNConfigSet ComputeReachSet(ATNConfigSet closure, int t, bool fullCtx)
{
if (debug)
Console.WriteLine("in computeReachSet, starting closure: " + closure);
ConsoleWriteLine("in computeReachSet, starting closure: " + closure);
if (mergeCache == null)
{
@ -809,7 +809,7 @@ namespace Antlr4.Runtime.Atn
// First figure out where we can reach on input t
foreach (ATNConfig c in closure.configs)
{
if (debug) Console.WriteLine("testing " + GetTokenName(t) + " at " + c.ToString());
if (debug) ConsoleWriteLine("testing " + GetTokenName(t) + " at " + c.ToString());
if (c.state is RuleStopState)
{
@ -1275,7 +1275,7 @@ namespace Antlr4.Runtime.Atn
// nonambig alts are null in altToPred
if (nPredAlts == 0) altToPred = null;
if (debug) Console.WriteLine("getPredsForAmbigAlts result " + Arrays.ToString(altToPred));
if (debug) ConsoleWriteLine("getPredsForAmbigAlts result " + Arrays.ToString(altToPred));
return altToPred;
}
@ -1302,7 +1302,7 @@ namespace Antlr4.Runtime.Atn
return null;
}
// Console.WriteLine(Arrays.toString(altToPred)+"->"+pairs);
// ConsoleWriteLine(Arrays.toString(altToPred)+"->"+pairs);
return pairs.ToArray();
}
@ -1452,12 +1452,12 @@ namespace Antlr4.Runtime.Atn
bool predicateEvaluationResult = EvalSemanticContext(pair.pred, outerContext, pair.alt, fullCtx);
if (debug || dfa_debug)
{
Console.WriteLine("eval pred " + pair + "=" + predicateEvaluationResult);
ConsoleWriteLine("eval pred " + pair + "=" + predicateEvaluationResult);
}
if (predicateEvaluationResult)
{
if (debug || dfa_debug) Console.WriteLine("PREDICT " + pair.alt);
if (debug || dfa_debug) ConsoleWriteLine("PREDICT " + pair.alt);
predictions[pair.alt] = true;
if (!complete)
{
@ -1533,7 +1533,7 @@ namespace Antlr4.Runtime.Atn
bool treatEofAsEpsilon)
{
if (debug)
Console.WriteLine("closure(" + config.ToString(parser, true) + ")");
ConsoleWriteLine("closure(" + config.ToString(parser, true) + ")");
if (config.state is RuleStopState)
{
@ -1552,7 +1552,7 @@ namespace Antlr4.Runtime.Atn
}
else {
// we have no context info, just chase follow links (if greedy)
if (debug) Console.WriteLine("FALLING off rule " +
if (debug) ConsoleWriteLine("FALLING off rule " +
GetRuleName(config.state.ruleIndex));
Closure_(config, configSet, closureBusy, collectPredicates,
fullCtx, depth, treatEofAsEpsilon);
@ -1583,7 +1583,7 @@ namespace Antlr4.Runtime.Atn
}
else {
// else if we have no context info, just chase follow links (if greedy)
if (debug) Console.WriteLine("FALLING off rule " +
if (debug) ConsoleWriteLine("FALLING off rule " +
GetRuleName(config.state.ruleIndex));
}
}
@ -1608,7 +1608,7 @@ namespace Antlr4.Runtime.Atn
configs.Add(config, mergeCache);
// make sure to not return here, because EOF transitions can act as
// both epsilon transitions and non-epsilon transitions.
// if ( debug ) Console.WriteLine("added config "+configs);
// if ( debug ) ConsoleWriteLine("added config "+configs);
}
for (int i = 0; i < p.NumberOfTransitions; i++)
@ -1656,7 +1656,7 @@ namespace Antlr4.Runtime.Atn
configs.dipsIntoOuterContext = true; // TODO: can remove? only care when we add to set per middle of this method
newDepth--;
if (debug)
Console.WriteLine("dips into outer ctx: " + c);
ConsoleWriteLine("dips into outer ctx: " + c);
}
else if (t is RuleTransition)
{
@ -1895,7 +1895,7 @@ namespace Antlr4.Runtime.Atn
protected ATNConfig ActionTransition(ATNConfig config, ActionTransition t)
{
if (debug) Console.WriteLine("ACTION edge " + t.ruleIndex + ":" + t.actionIndex);
if (debug) ConsoleWriteLine("ACTION edge " + t.ruleIndex + ":" + t.actionIndex);
return new ATNConfig(config, t.target);
}
@ -1908,12 +1908,12 @@ namespace Antlr4.Runtime.Atn
{
if (debug)
{
Console.WriteLine("PRED (collectPredicates=" + collectPredicates + ") " +
ConsoleWriteLine("PRED (collectPredicates=" + collectPredicates + ") " +
pt.precedence + ">=_p" +
", ctx dependent=true");
if (parser != null)
{
Console.WriteLine("context surrounding pred is " +
ConsoleWriteLine("context surrounding pred is " +
parser.GetRuleInvocationStack());
}
}
@ -1945,7 +1945,7 @@ namespace Antlr4.Runtime.Atn
c = new ATNConfig(config, pt.target);
}
if (debug) Console.WriteLine("config from pred transition=" + c);
if (debug) ConsoleWriteLine("config from pred transition=" + c);
return c;
}
@ -1958,12 +1958,12 @@ namespace Antlr4.Runtime.Atn
{
if (debug)
{
Console.WriteLine("PRED (collectPredicates=" + collectPredicates + ") " +
ConsoleWriteLine("PRED (collectPredicates=" + collectPredicates + ") " +
pt.ruleIndex + ":" + pt.predIndex +
", ctx dependent=" + pt.isCtxDependent);
if (parser != null)
{
Console.WriteLine("context surrounding pred is " +
ConsoleWriteLine("context surrounding pred is " +
parser.GetRuleInvocationStack());
}
}
@ -1996,7 +1996,7 @@ namespace Antlr4.Runtime.Atn
c = new ATNConfig(config, pt.target);
}
if (debug) Console.WriteLine("config from pred transition=" + c);
if (debug) ConsoleWriteLine("config from pred transition=" + c);
return c;
}
@ -2005,7 +2005,7 @@ namespace Antlr4.Runtime.Atn
{
if (debug)
{
Console.WriteLine("CALL rule " + GetRuleName(t.target.ruleIndex) +
ConsoleWriteLine("CALL rule " + GetRuleName(t.target.ruleIndex) +
", ctx=" + config.context);
}
@ -2109,7 +2109,9 @@ namespace Antlr4.Runtime.Atn
*/
public void DumpDeadEndConfigs(NoViableAltException nvae)
{
Console.Error.WriteLine("dead end configs: ");
#if !PORTABLE
System.Console.Error.WriteLine("dead end configs: ");
#endif
foreach (ATNConfig c in nvae.DeadEndConfigs.configs)
{
String trans = "no edges";
@ -2128,7 +2130,9 @@ namespace Antlr4.Runtime.Atn
trans = (not ? "~" : "") + "Set " + st.set.ToString();
}
}
Console.Error.WriteLine(c.ToString(parser, true) + ":" + trans);
#if !PORTABLE
System.Console.Error.WriteLine(c.ToString(parser, true) + ":" + trans);
#endif
}
}
@ -2188,7 +2192,7 @@ namespace Antlr4.Runtime.Atn
{
if (debug)
{
Console.WriteLine("EDGE " + from + " -> " + to + " upon " + GetTokenName(t));
ConsoleWriteLine("EDGE " + from + " -> " + to + " upon " + GetTokenName(t));
}
if (to == null)
@ -2214,7 +2218,7 @@ namespace Antlr4.Runtime.Atn
if (debug)
{
Console.WriteLine("DFA=\n" + dfa.ToString(parser != null ? parser.Vocabulary : Vocabulary.EmptyVocabulary));
ConsoleWriteLine("DFA=\n" + dfa.ToString(parser != null ? parser.Vocabulary : Vocabulary.EmptyVocabulary));
}
return to;
@ -2254,7 +2258,7 @@ namespace Antlr4.Runtime.Atn
D.configSet.IsReadOnly = true;
}
dfa.states.Put(D, D);
if (debug) Console.WriteLine("adding new DFA state: " + D);
if (debug) ConsoleWriteLine("adding new DFA state: " + D);
return D;
}
}
@ -2264,7 +2268,7 @@ namespace Antlr4.Runtime.Atn
if (debug || retry_debug)
{
Interval interval = Interval.Of(startIndex, stopIndex);
Console.WriteLine("reportAttemptingFullContext decision=" + dfa.decision + ":" + configs +
ConsoleWriteLine("reportAttemptingFullContext decision=" + dfa.decision + ":" + configs +
", input=" + parser.TokenStream.GetText(interval));
}
if (parser != null)
@ -2276,7 +2280,7 @@ namespace Antlr4.Runtime.Atn
if (debug || retry_debug)
{
Interval interval = Interval.Of(startIndex, stopIndex);
Console.WriteLine("ReportContextSensitivity decision=" + dfa.decision + ":" + configs +
ConsoleWriteLine("ReportContextSensitivity decision=" + dfa.decision + ":" + configs +
", input=" + parser.TokenStream.GetText(interval));
}
if (parser != null) parser.ErrorListenerDispatch.ReportContextSensitivity(parser, dfa, startIndex, stopIndex, prediction, null /*configs*/);
@ -2293,7 +2297,7 @@ namespace Antlr4.Runtime.Atn
if (debug || retry_debug)
{
Interval interval = Interval.Of(startIndex, stopIndex);
Console.WriteLine("ReportAmbiguity " +
ConsoleWriteLine("ReportAmbiguity " +
ambigAlts + ":" + configs +
", input=" + parser.TokenStream.GetText(interval));
}

View File

@ -16,7 +16,7 @@ namespace Antlr4.Runtime.Atn
/// This class represents profiling event information for semantic predicate
/// evaluations which occur during prediction.
/// </remarks>
/// <seealso cref="ParserATNSimulator.EvalSemanticContext(Antlr4.Runtime.Dfa.DFAState.PredPrediction[], Antlr4.Runtime.ParserRuleContext, bool)"/>
/// <seealso cref="ParserATNSimulator.EvalSemanticContext(Dfa.PredPrediction[], ParserRuleContext, bool)"/>
/// <since>4.3</since>
public class PredicateEvalInfo : DecisionEventInfo
{
@ -68,7 +68,7 @@ namespace Antlr4.Runtime.Atn
/// <see cref="predictedAlt"/>
/// for more information.
/// </param>
/// <seealso cref="ParserATNSimulator.EvalSemanticContext(SemanticContext, ParserRuleContext, int)"/>
/// <seealso cref="ParserATNSimulator.EvalSemanticContext(SemanticContext, ParserRuleContext, int, bool)"/>
/// <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

@ -110,7 +110,7 @@ namespace Antlr4.Runtime.Atn
/// The hash code is only a function of the
/// <see cref="ATNState.stateNumber"/>
/// and
/// <see cref="ATNConfig.Context"/>
/// <see cref="ATNConfig.context"/>
/// .
/// </summary>
public override int GetHashCode(ATNConfig o)
@ -234,7 +234,7 @@ namespace Antlr4.Runtime.Atn
/// (s, 1, x,
/// ), (s, 1, x', {p}), (s, 2, x'', {})}</p>
/// <p>If the configuration set has predicates (as indicated by
/// <see cref="ATNConfigSet.HasSemanticContext()"/>
/// <see cref="ATNConfigSet.hasSemanticContext"/>
/// ), this algorithm makes a copy of
/// the configurations to strip out all of the predicates so that a standard
/// <see cref="ATNConfigSet"/>
@ -353,12 +353,12 @@ namespace Antlr4.Runtime.Atn
/// and singleton subsets with
/// non-conflicting configurations. Two configurations conflict if they have
/// identical
/// <see cref="ATNConfig.State"/>
/// <see cref="ATNConfig.state"/>
/// and
/// <see cref="ATNConfig.Context"/>
/// <see cref="ATNConfig.context"/>
/// values
/// but different
/// <see cref="ATNConfig.Alt"/>
/// <see cref="ATNConfig.alt"/>
/// value, e.g.
/// <c>(s, i, ctx, _)</c>
/// and
@ -387,7 +387,7 @@ namespace Antlr4.Runtime.Atn
/// :
/// <pre>
/// map[c] U= c.
/// <see cref="ATNConfig.Alt()">getAlt()</see>
/// <see cref="ATNConfig.alt">getAlt()</see>
/// # map hash/equals uses s and x, not
/// alt and not pred
/// </pre>
@ -801,7 +801,7 @@ namespace Antlr4.Runtime.Atn
/// :
/// <pre>
/// map[c] U= c.
/// <see cref="ATNConfig.Alt()">getAlt()</see>
/// <see cref="ATNConfig.alt">getAlt()</see>
/// # map hash/equals uses s and x, not
/// alt and not pred
/// </pre>
@ -833,9 +833,9 @@ namespace Antlr4.Runtime.Atn
/// :
/// <pre>
/// map[c.
/// <see cref="ATNConfig.State"/>
/// <see cref="ATNConfig.state"/>
/// ] U= c.
/// <see cref="ATNConfig.Alt"/>
/// <see cref="ATNConfig.alt"/>
/// </pre>
/// </remarks>
[return: NotNull]

View File

@ -33,7 +33,7 @@ namespace Antlr4.Runtime
/// viable alternatives identified by the prediction algorithm. When
/// <paramref name="ambigAlts"/>
/// is null, use
/// <see cref="Antlr4.Runtime.Atn.ATNConfigSet.RepresentedAlternatives()"/>
/// <see cref="Antlr4.Runtime.Atn.ATNConfigSet.GetAlts()"/>
/// to obtain the represented
/// alternatives from the
/// <paramref name="configs"/>