atn = $atn; $this->sharedContextCache = $sharedContextCache; } public static function error() : DFAState { static $error; return $error ?? ($error = new DFAState(new ATNConfigSet(), 0x7FFFFFFF)); } abstract public function reset() : void; /** * Clear the DFA cache used by the current instance. Since the DFA cache * may be shared by multiple ATN simulators, this method may affect the * performance (but not accuracy) of other parsers which are being used * concurrently. * * @throws \InvalidArgumentException If the current instance does not * support clearing the DFA. */ public function clearDFA() : void { throw new \InvalidArgumentException('This ATN simulator does not support clearing the DFA.'); } public function getSharedContextCache() : PredictionContextCache { return $this->sharedContextCache; } public function getCachedContext(PredictionContext $context) : PredictionContext { if ($this->sharedContextCache === null) { return $context; } $visited = []; return PredictionContext::getCachedPredictionContext( $context, $this->sharedContextCache, $visited ); } }