forked from jasder/antlr
Tweaks
This commit is contained in:
parent
dba3aaf740
commit
8e6820ac60
|
@ -1287,8 +1287,8 @@ public class ParserATNSimulator extends ATNSimulator {
|
||||||
* includes pairs with null predicates.
|
* includes pairs with null predicates.
|
||||||
*/
|
*/
|
||||||
protected BitSet evalSemanticContext(@NotNull DFAState.PredPrediction[] predPredictions,
|
protected BitSet evalSemanticContext(@NotNull DFAState.PredPrediction[] predPredictions,
|
||||||
ParserRuleContext outerContext,
|
ParserRuleContext outerContext,
|
||||||
boolean complete)
|
boolean complete)
|
||||||
{
|
{
|
||||||
BitSet predictions = new BitSet();
|
BitSet predictions = new BitSet();
|
||||||
for (DFAState.PredPrediction pair : predPredictions) {
|
for (DFAState.PredPrediction pair : predPredictions) {
|
||||||
|
@ -1906,7 +1906,7 @@ public class ParserATNSimulator extends ATNSimulator {
|
||||||
", input="+parser.getTokenStream().getText(interval));
|
", input="+parser.getTokenStream().getText(interval));
|
||||||
}
|
}
|
||||||
if ( parser!=null ) parser.getErrorListenerDispatch().reportAmbiguity(parser, dfa, startIndex, stopIndex,
|
if ( parser!=null ) parser.getErrorListenerDispatch().reportAmbiguity(parser, dfa, startIndex, stopIndex,
|
||||||
exact, ambigAlts, configs);
|
exact, ambigAlts, configs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final void setPredictionMode(@NotNull PredictionMode mode) {
|
public final void setPredictionMode(@NotNull PredictionMode mode) {
|
||||||
|
|
|
@ -30,6 +30,9 @@
|
||||||
|
|
||||||
package org.antlr.v4.runtime.atn;
|
package org.antlr.v4.runtime.atn;
|
||||||
|
|
||||||
|
import org.antlr.v4.runtime.ParserRuleContext;
|
||||||
|
import org.antlr.v4.runtime.Recognizer;
|
||||||
|
import org.antlr.v4.runtime.RuleContext;
|
||||||
import org.antlr.v4.runtime.TokenStream;
|
import org.antlr.v4.runtime.TokenStream;
|
||||||
import org.antlr.v4.runtime.misc.NotNull;
|
import org.antlr.v4.runtime.misc.NotNull;
|
||||||
|
|
||||||
|
@ -40,8 +43,20 @@ import org.antlr.v4.runtime.misc.NotNull;
|
||||||
* @see ParserATNSimulator#evalSemanticContext
|
* @see ParserATNSimulator#evalSemanticContext
|
||||||
*/
|
*/
|
||||||
public class PredicateEvalInfo extends DecisionEventInfo {
|
public class PredicateEvalInfo extends DecisionEventInfo {
|
||||||
|
/**
|
||||||
|
* The semantic context which was evaluated.
|
||||||
|
*/
|
||||||
public final SemanticContext semctx;
|
public final SemanticContext semctx;
|
||||||
|
/**
|
||||||
|
* The alternative number for the decision which is guarded by the semantic
|
||||||
|
* context {@link #semctx}. Note that other ATN
|
||||||
|
* configurations may predict the same alternative which are guarded by
|
||||||
|
* other semantic contexts and/or {@link SemanticContext#NONE}.
|
||||||
|
*/
|
||||||
public final int predictedAlt;
|
public final int predictedAlt;
|
||||||
|
/**
|
||||||
|
* The result of evaluating the semantic context {@link #semctx}.
|
||||||
|
*/
|
||||||
public final boolean evalResult;
|
public final boolean evalResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,22 +67,28 @@ public class PredicateEvalInfo extends DecisionEventInfo {
|
||||||
* @param input The input token stream
|
* @param input The input token stream
|
||||||
* @param startIndex The start index for the current prediction
|
* @param startIndex The start index for the current prediction
|
||||||
* @param stopIndex The index at which the predicate evaluation was
|
* @param stopIndex The index at which the predicate evaluation was
|
||||||
* triggered. Note that the input stream may be reset to other locations for
|
* triggered. Note that the input stream may be reset to other positions for
|
||||||
* the actual evaluation of individual predicates.
|
* the actual evaluation of individual predicates.
|
||||||
* @param evalResult The results of evaluating the semantic context.
|
* @param semctx The semantic context which was evaluated
|
||||||
* @param predictedAlt Identifies the represented
|
* @param evalResult The results of evaluating the semantic context
|
||||||
* alternative of {@code decision} that remains viable following the
|
* @param predictedAlt The alternative number for the decision which is
|
||||||
* evaluation of semantic predicates.
|
* guarded by the semantic context {@code semctx}. See {@link #predictedAlt}
|
||||||
* @param requiresFullContext Indicate if pred evaluated during full context prediction.
|
* for more information.
|
||||||
|
* @param fullCtx {@code true} if the semantic context was
|
||||||
|
* evaluated during LL prediction; otherwise, {@code false} if the semantic
|
||||||
|
* context was evaluated during SLL prediction
|
||||||
|
*
|
||||||
|
* @see ParserATNSimulator#evalSemanticContext(SemanticContext, ParserRuleContext, int, boolean)
|
||||||
|
* @see SemanticContext#eval(Recognizer, RuleContext)
|
||||||
*/
|
*/
|
||||||
public PredicateEvalInfo(int decision,
|
public PredicateEvalInfo(int decision,
|
||||||
@NotNull TokenStream input, int startIndex, int stopIndex,
|
@NotNull TokenStream input, int startIndex, int stopIndex,
|
||||||
@NotNull SemanticContext semctx,
|
@NotNull SemanticContext semctx,
|
||||||
@NotNull boolean evalResult,
|
@NotNull boolean evalResult,
|
||||||
@NotNull int predictedAlt,
|
@NotNull int predictedAlt,
|
||||||
@NotNull boolean requiresFullContext)
|
@NotNull boolean fullCtx)
|
||||||
{
|
{
|
||||||
super(decision, new ATNConfigSet(), input, startIndex, stopIndex, requiresFullContext);
|
super(decision, new ATNConfigSet(), input, startIndex, stopIndex, fullCtx);
|
||||||
this.semctx = semctx;
|
this.semctx = semctx;
|
||||||
this.evalResult = evalResult;
|
this.evalResult = evalResult;
|
||||||
this.predictedAlt = predictedAlt;
|
this.predictedAlt = predictedAlt;
|
||||||
|
|
Loading…
Reference in New Issue