Class LexerATNSimulator

java.lang.Object
org.antlr.v4.runtime.atn.ATNSimulator
org.antlr.v4.runtime.atn.LexerATNSimulator

public class LexerATNSimulator extends ATNSimulator
ATN interpreter for lexers. Builds and consults a per-mode DFA cache while falling back to ATN simulation for unseen edges.

PERF: Reach config sets are retained on the simulator and cleared between edge computations so the common DFA-fill path avoids per-character OrderedATNConfigSet allocation. Clear of the retained pool is occupancy-aware (see ATNConfigSet.clear() / RetainedConfigSet): empty clear is O(1) for the merge map (no bulk Arrays.fill); non-empty clear nulls only the used list prefix and, when few configs remain in a grown open-addressed table, removes known merge keys (O(n)) instead of filling the full table capacity. Obtain/release under computeTargetState(org.antlr.v4.runtime.CharStream, org.antlr.v4.runtime.dfa.DFAState, int) therefore does not pay repeated full-capacity zeroing. A single lexer (and its simulator) is not used concurrently for matching, so reuse is safe. Stored DFA states always receive a readonly ATNConfigSet.clone(boolean) of the reach set, never the reusable buffer itself.