/**
  * @param Token $invalidToken
  * @param $expectedType
  *
  * @return string
  */
 public function invalidTokenAtPosition(Token $invalidToken, $expectedType)
 {
     $msgTemplate = 'invalid token type %s at line %s, column %s. expected token type %s';
     $msg = sprintf($msgTemplate, $invalidToken->getType(), $invalidToken->getPosition()->getLine(), $invalidToken->getPosition()->getColumn(), $expectedType);
     return $msg;
 }
Esempio n. 2
0
 /**
  * @param Token $token
  * @param int $type
  * @param string $value
  *
  * @return bool
  */
 public function hasSameTypeAndValue(Token $token, $type, $value)
 {
     return $token->getType() === $type && $token->getValue() === $value;
 }