Esempio n. 1
0
 public function expectAny($typeArr, $at = 0)
 {
     $p = $this->pos + $at;
     if (isset($this->tokens[$p])) {
         $t = $this->tokens[$p];
         if (!in_array($t->type, $typeArr, true)) {
             $tokenType = [];
             foreach ($typeArr as $type) {
                 $tokenType[] = SyntaxMap::$map[$type];
             }
             $tokenTypeStr = implode(",", $tokenType);
             throw ParserException::expectedToken($t, $tokenTypeStr);
         }
         return $t;
     }
     throw ParserException::indexOutOfRange($p);
 }