lessc_parser::tagBracket PHP Method

tagBracket() protected method

a bracketed value (contained within in a tag definition)
protected tagBracket ( &$parts, &$hasExpression )
    protected function tagBracket(&$parts, &$hasExpression)
    {
        // speed shortcut
        if (isset($this->buffer[$this->count]) && $this->buffer[$this->count] != "[") {
            return false;
        }
        $s = $this->seek();
        $hasInterpolation = false;
        if ($this->literal("[", false)) {
            $attrParts = array("[");
            // keyword, string, operator
            while (true) {
                if ($this->literal("]", false)) {
                    $this->count--;
                    break;
                    // get out early
                }
                if ($this->match('\\s+', $m)) {
                    $attrParts[] = " ";
                    continue;
                }
                if ($this->string($str)) {
                    // escape parent selector, (yuck)
                    foreach ($str[2] as &$chunk) {
                        $chunk = str_replace($this->lessc->parentSelector, "\$&\$", $chunk);
                    }
                    $attrParts[] = $str;
                    $hasInterpolation = true;
                    continue;
                }
                if ($this->keyword($word)) {
                    $attrParts[] = $word;
                    continue;
                }
                if ($this->interpolation($inter, false)) {
                    $attrParts[] = $inter;
                    $hasInterpolation = true;
                    continue;
                }
                // operator, handles attr namespace too
                if ($this->match('[|-~\\$\\*\\^=]+', $m)) {
                    $attrParts[] = $m[0];
                    continue;
                }
                break;
            }
            if ($this->literal("]", false)) {
                $attrParts[] = "]";
                foreach ($attrParts as $part) {
                    $parts[] = $part;
                }
                $hasExpression = $hasExpression || $hasInterpolation;
                return true;
            }
            $this->seek($s);
        }
        $this->seek($s);
        return false;
    }