/** * * 异常处理 */ public function throwException($msg = '', $detail = true) { $ext = ' at line:' . ($this->line + 1) . ', col:' . ($this->col + 1) . ', pos:' . $this->pos; if ($detail) { $msg .= $ext; } parent::throwException($msg, -1); }
/** * * 获取结束标签的名字 * @param string $endTag */ public static function getEndTagName($endTag = '', Fl_Base $instance) { preg_match(self::$endTagNamePattern, $endTag, $matches); if (is_array($matches) && $matches[1]) { return $matches[1]; } $instance->throwException('analytic end tag error'); }
/** * * 获取开始或者结束标签的名字 * @param string $tag */ public static function getTagName($tag = '', Fl_Base $instance) { preg_match(self::$getTagNamePattern, $tag, $matches); if (is_array($matches) && $matches[1]) { return $matches[1]; } $instance->throwException('get tagName error in `' . $tag . '`'); }
/** * * 异常处理 */ public function throwException($msg = '') { $ext = ' at line:' . ($this->line + 1) . ', col:' . ($this->col + 1) . ', pos:' . $this->pos; parent::throwException($msg . $ext, $code); }
/** * * 抛出token的相关异常 */ public function throwException($msg = '', $token = false) { if ($token === false) { $token = $this->currentToken; } $ext = ' at line:' . strval($token['tokline']) . ', col:' . $token['tokcol'] . ', pos:' . $token['tokpos']; parent::throwException($msg . $ext); }