Ejemplo n.º 1
0
 /**
  * Match token and return value
  *
  * @param int $token
  *
  * @return mixed
  * @throws UnexpectedValueException
  */
 private function match($token)
 {
     // If next token isn't type specified throw error
     if (!$this->lexer->isNextToken($token)) {
         throw $this->syntaxError($this->lexer->getLiteral($token));
     }
     // Move lexer to next token
     $this->lexer->moveNext();
     // Return the token value
     return $this->lexer->token['value'];
 }