示例#1
0
 /**
  * @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);
     }
 }
示例#2
0
 /**
  * @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);
     }
 }
示例#3
0
 /**
  * @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));
     }
 }
示例#4
0
 /**
  * @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));
     }
 }