/** * @param array $tokenData * @param $type * @param string $string * @param Tokenizer $tokenizer */ protected static function getReservedString(array &$tokenData, $type, $string, Tokenizer $tokenizer) { $matches = []; $method = self::$regex[$type]; if (empty($tokenData) && self::isReservedString($string, $matches, $tokenizer->{$method}(), $tokenizer->getRegexBoundaries())) { $tokenData = self::getStringTypeArray($type, $string, $matches); } }
/** * @param Tokenizer $tokenizer * @param string $string * @param array $matches */ public static function getNonReservedString(Tokenizer $tokenizer, $string, array &$matches) { if (!$tokenizer->getNextToken()) { $data = []; if (1 == \preg_match('/^(.*?)($|\\s|["\'`]|' . $tokenizer->getRegexBoundaries() . ')/', $string, $matches)) { $data = [Tokenizer::TOKEN_VALUE => $matches[1], Tokenizer::TOKEN_TYPE => Tokenizer::TOKEN_TYPE_WORD]; } $tokenizer->setNextToken($data); } }
/** * @param Tokenizer $tokenizer * @param string $string * @param array $matches */ public static function isBoundary(Tokenizer $tokenizer, $string, array &$matches) { if (!$tokenizer->getNextToken() && self::isBoundaryCharacter($string, $matches, $tokenizer->getRegexBoundaries())) { $tokenizer->setNextToken(self::getBoundaryCharacter($matches)); } }
/** * @param Tokenizer $tokenizer * @param string $string * @param array $matches * * @return array */ public static function isNumeral(Tokenizer $tokenizer, $string, array &$matches) { if (!$tokenizer->getNextToken() && self::isNumeralString($string, $matches, $tokenizer->getRegexBoundaries())) { $tokenizer->setNextToken(self::getNumeralString($matches)); } }