/** * 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 Tokenizer $tokenizer * @param string $string */ public static function isComment(Tokenizer $tokenizer, $string) { if (!$tokenizer->getNextToken() && Comment::isCommentString($string)) { $tokenizer->setNextToken(Comment::getCommentString($string)); } }