ATNConfigSet

Specialized {@link Set}{@code <}{@link ATNConfig}{@code >} that can track info about the set, with support for combining similar configurations using a graph-structured stack.

The reason that we need this is because we don't want the hash map to use the standard hash code and equals. We need all configurations with the same {@code (s,i,_,semctx)} to be equal. Unfortunately, this key effectively doubles the number of objects associated with ATNConfigs. The other solution is to use a hash table that lets us specify the equals/hashcode operation.

Constructors

this
this(bool fullCtx)
Undocumented in source.
this
this()
Undocumented in source.
this
this(ATNConfigSet old)
Undocumented in source.

Members

Classes

ConfigEqualityComparator
class ConfigEqualityComparator

TODO add class description

ConfigHashSet
class ConfigHashSet

The reason that we need this is because we don't want the hash map to use the standard hash code and equals. We need all configurations with the same {@code (s,i,_,semctx)} to be equal. Unfortunately, this key effectively doubles the number of objects associated with ATNConfigs. The other solution is to use a hash table that lets us specify the equals/hashcode operation.

Functions

add
bool add(ATNConfig config)
Undocumented in source. Be warned that the author may not have intended to support it.
add
bool add(ATNConfig config, DoubleKeyMap!(PredictionContext, PredictionContext, PredictionContext) mergeCache)

Adding a new config means merging contexts with existing configs for {@code (s, i, pi, _)}, where {@code s} is the {@link ATNConfig#state}, {@code i} is the {@link ATNConfig#alt}, and {@code pi} is the {@link ATNConfig#semanticContext}. We use {@code (s,i,pi)} as key.

addAll
bool addAll(ATNConfig[] coll)
Undocumented in source. Be warned that the author may not have intended to support it.
clear
void clear()
Undocumented in source. Be warned that the author may not have intended to support it.
contains
bool contains(ATNConfig o)
Undocumented in source. Be warned that the author may not have intended to support it.
containsFast
bool containsFast(ATNConfig obj)
Undocumented in source. Be warned that the author may not have intended to support it.
elements
ATNConfig[] elements()

@uml Return a List holding list of configs

get
ATNConfig get(int i)
Undocumented in source. Be warned that the author may not have intended to support it.
getAlts
BitSet getAlts()

@uml Gets the complete set of represented alternatives for the configuration set.

getPredicates
SemanticContext[] getPredicates()
Undocumented in source. Be warned that the author may not have intended to support it.
getStates
ATNState[] getStates()
Undocumented in source. Be warned that the author may not have intended to support it.
isEmpty
bool isEmpty()
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(Object o)

@uml @override

optimizeConfigs
void optimizeConfigs(InterfaceATNSimulator interpreter)
Undocumented in source. Be warned that the author may not have intended to support it.
readonly
void readonly(bool readonly)
Undocumented in source. Be warned that the author may not have intended to support it.
readonly
bool readonly()
Undocumented in source. Be warned that the author may not have intended to support it.
size
int size()
Undocumented in source. Be warned that the author may not have intended to support it.
toHash
size_t toHash()

@uml @override @safe @nothrow

toString
string toString()

@uml @override

Static functions

equals
bool equals(Object aObj, Object bObj)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

configLookup
AbstractConfigHashSet configLookup;
Undocumented in source.
configs
ATNConfig[] configs;

@uml Track the elements as they are added to the set; supports get(i)

conflictingAlts
BitSet conflictingAlts;

@uml 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().

dipsIntoOuterContext
bool dipsIntoOuterContext;
Undocumented in source.
fullCtx
bool fullCtx;

@uml Indicates 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. @final

hasSemanticContext
bool hasSemanticContext;

@uml Used in parser and lexer. In lexer, it indicates we hit a pred while computing a closure operation. Don't make a DFA state from this.

readonly_
bool readonly_;

@uml Indicates 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. @read

uniqueAlt
int uniqueAlt;

@uml TODO: these fields make me pretty uncomfortable but nice to pack up info together, saves recomputation TODO: can we track conflicts as they are added to save scanning configs later?

Meta