/** * Generate a token value. * Complete and set next token namespace. * * @param \Hoa\Compiler\Llk\Rule\Token $token Token. * @return string */ protected function generateToken(Compiler\Llk\Rule\Token $token) { $toNamespace = $this->completeToken($token); $this->setCurrentNamespace($toNamespace); return $this->_tokenSampler->visit($token->getAST()) . ' '; // use skip token @TODO }
/** * Generate a token value. * Complete and set next token namespace. * * @param \Hoa\Compiler\Llk\Rule\Token $token Token. * @return string */ protected function generateToken(Compiler\Llk\Rule\Token $token) { $toNamespace = $this->completeToken($token); $this->setCurrentNamespace($toNamespace); $out = $this->_tokenSampler->visit($token->getAST()); if (isset($this->_tokens[$this->_currentNamespace]['skip'])) { $out .= $this->_tokenSampler->visit($this->getSkipTokenAST()); } return $out; }
private function visitString($string, Visit $visitor, $postprocessing = true) { try { $ast = $this->parser->parse($string); } catch (CompilerException $e) { throw new QueryException('Provided query is not valid', 0, $e); } if ($postprocessing) { $this->fixOperatorAssociativity($ast); } return $visitor->visit($ast); }
/** * Accept a visitor. * * @param \Hoa\Visitor\Visit $visitor Visitor. * @param mixed &$handle Handle (reference). * @param mixed $eldnah Handle (no reference). * @return mixed */ public function accept(Visitor\Visit $visitor, &$handle = null, $eldnah = null) { return $visitor->visit($this, $handle, $eldnah); }