Use ATNConfigSet for parameter instead of OrderedHashSet<ATNConfig>

This commit is contained in:
sharwell 2012-02-08 16:26:14 -06:00
parent a6524d8b38
commit 18a6414fb3
3 changed files with 14 additions and 12 deletions

View File

@ -1,6 +1,7 @@
package org.antlr.v4.runtime;
import org.antlr.v4.runtime.atn.ATNConfig;
import org.antlr.v4.runtime.atn.ATNConfigSet;
import org.antlr.v4.runtime.atn.DecisionState;
import org.antlr.v4.runtime.atn.SemanticContext;
import org.antlr.v4.runtime.dfa.DFA;
@ -125,12 +126,12 @@ public interface ANTLRErrorStrategy {
*/
void reportAmbiguity(@NotNull Parser recognizer,
DFA dfa, int startIndex, int stopIndex, @NotNull IntervalSet ambigAlts,
@NotNull OrderedHashSet<ATNConfig> configs);
@NotNull ATNConfigSet configs);
void reportAttemptingFullContext(@NotNull Parser recognizer,
@NotNull DFA dfa,
int startIndex, int stopIndex,
@NotNull OrderedHashSet<ATNConfig> configs);
@NotNull ATNConfigSet configs);
/** Called by the parser when it find a conflict that is resolved by retrying the parse
* with full context. This is not a warning; it simply notifies you that your grammar
@ -140,7 +141,7 @@ public interface ANTLRErrorStrategy {
void reportContextSensitivity(@NotNull Parser recognizer,
@NotNull DFA dfa,
int startIndex, int stopIndex,
@NotNull OrderedHashSet<ATNConfig> configs);
@NotNull ATNConfigSet configs);
/** Called by the parser when it finds less than n-1 predicates for n ambiguous alternatives.
* If there are n-1, we assume that the missing predicate is !(the "or" of the other predicates).
@ -152,5 +153,5 @@ public interface ANTLRErrorStrategy {
int startIndex, int stopIndex, @NotNull IntervalSet ambigAlts,
DecisionState decState,
@NotNull SemanticContext[] altToPred,
@NotNull OrderedHashSet<ATNConfig> configs, boolean fullContextParse);
@NotNull ATNConfigSet configs, boolean fullContextParse);
}

View File

@ -554,7 +554,7 @@ public class DefaultErrorStrategy implements ANTLRErrorStrategy {
@Override
public void reportAmbiguity(@NotNull Parser recognizer,
DFA dfa, int startIndex, int stopIndex, @NotNull IntervalSet ambigAlts,
@NotNull OrderedHashSet<ATNConfig> configs)
@NotNull ATNConfigSet configs)
{
}
@ -562,13 +562,13 @@ public class DefaultErrorStrategy implements ANTLRErrorStrategy {
public void reportAttemptingFullContext(@NotNull Parser recognizer,
@NotNull DFA dfa,
int startIndex, int stopIndex,
@NotNull OrderedHashSet<ATNConfig> configs)
@NotNull ATNConfigSet configs)
{
}
@Override
public void reportContextSensitivity(@NotNull Parser recognizer, @NotNull DFA dfa,
int startIndex, int stopIndex, @NotNull OrderedHashSet<ATNConfig> configs)
int startIndex, int stopIndex, @NotNull ATNConfigSet configs)
{
}
@ -579,7 +579,7 @@ public class DefaultErrorStrategy implements ANTLRErrorStrategy {
@NotNull IntervalSet ambigAlts,
DecisionState decState,
@NotNull SemanticContext[] altToPred,
@NotNull OrderedHashSet<ATNConfig> configs, boolean fullContextParse)
@NotNull ATNConfigSet configs, boolean fullContextParse)
{
}
}

View File

@ -30,6 +30,7 @@
package org.antlr.v4.runtime;
import org.antlr.v4.runtime.atn.ATNConfig;
import org.antlr.v4.runtime.atn.ATNConfigSet;
import org.antlr.v4.runtime.atn.DecisionState;
import org.antlr.v4.runtime.atn.SemanticContext;
import org.antlr.v4.runtime.dfa.DFA;
@ -43,7 +44,7 @@ public class DiagnosticErrorStrategy extends DefaultErrorStrategy {
@Override
public void reportAmbiguity(@NotNull Parser recognizer,
DFA dfa, int startIndex, int stopIndex, @NotNull IntervalSet ambigAlts,
@NotNull OrderedHashSet<ATNConfig> configs)
@NotNull ATNConfigSet configs)
{
recognizer.notifyErrorListeners("reportAmbiguity d=" + dfa.decision + ": ambigAlts=" + ambigAlts + ":" + configs + ", input='" +
recognizer.getInputString(startIndex, stopIndex) + "'");
@ -53,7 +54,7 @@ public class DiagnosticErrorStrategy extends DefaultErrorStrategy {
public void reportAttemptingFullContext(@NotNull Parser recognizer,
@NotNull DFA dfa,
int startIndex, int stopIndex,
@NotNull OrderedHashSet<ATNConfig> configs)
@NotNull ATNConfigSet configs)
{
recognizer.notifyErrorListeners("reportAttemptingFullContext d=" + dfa.decision + ": " + configs + ", input='" +
recognizer.getInputString(startIndex, stopIndex) + "'");
@ -61,7 +62,7 @@ public class DiagnosticErrorStrategy extends DefaultErrorStrategy {
@Override
public void reportContextSensitivity(@NotNull Parser recognizer, @NotNull DFA dfa,
int startIndex, int stopIndex, @NotNull OrderedHashSet<ATNConfig> configs)
int startIndex, int stopIndex, @NotNull ATNConfigSet configs)
{
recognizer.notifyErrorListeners("reportContextSensitivity d=" + dfa.decision + ": " + configs + ", input='" +
recognizer.getInputString(startIndex, stopIndex) + "'");
@ -74,7 +75,7 @@ public class DiagnosticErrorStrategy extends DefaultErrorStrategy {
@NotNull IntervalSet ambigAlts,
DecisionState decState,
@NotNull SemanticContext[] altToPred,
@NotNull OrderedHashSet<ATNConfig> configs, boolean fullContextParse)
@NotNull ATNConfigSet configs, boolean fullContextParse)
{
recognizer.notifyErrorListeners("reportInsufficientPredicates d=" + dfa.decision + ", decState=" + decState +
", ambigAlts=" + ambigAlts + ":" + Arrays.toString(altToPred) +