FOF30\Less\Parser\Parser::tag PHP Method

tag() protected method

A single tag
protected tag ( &$tag, boolean $simple = false ) : boolean
$simple boolean [description]
return boolean
    protected function tag(&$tag, $simple = false)
    {
        if ($simple) {
            $chars = '^@,:;{}\\][>\\(\\) "\'';
        } else {
            $chars = '^@,;{}["\'';
        }
        $s = $this->seek();
        if (!$simple && $this->tagExpression($tag)) {
            return true;
        }
        $hasExpression = false;
        $parts = array();
        while ($this->tagBracket($first)) {
            $parts[] = $first;
        }
        $oldWhite = $this->eatWhiteDefault;
        $this->eatWhiteDefault = false;
        while (true) {
            if ($this->match('([' . $chars . '0-9][' . $chars . ']*)', $m)) {
                $parts[] = $m[1];
                if ($simple) {
                    break;
                }
                while ($this->tagBracket($brack)) {
                    $parts[] = $brack;
                }
                continue;
            }
            if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] == "@") {
                if ($this->interpolation($interp)) {
                    $hasExpression = true;
                    // Don't unescape
                    $interp[2] = true;
                    $parts[] = $interp;
                    continue;
                }
                if ($this->literal("@")) {
                    $parts[] = "@";
                    continue;
                }
            }
            // For keyframes
            if ($this->unit($unit)) {
                $parts[] = $unit[1];
                $parts[] = $unit[2];
                continue;
            }
            break;
        }
        $this->eatWhiteDefault = $oldWhite;
        if (!$parts) {
            $this->seek($s);
            return false;
        }
        if ($hasExpression) {
            $tag = array("exp", array("string", "", $parts));
        } else {
            $tag = trim(implode($parts));
        }
        $this->whitespace();
        return true;
    }