/** * Constructs a new unexpected token exception. * * @param PHP_Depend_TokenizerI $tokenizer The context tokenizer instance. */ public function __construct(PHP_Depend_TokenizerI $tokenizer) { // Get wrong token $token = $tokenizer->next(); // The parser must take care for this assert($token instanceof PHP_Depend_Token); $message = sprintf('Unexpected token: %s, line: %d, col: %d, file: %s.', $token->image, $token->startLine, $token->startColumn, $tokenizer->getSourceFile()); parent::__construct($message); }
/** * Constructs a new end of token stream exception. * * @param PHP_Depend_TokenizerI $tokenizer The context tokenizer instance. */ public function __construct(PHP_Depend_TokenizerI $tokenizer) { parent::__construct(sprintf('Unexpected end of token stream in file: %s.', $tokenizer->getSourceFile())); }
/** * Constructs a new unexpected token exception. * * @param PHP_Depend_Token $token The last parsed token instance. * @param string $fileName The file where the exception occured. */ public function __construct(PHP_Depend_Token $token, $fileName) { $message = sprintf('Unexpected token: %s, line: %d, col: %d, file: %s.', $token->image, $token->startLine, $token->startColumn, $fileName); parent::__construct($message); }