コード例 #1
0
ファイル: epParser.php プロジェクト: justinlyon/scc
 /**
  * Raise an error message.
  * 
  * The error message is stored in an array that can be 
  * retrieved later.
  * 
  * This method can also be used to retrieve the curernt 
  * error if you don't give any argument. 
  * 
  * @param string $msg
  * @return epQueryError
  */
 protected function error($msg = '')
 {
     // if empty message, return the current error
     if (!$msg) {
         return $this->_error;
     }
     // create a new error object
     $v = '';
     $l = 0;
     $c = 0;
     if ($this->t) {
         $v = $this->t->value;
         $l = $this->t->line;
         $c = $this->t->char;
     }
     $this->_error = new epLexerError($msg, $v, $l, $c);
     // keep all errors
     $this->errors[] = $this->_error;
     // print out error message
     $emsg = $msg . ' at EOF';
     if ($this->t && $this->t->type !== false) {
         $emsg = $this->_error->__toString();
     }
     $this->message("Error: {$emsg}");
     // return this error
     return $this->_error;
 }
コード例 #2
0
 /**
  * Raise an error message.
  * 
  * The error message is stored in an array that can be 
  * retrieved later.
  * 
  * This method can also be used to retrieve the curernt 
  * error if you don't give any argument. 
  * 
  * @param string $msg
  * @return epQueryError
  */
 protected function error($msg = '')
 {
     // if empty message, return the current error
     if (!$msg) {
         return $this->_error;
     }
     // create a new error object
     if ($this->t) {
         $this->_error = new epQueryError($msg, $this->t->value, $this->t->line, $this->t->char);
     } else {
         $this->_error = new epQueryError($msg, '', 0, 0);
     }
     // keep all errors
     $this->errors[] = $this->_error;
     // print out error message
     $emsg = $msg . ' at EOF';
     if ($this->t && $this->t->type !== false) {
         $emsg = $this->_error->__toString();
     }
     $this->message("Error: {$emsg}");
     // return this error
     return $this->_error;
 }