/** * Sets the callback for the current rule. * * @param callable $callback The callback. * * @return \Dissect\Parser\Grammar This instance. */ public function call($callback) { if ($this->currentRule === null) { throw new LogicException('You must specify a rule first.'); } $this->currentRule->setCallback($callback); return $this; }