/**
  * Constructs a new missing value exception.
  *
  * @param \PDepend\Source\Tokenizer\Tokenizer $tokenizer
  */
 public function __construct(Tokenizer $tokenizer)
 {
     // Get wrong token
     $token = $tokenizer->next();
     // The parser must take care for this
     assert($token instanceof Token);
     $message = sprintf('Missing default value on line: %d, col: %d, file: %s.', $token->startLine, $token->startColumn, $tokenizer->getSourceFile());
     parent::__construct($message);
 }
 /**
  * Constructor.
  *
  * @param Stream     $stream
  * @param Token|null $expected
  */
 public function __construct(Stream $stream, Token $expected = null)
 {
     $this->actual = $stream->current();
     $this->expected = $expected;
     $this->tokenLine = $this->actual->getLine();
     $message = sprintf('Unexpected token %s at line %d ("%s").', (string) $this->actual, $this->tokenLine, $stream->humanize());
     if ($this->expected !== null) {
         $message = sprintf('%s Expects token %s.', $message, (string) $this->expected);
     }
     parent::__construct($message);
 }
 /**
  * Constructs a new unexpected token exception.
  *
  * @param \pdepend\reflection\parser\Token $token    The unexpected token.
  * @param string                           $fileName The parsed source file.
  */
 public function __construct(Token $token, $fileName)
 {
     parent::__construct(sprintf('Unexpected token[image="%s", type=%d] on line %d in file %s', $token->image, $token->type, $token->startLine, $fileName));
 }
 /**
  * Constructs a new invalid state exception.
  *
  * @param integer $lineNumber Line number where the parser has stopped.
  * @param string  $fileName   The source file where this exception occured.
  * @param string  $reason     Short description what has happend.
  */
 public function __construct($lineNumber, $fileName, $reason)
 {
     parent::__construct(sprintf('The parser has reached an invalid state near line "%d" in file ' . '"%s". Please check the following conditions: %s', $lineNumber, $fileName, $reason));
 }
 /**
  * Constructs a new exception instance.
  *
  * @param string $fileName Name of the currently parsed file.
  */
 public function __construct($fileName)
 {
     parent::__construct('Unexpected end of token stream in file ' . $fileName);
 }