/** * @param Input $input * @return Result */ public function parse(Input $input) { $result = $this->parser->parse($input)->addParser($this); // Don't call the callback if there was an error. if ($result->errorMessage) { return $result; } $result->data = call_user_func($this->function, $result, $input); return $result; }
/** * @return File */ public function parse($input) { $result = $this->rootParser->parse(new Input($input)); if ($result->errorMessage) { throw new ParseException($result->errorMessage); } else { return $result->data; } }