FOF30\Less\Parser\Parser::throwError PHP Method

throwError() public method

[throwError description]
public throwError ( string $msg = "parse error", [type] $count = null ) : void
$msg string [description]
$count [type]
return void
    public function throwError($msg = "parse error", $count = null)
    {
        $count = is_null($count) ? $this->count : $count;
        $line = $this->line + substr_count(substr($this->buffer, 0, $count), "\n");
        if (!empty($this->sourceName)) {
            $loc = "{$this->sourceName} on line {$line}";
        } else {
            $loc = "line: {$line}";
        }
        // TODO this depends on $this->count
        if ($this->peek("(.*?)(\n|\$)", $m, $count)) {
            throw new exception("{$msg}: failed at `{$m['1']}` {$loc}");
        } else {
            throw new exception("{$msg}: {$loc}");
        }
    }

Usage Example

Exemplo n.º 1
0
Arquivo: Less.php Projeto: Joal01/fof
 /**
  * Uses the current value of $this->count to show line and line number
  *
  * @param   type  $msg  X
  *
  * @return  void
  */
 protected function throwError($msg = null)
 {
     if ($this->sourceLoc >= 0) {
         $this->sourceParser->throwError($msg, $this->sourceLoc);
     }
     throw new exception($msg);
 }