Lines Matching refs:state
338 foreach ($atn->states as $state) {
339 if (!$state instanceof RuleStopState) {
343 $atn->ruleToStopState[$state->ruleIndex] = $state;
344 $atn->ruleToStartState[$state->ruleIndex]->stopState = $state;
409 foreach ($atn->states as $state) {
410 foreach ($state->getTransitions() as $t) {
427 foreach ($atn->states as $state) {
428 if ($state instanceof BlockStartState) {
430 if ($state->endState === null) {
435 if ($state->endState->startState !== null) {
439 $state->endState->startState = $state;
442 if ($state instanceof PlusLoopbackState) {
443 foreach ($state->getTransitions() as $t) {
447 $target->loopBackState = $state;
450 } elseif ($state instanceof StarLoopbackState) {
451 foreach ($state->getTransitions() as $t) {
455 $target->loopBackState = $state;
536 foreach ($atn->states as $state) {
537 if ($this->stateIsEndStateFor($state, $idx)) {
538 $endState = $state;
540 if (!$state instanceof LoopEndState) {
544 if ($state->loopBackState === null) {
548 $excludeTransition = $state->loopBackState->getTransition(0);
563 foreach ($atn->states as $state) {
564 foreach ($state->getTransitions() as $transition) {
599 private function stateIsEndStateFor(ATNState $state, int $idx) : ?ATNState argument
601 if ($state->ruleIndex !== $idx) {
605 if (!$state instanceof StarLoopEntryState) {
609 $maybeLoopEndState = $state->getTransition($state->getNumberOfTransitions() - 1)->target;
617 return $state;
632 foreach ($atn->states as $state) {
633 if (!$state instanceof StarLoopEntryState) {
640 if ($atn->ruleToStartState[$state->ruleIndex]->isLeftRecursiveRule) {
641 … $maybeLoopEndState = $state->getTransition($state->getNumberOfTransitions() - 1)->target;
646 $state->isPrecedenceDecision = true;
660 foreach ($atn->states as $state) {
661 … $this->checkCondition($state->epsilonOnlyTransitions || $state->getNumberOfTransitions() <= 1);
664 case $state instanceof PlusBlockStartState:
665 $this->checkCondition($state->loopBackState !== null);
669 case $state instanceof StarLoopEntryState:
670 $this->checkCondition($state->loopBackState !== null);
671 $this->checkCondition($state->getNumberOfTransitions() === 2);
673 if ($state->getTransition(0)->target instanceof StarBlockStartState) {
674 … $this->checkCondition($state->getTransition(1)->target instanceof LoopEndState);
675 $this->checkCondition(!$state->nonGreedy);
676 } elseif ($state->getTransition(0)->target instanceof LoopEndState) {
677 … $this->checkCondition($state->getTransition(1)->target instanceof StarBlockStartState);
678 $this->checkCondition($state->nonGreedy);
685 case $state instanceof StarLoopbackState:
686 $this->checkCondition($state->getNumberOfTransitions() === 1);
687 … $this->checkCondition($state->getTransition(0)->target instanceof StarLoopEntryState);
691 case $state instanceof LoopEndState:
692 $this->checkCondition($state->loopBackState !== null);
696 case $state instanceof RuleStartState:
697 $this->checkCondition($state->stopState !== null);
701 case $state instanceof BlockStartState:
702 $this->checkCondition($state->endState !== null);
706 case $state instanceof BlockEndState:
707 $this->checkCondition($state->startState !== null);
711 case $state instanceof DecisionState:
712 … $this->checkCondition($state->getNumberOfTransitions() <= 1 || $state->decision >= 0);
717 … $this->checkCondition($state->getNumberOfTransitions() <= 1 || $state instanceof RuleStopState);