blob: f5f0272625f31919be7f3636013b915684159561 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
<?php
namespace kch42\ste;
class ParseCompileError extends \Exception
{
public $msg;
public $tpl;
public $off;
public function __construct($msg, $tpl, $offset, $code = 0, $previous = null)
{
$this->msg = $msg;
$this->tpl = $tpl;
$this->off = $offset;
$this->message = "$msg (Template $tpl, Offset $offset)";
}
public function rewrite($code)
{
$line = substr_count(str_replace("\r\n", "\n", substr($code, 0, $this->off)), "\n") + 1;
$this->message = "{$this->msg} (Template {$this->tpl}, Line $line)";
$this->is_rewritten = true;
}
}
|