/** * Return the next token and token type in a SQL string. * Quoted strings, comments, reserved words, whitespace, and punctuation are all their own tokens. * * @param string $string The SQL string * @param array $previous The result of the previous parseNextToken() call * * @return array An associative array containing the type and value of the token. */ protected function parseNextToken($string, $previous = null) { $matches = array(); $this->nextToken = array(); WhiteSpace::isWhiteSpace($this, $string, $matches); Comment::isComment($this, $string); Quoted::isQuoted($this, $string); UserDefined::isUserDefinedVariable($this, $string); Numeral::isNumeral($this, $string, $matches); Boundary::isBoundary($this, $string, $matches); Reserved::isReserved($this, $string, $previous); LiteralString::isFunction($this, $string, $matches); LiteralString::getNonReservedString($this, $string, $matches); return $this->nextToken; }
/** * @param array $returnData * @param string $string */ protected static function setTokenValueStartingWithAtSymbolAndWrapped(array &$returnData, $string) { if (!empty($string[1]) && ($string[1] === '"' || $string[1] === '\'' || $string[1] === '`')) { $returnData[Tokenizer::TOKEN_VALUE] = '@' . Quoted::wrapStringWithQuotes(\substr($string, 1)); } }