/**
  * Constructor.
  *
  * @param \Dissect\Lexer\Token $token The unexpected token.
  * @param string[] $expected The expected token types.
  */
 public function __construct(Token $token, array $expected)
 {
     $this->token = $token;
     $this->expected = $expected;
     if ($token->getValue() !== $token->getType()) {
         $info = $token->getValue() . ' (' . $token->getType() . ')';
     } else {
         $info = $token->getType();
     }
     parent::__construct(sprintf(self::MESSAGE, $info, $token->getLine(), implode(', ', $expected)));
 }
예제 #2
0
 /**
  * {@inheritDoc}
  */
 protected function shouldSkipToken(Token $token)
 {
     return in_array($token->getType(), $this->skipTokens);
 }
예제 #3
0
 /**
  * {@inheritDoc}
  */
 protected function shouldSkipToken(Token $token)
 {
     $state = $this->states[$this->stateStack[count($this->stateStack) - 1]];
     return in_array($token->getType(), $state['skip_tokens']);
 }