Class ATNConfigSet
java.lang.Object
org.graalvm.shadowed.org.antlr.v4.runtime.atn.ATNConfigSet
- Direct Known Subclasses:
OrderedATNConfigSet
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic final classstatic classThe reason that we need this is because we don't want the hash map to use the standard hash code and equals. -
Field Summary
FieldsModifier and TypeFieldDescriptionAll configs but hashed by (s, i, _, pi) not including context.Track the elements as they are added to the set; supports get(i)protected BitSetCurrently this is only used when we detect SLL conflict; this does not necessarily represent the ambiguous alternatives.booleanfinal booleanIndicates that this configuration set is part of a full context LL prediction.booleanprotected booleanIndicates that the set of configurations is read-only.int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanadd(ATNConfig config, DoubleKeyMap<PredictionContext, PredictionContext, PredictionContext> mergeCache) Adding a new config means merging contexts with existing configs for(s, i, pi, _), wheresis theATNConfig.state,iis theATNConfig.alt, andpiis theATNConfig.semanticContext.booleanaddAll(Collection<? extends ATNConfig> coll) voidclear()booleanbooleancontainsAll(Collection<?> c) booleancontainsFast(ATNConfig obj) elements()Return a List holding list of configsbooleanget(int i) getAlts()Gets the complete set of represented alternatives for the configuration set.inthashCode()booleanisEmpty()booleaniterator()voidoptimizeConfigs(ATNSimulator interpreter) booleanbooleanremoveAll(Collection<?> c) booleanretainAll(Collection<?> c) voidsetReadonly(boolean readonly) intsize()toArray()<T> T[]toArray(T[] a) toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
spliterator
-
Field Details
-
readonly
protected boolean readonlyIndicates that the set of configurations is read-only. Do not allow any code to manipulate the set; DFA states will point at the sets and they must not change. This does not protect the other fields; in particular, conflictingAlts is set after we've made this readonly. -
configLookup
All configs but hashed by (s, i, _, pi) not including context. Wiped out when we go readonly as this set becomes a DFA state. -
configs
-
uniqueAlt
public int uniqueAlt -
conflictingAlts
Currently this is only used when we detect SLL conflict; this does not necessarily represent the ambiguous alternatives. In fact, I should also point out that this seems to include predicated alternatives that have predicates that evaluate to false. Computed in computeTargetState(). -
hasSemanticContext
public boolean hasSemanticContext -
dipsIntoOuterContext
public boolean dipsIntoOuterContext -
fullCtx
public final boolean fullCtxIndicates that this configuration set is part of a full context LL prediction. It will be used to determine how to merge $. With SLL it's a wildcard whereas it is not for LL context merge.
-
-
Constructor Details
-
ATNConfigSet
public ATNConfigSet(boolean fullCtx) -
ATNConfigSet
public ATNConfigSet() -
ATNConfigSet
-
-
Method Details
-
add
-
add
public boolean add(ATNConfig config, DoubleKeyMap<PredictionContext, PredictionContext, PredictionContext> mergeCache) Adding a new config means merging contexts with existing configs for(s, i, pi, _), wheresis theATNConfig.state,iis theATNConfig.alt, andpiis theATNConfig.semanticContext. We use(s,i,pi)as key.This method updates
dipsIntoOuterContextandhasSemanticContextwhen necessary. -
elements
-
getStates
-
getAlts
Gets the complete set of represented alternatives for the configuration set.- Returns:
- the set of represented alternatives in this configuration set
- Since:
- 4.3
-
getPredicates
-
get
-
optimizeConfigs
-
addAll
-
equals
-
hashCode
-
size
-
isEmpty
-
contains
-
containsFast
-
iterator
-
clear
-
isReadonly
public boolean isReadonly() -
setReadonly
public void setReadonly(boolean readonly) -
toString
-
toArray
-
toArray
-
remove
-
containsAll
- Specified by:
containsAllin interfaceCollection<ATNConfig>- Specified by:
containsAllin interfaceSet<ATNConfig>
-
retainAll
-
removeAll
-