FOF30\Less\Parser\Parser::parse PHP Method

parse() public method

Parse text
public parse ( string $buffer ) : [type]
$buffer string [description]
return [type]
    public function parse($buffer)
    {
        $this->count = 0;
        $this->line = 1;
        // Block stack
        $this->env = null;
        $this->buffer = $this->writeComments ? $buffer : $this->removeComments($buffer);
        $this->pushSpecialBlock("root");
        $this->eatWhiteDefault = true;
        $this->seenComments = array();
        /*
         * trim whitespace on head
         * if (preg_match('/^\s+/', $this->buffer, $m)) {
         * 	$this->line += substr_count($m[0], "\n");
         * 	$this->buffer = ltrim($this->buffer);
         * }
         */
        $this->whitespace();
        // Parse the entire file
        $lastCount = $this->count;
        while (false !== $this->parseChunk()) {
        }
        if ($this->count != strlen($this->buffer)) {
            $this->throwError();
        }
        // TODO report where the block was opened
        if (!is_null($this->env->parent)) {
            throw new exception('parse error: unclosed block');
        }
        return $this->env;
    }