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