You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
680 B
21 lines
680 B
5 years ago
|
<?php
|
||
4 years ago
|
/** @license MIT
|
||
|
* Copyright 2017 , Dustin Wilson, J. King et al.
|
||
|
* See LICENSE and AUTHORS files for details */
|
||
|
|
||
5 years ago
|
declare(strict_types=1);
|
||
4 years ago
|
namespace MensBeam\HTML;
|
||
5 years ago
|
|
||
|
trait ParseErrorEmitter {
|
||
|
/** @var ParseError $errorHandler */
|
||
|
private $errorHandler;
|
||
|
|
||
|
private function error(int $code, ...$arg): bool {
|
||
|
$data = ($this instanceof Data) ? $this : ($this->data ?? null);
|
||
5 years ago
|
assert($data instanceof Data);
|
||
|
assert($this->errorHandler instanceof ParseError);
|
||
4 years ago
|
list($line, $column) = $data->whereIs(ParseError::REPORT_OFFSETS[$code] ?? 0);
|
||
5 years ago
|
return $this->errorHandler->emit($data->filePath, $line, $column, $code, ...$arg);
|
||
5 years ago
|
}
|
||
|
}
|