diff --git a/tool/src/main/java/org/antlr/analysis/DFAState.java b/tool/src/main/java/org/antlr/analysis/DFAState.java index 541d81a9e..a5b5cc97d 100644 --- a/tool/src/main/java/org/antlr/analysis/DFAState.java +++ b/tool/src/main/java/org/antlr/analysis/DFAState.java @@ -659,7 +659,7 @@ public Set getAltSet() { public Set getGatedSyntacticPredicatesInNFAConfigurations() { int numConfigs = nfaConfigurations.size(); - Set synpreds = new HashSet(); + Set synpreds = new LinkedHashSet(); for (int i = 0; i < numConfigs; i++) { NFAConfiguration configuration = nfaConfigurations.get(i); SemanticContext gatedPredExpr = diff --git a/tool/src/main/java/org/antlr/analysis/DecisionProbe.java b/tool/src/main/java/org/antlr/analysis/DecisionProbe.java index 625728b9a..5c4fadec8 100644 --- a/tool/src/main/java/org/antlr/analysis/DecisionProbe.java +++ b/tool/src/main/java/org/antlr/analysis/DecisionProbe.java @@ -79,7 +79,7 @@ public class DecisionProbe { * Note that from the DFA state, you can ask for * which alts are nondeterministic. */ - protected Set statesWithSyntacticallyAmbiguousAltsSet = new HashSet(); + protected Set statesWithSyntacticallyAmbiguousAltsSet = new LinkedHashSet(); /** Track just like stateToSyntacticallyAmbiguousAltsMap, but only * for nondeterminisms that arise in the Tokens rule such as keyword vs @@ -87,13 +87,13 @@ public class DecisionProbe { * in conflict. */ protected Map> stateToSyntacticallyAmbiguousTokensRuleAltsMap = - new HashMap>(); + new LinkedHashMap>(); /** Was a syntactic ambiguity resolved with predicates? Any DFA * state that predicts more than one alternative, must be resolved * with predicates or it should be reported to the user. */ - protected Set statesResolvedWithSemanticPredicatesSet = new HashSet(); + protected Set statesResolvedWithSemanticPredicatesSet = new LinkedHashSet(); /** Track the predicates for each alt per DFA state; * more than one DFA state might have syntactically ambig alt prediction. @@ -101,22 +101,22 @@ public class DecisionProbe { * SemanticContext (pred(s) to execute to resolve syntactic ambiguity). */ protected Map> stateToAltSetWithSemanticPredicatesMap = - new HashMap>(); + new LinkedHashMap>(); /** Tracks alts insufficiently covered. * For example, p1||true gets reduced to true and so leaves * whole alt uncovered. This maps DFA state to the set of alts */ protected Map>> stateToIncompletelyCoveredAltsMap = - new HashMap>>(); + new LinkedHashMap>>(); /** The set of states w/o emanating edges and w/o resolving sem preds. */ - protected Set danglingStates = new HashSet(); + protected Set danglingStates = new LinkedHashSet(); /** The overall list of alts within the decision that have at least one * conflicting input sequence. */ - protected Set altsWithProblem = new HashSet(); + protected Set altsWithProblem = new LinkedHashSet(); /** If decision with > 1 alt has recursion in > 1 alt, it's (likely) nonregular * lookahead. The decision cannot be made with a DFA. @@ -137,7 +137,7 @@ public class DecisionProbe { /** Left recursion discovered. The proposed new NFAConfiguration * is recorded for the associated DFA state. protected Map> stateToLeftRecursiveConfigurationsMap = - new HashMap>(); + new LinkedHashMap>(); */ /** Did ANTLR have to terminate early on the analysis of this decision? */ @@ -297,7 +297,7 @@ public void removeRecursiveOverflowState(DFAState d) { */ public List