Beispiel #1
0
 function getOffset($i)
 {
     $tokens = NString::split($this->input, $this->re, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_OFFSET_CAPTURE);
     list(, $offset) = $tokens[$i];
     return array($offset, $offset ? substr_count($this->input, "\n", 0, $offset) + 1 : 1, $offset - strrpos(substr($this->input, 0, $offset), "\n"));
 }
Beispiel #2
0
 private function error()
 {
     $tokens = NString::split($this->input, self::$regexp, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_OFFSET_CAPTURE);
     list($token, $offset) = $tokens[$this->n];
     $line = substr_count($this->input, "\n", 0, $offset) + 1;
     $col = $offset - strrpos(substr($this->input, 0, $offset), "\n");
     throw new Exception('NEON parse error: unexpected ' . str_replace("\n", '\\n', substr($token, 0, 10)) . " on line {$line}, column {$col}.");
 }