public function string($s = null) { if ($s !== null) { $this->subscanner->string($s); $this->phpScanner->string($s); } return parent::string($s); }
public function string($string = null) { if ($string !== null) { if (preg_match('/^[><]/m', $string)) { // normal rules $this->patterns['range'] = '/\\d+.*/'; $this->patterns['codeblock'] = "/(^([<> ]).*(\n)?)+/m"; } elseif (preg_match('/^\\*{3}/m', $string)) { // context $this->patterns['range'] = "/([\\-\\*]{3})[ \t]+\\d+,\\d+[ \t]+\\1.*/"; $this->patterns['codeblock'] = "/(^([!+ ]).*(\n)?)+/m"; } else { // unified $this->patterns['range'] = "/@@.*/"; $this->patterns['codeblock'] = "/(^([+\\- ]).*(\n)?)+/m"; } } return parent::string($string); }