Lines Matching refs:t

198         $t = $input->LA(1);
209 // be able to avoid doing a reach operation upon t. If s!=null,
210 // it means that semantic predicates didn't prevent us from
212 // the DFA state has an edge already for t. If so, we can just reuse
223 // print("Target for:" + str(s) + " and:" + str(t))
224 $target = $this->getExistingTargetState($s, $t);
227 $target = $this->computeTargetState($input, $s, $t);
238 if ($t !== Token::EOF) {
244 if ($t === Token::EOF) {
249 $t = $input->LA(1);
253 return $this->failOrAccept($this->prevAccept, $input, $s->configs, $t);
262 * @param int $t The next input symbol
265 * `t`, or `null` if the target state for this edg
268 protected function getExistingTargetState(DFAState $s, int $t) : ?DFAState
270 if ($s->edges === null || $t < self::MIN_DFA_EDGE || $t > self::MAX_DFA_EDGE) {
274 $target = $s->edges[$t - self::MIN_DFA_EDGE] ?? null;
289 * @param int $t The next input symbol
292 * `t`. If `t` does not lead to a valid DFA state, this
295 protected function computeTargetState(CharStream $input, DFAState $s, int $t) : DFAState
299 // if we don't find an existing DFA state
300 // Fill reach starting from closure, following t transitions
301 $this->getReachableConfigSet($input, $s->configs, $reach, $t);
304 // we got nowhere on t from s
306 // we got nowhere on t, don't throw out this knowledge; it'd
308 $this->addDFAEdge($s, $t, ATNSimulator::error());
311 // stop when we can't match any more char
316 return $this->addDFAEdgeATNConfigSet($s, $t, $reach) ?? ATNSimulator::error();
319 protected function failOrAccept(SimState $prevAccept, CharStream $input, ATNConfigSet $reach, int $t) : int
343 if ($t === IntStream::EOF && $input->getIndex() === $this->startIndex) {
356 * we can reach upon input `t`. Parameter `reach` is a return parameter.
362 int $t
382 $this->getTokenName($t),
388 $target = $this->getReachableTarget($trans, $t);
397 $treatEofAsEpsilon = ($t === Token::EOF);
439 protected function getReachableTarget(Transition $trans, int $t) : ?ATNState
441 if ($trans->matches($t, Lexer::MIN_CHAR_VALUE, Lexer::MAX_CHAR_VALUE)) {
453 foreach ($p->getTransitions() as $i => $t) {
454 $target = $t->target;
561 Transition $t,
568 switch ($t->getSerializationType()) {
570 if (!$t instanceof RuleTransition) {
574 $newContext = SingletonPredictionContext::create($config->context, $t->followState->stateNumber);
575 $cfg = new LexerATNConfig($config, $t->target, $newContext);
601 if (!$t instanceof PredicateTransition) {
606 $this->log[] = \sprintf('EVAL rule %d:%d', $t->ruleIndex, $t->predIndex);
611 if ($this->evaluatePredicate($input, $t->ruleIndex, $t->predIndex, $speculative)) {
612 $cfg = new LexerATNConfig($config, $t->target);
632 if (!$t instanceof ActionTransition) {
636 $lexerAction = $this->atn->lexerActions[$t->actionIndex];
640 $cfg = new LexerATNConfig($config, $t->target, null, $lexerActionExecutor);
643 $cfg = new LexerATNConfig($config, $t->target);
649 $cfg = new LexerATNConfig($config, $t->target);
657 if ($t->matches(Token::EOF, 0, Lexer::MAX_CHAR_VALUE)) {
658 $cfg = new LexerATNConfig($config, $t->target);
727 protected function addDFAEdgeATNConfigSet(DFAState $from, int $t, ATNConfigSet $configs) : DFAState
749 $this->addDFAEdge($from, $t, $to);
754 protected function addDFAEdge(DFAState $from, int $t, ?DFAState $to) : void
757 if ($t < self::MIN_DFA_EDGE || $t > self::MAX_DFA_EDGE) {
763 $this->log[] = \sprintf('EDGE %s->%s upon %d', $from, $to, $t);
771 $from->edges[$t - self::MIN_DFA_EDGE] = $to; // connect
775 * Add a new DFA state if there isn't one with this set of configurations
838 // index is first lookahead char, don't include.
856 public function getTokenName(int $t) : ?string
858 if ($t === -1) {
862 return \sprintf('\'%s\'', StringUtils::char($t));