Leafo\ScssPhp\Parser::interpolation PHP Method

interpolation() protected method

Parser interpolation
protected interpolation ( array &$out, boolean $lookWhite = true ) : boolean
$out array
$lookWhite boolean save information about whitespace before and after
return boolean
    protected function interpolation(&$out, $lookWhite = true)
    {
        $oldWhite = $this->eatWhiteDefault;
        $this->eatWhiteDefault = true;
        $s = $this->seek();
        if ($this->literal('#{') && $this->valueList($value) && $this->literal('}', false)) {
            if ($lookWhite) {
                $left = preg_match('/\\s/', $this->buffer[$s - 1]) ? ' ' : '';
                $right = preg_match('/\\s/', $this->buffer[$this->count]) ? ' ' : '';
            } else {
                $left = $right = false;
            }
            $out = [Type::T_INTERPOLATE, $value, $left, $right];
            $this->eatWhiteDefault = $oldWhite;
            if ($this->eatWhiteDefault) {
                $this->whitespace();
            }
            return true;
        }
        $this->seek($s);
        $this->eatWhiteDefault = $oldWhite;
        return false;
    }