/** * Constructor. * * @param \Dissect\Parser\Rule $rule The conflicting grammar rule. * @param string $lookahead The conflicting lookahead to shift. * @param \Dissect\Parser\LALR1\Analysis\Automaton $automaton The faulty automaton. */ public function __construct($state, Rule $rule, $lookahead, Automaton $automaton) { $components = $rule->getComponents(); parent::__construct(sprintf(self::MESSAGE, $rule->getNumber(), $rule->getName(), empty($components) ? '/* empty */' : implode(' ', $components), $lookahead, $state), $state, $automaton); $this->rule = $rule; $this->lookahead = $lookahead; }
/** * Returns all components that haven't been recognized * so far. * * @return array The unrecognized components. */ public function getUnrecognizedComponents() { return array_slice($this->rule->getComponents(), $this->dotIndex + 1); }