/**
  * Gets a printable message.
  *
  * This function provides a method to get printable messages.
  *
  * @return string
  */
 public function getPrintableMessage()
 {
     $ret = $this->message;
     if ($this->_parser != null) {
         $string = rtrim($this->_parser->getString());
         $offset = $this->_parser->getOffset();
         $rightStr = substr($string, $offset);
         $offset0 = $offset + strlen($rightStr) - strlen(ltrim($rightStr));
         $str1 = substr($string, 0, $offset0);
         $offset1 = strrpos($str1, "\n");
         if ($offset1 !== false) {
             $offset1++;
         }
         $str2 = substr($string, $offset1);
         $offset2 = strpos($str2, "\n");
         if ($offset2 === false) {
             $offset2 = strlen($str2);
         }
         $str3 = substr($str2, 0, $offset2);
         $line = $offset0 > 0 ? substr_count($string, "\n", 0, $offset0) : 0;
         $column = $offset0 - $offset1;
         $ret = "{$str3}\n" . str_repeat(" ", $column) . "^" . $this->message;
         if ($line > 0) {
             $ret .= " (line " . ($line + 1) . ")";
         }
     }
     return $ret;
 }
 /**
  * Constructor.
  *
  * @param string|TextParser $target Target object
  * @param integer           $flags  Flags (default is 0, accepts: TextParser::UNGREEDY)
  */
 public function __construct($target, $flags = 0)
 {
     $this->_target = $target;
     $this->_flags = $flags;
     if ($this->_target instanceof TextParser) {
         parent::__construct($target->getString(), $flags);
         $this->offset = $target->getOffset();
     } else {
         parent::__construct($target, $flags);
     }
 }