| @@ 3472-3482 (lines=11) @@ | ||
| 3469 | // advance counter to next occurrence of $what |
|
| 3470 | // $until - don't include $what in advance |
|
| 3471 | // $allowNewline, if string, will be used as valid char set |
|
| 3472 | protected function to($what, &$out, $until = false, $allowNewline = false) { |
|
| 3473 | if (is_string($allowNewline)) { |
|
| 3474 | $validChars = $allowNewline; |
|
| 3475 | } else { |
|
| 3476 | $validChars = $allowNewline ? "." : "[^\n]"; |
|
| 3477 | } |
|
| 3478 | if (!$this->match('('.$validChars.'*?)'.lessc::preg_quote($what), $m, !$until)) return false; |
|
| 3479 | if ($until) $this->count -= strlen($what); // give back $what |
|
| 3480 | $out = $m[1]; |
|
| 3481 | return true; |
|
| 3482 | } |
|
| 3483 | ||
| 3484 | // try to match something on head of buffer |
|
| 3485 | protected function match($regex, &$out, $eatWhitespace = null) { |
|
| @@ 3886-3896 (lines=11) @@ | ||
| 3883 | // advance counter to next occurrence of $what |
|
| 3884 | // $until - don't include $what in advance |
|
| 3885 | // $allowNewline, if string, will be used as valid char set |
|
| 3886 | protected function to($what, &$out, $until = false, $allowNewline = false) { |
|
| 3887 | if (is_string($allowNewline)) { |
|
| 3888 | $validChars = $allowNewline; |
|
| 3889 | } else { |
|
| 3890 | $validChars = $allowNewline ? "." : "[^\n]"; |
|
| 3891 | } |
|
| 3892 | if (!$this->match('('.$validChars.'*?)'.$this->preg_quote($what), $m, !$until)) return false; |
|
| 3893 | if ($until) $this->count -= strlen($what); // give back $what |
|
| 3894 | $out = $m[1]; |
|
| 3895 | return true; |
|
| 3896 | } |
|
| 3897 | ||
| 3898 | public function throwParseError($msg = "parse error", $count = null) { |
|
| 3899 | $count = is_null($count) ? $this->count : $count; |
|