Beispiel #1
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);
     }
 }
Beispiel #2
0
 /**
  * @param Tokenizer  $tokenizer
  * @param string     $string
  * @param array|null $previous
  *
  * @return array
  */
 public static function isReserved(Tokenizer $tokenizer, $string, $previous)
 {
     $tokenData = [];
     if (!$tokenizer->getNextToken() && self::isReservedPrecededByDotCharacter($previous)) {
         $upperCase = \strtoupper($string);
         self::getReservedString($tokenData, Tokenizer::TOKEN_TYPE_RESERVED_TOP_LEVEL, $string, $tokenizer);
         self::getReservedString($tokenData, Tokenizer::TOKEN_TYPE_RESERVED_NEWLINE, $upperCase, $tokenizer);
         self::getReservedString($tokenData, Tokenizer::TOKEN_TYPE_RESERVED, $string, $tokenizer);
         $tokenizer->setNextToken($tokenData);
     }
 }
Beispiel #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));
     }
 }
Beispiel #4
0
 /**
  * @param Tokenizer $tokenizer
  * @param string    $string
  */
 public static function isQuoted(Tokenizer $tokenizer, $string)
 {
     if (!$tokenizer->getNextToken() && self::isQuotedString($string)) {
         $tokenizer->setNextToken(self::getQuotedString($string));
     }
 }
Beispiel #5
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));
     }
 }
Beispiel #6
0
 /**
  * @param Tokenizer $tokenizer
  * @param string    $string
  */
 public static function isComment(Tokenizer $tokenizer, $string)
 {
     if (!$tokenizer->getNextToken() && self::isCommentString($string)) {
         $tokenizer->setNextToken(self::getCommentString($string));
     }
 }
Beispiel #7
0
 /**
  * @param Tokenizer $tokenizer
  * @param string    $string
  *
  * @return array
  */
 public static function isUserDefinedVariable(Tokenizer $tokenizer, $string)
 {
     if (!$tokenizer->getNextToken() && self::isUserDefinedVariableString($string)) {
         $tokenizer->setNextToken(self::getUserDefinedVariableString($string));
     }
 }