/** * @param $token * @param $i * @param array $tokens */ protected function formatDashToken($token, $i, array &$tokens) { if (Token::tokenIsMinusSign($token, $tokens, $i)) { $previousTokenType = $tokens[$i - 1][Tokenizer::TOKEN_TYPE]; if (WhiteSpace::tokenIsNumberAndHasExtraWhiteSpaceRight($previousTokenType)) { $this->formattedSql = rtrim($this->formattedSql, ' '); } } }
/** * Builds all the regular expressions needed to Tokenize the input. */ public function __construct() { $reservedMap = array_combine(Token::$reserved, array_map('strlen', Token::$reserved)); arsort($reservedMap); Token::$reserved = array_keys($reservedMap); $this->regexFunction = $this->initRegex(Token::$functions); $this->regexBoundaries = $this->initRegex(Token::$boundaries); $this->regexReserved = $this->initRegex(Token::$reserved); $this->regexReservedTopLevel = str_replace(' ', '\\s+', $this->initRegex(Token::$reservedTopLevel)); $this->regexReservedNewLine = str_replace(' ', '\\s+', $this->initRegex(Token::$reservedNewLine)); }