/** * @param PaccSet<PaccLRItem> * @param PaccSymbol * @return PaccSet<PaccLRItem> */ private function jump(PaccSet $items, PaccSymbol $symbol) { if ($items->getType() !== 'PaccLRItem') { throw new InvalidArgumentException('Bad type - expected PaccSet<LRItem>, given PaccSet<' . $items->getType() . '>.'); } $ret = new PaccSet('PaccLRItem'); foreach ($items as $item) { if (!(current($item->afterDot()) !== FALSE && current($item->afterDot())->__eq($symbol))) { continue; } $ret->add(new PaccLRItem($item->production, $item->dot + 1, $item->terminalindex)); } return $this->closure($ret); }