src/Luminous/Utils/SassParser.php
private function parseRule()
    {
        $newToken = $this->tokens[$this->index];
        $set = false;
        if ($this->index > 0) {
            $prevToken = &$this->tokens[$this->index-1];
            $prevTokenType = &$prevToken[0];
            $prevTokenText = &$prevToken[1];
            $concat = false;

            $map = array(
                'DOT' => 'CLASS_SELECTOR',
                'HASH' => 'ID_SELECTOR',
                'COLON' => 'PSEUDO_SELECTOR',
                'DOUBLE_COLON' => 'PSEUDO_SELECTOR'
            );
            if (isset($map[$prevTokenType])) {
                // mark the prev token for deletion and concat into one.
                $newToken[0] = $map[$prevTokenType];
                $prevTokenType = self::$deleteToken;
                $newToken[1] = $prevTokenText . $newToken[1];
                $set = true;
            }
        }
        if (!$set) {
            // must be an element
            $newToken[0] = 'ELEMENT_SELECTOR';
        }
        $this->tokens[$this->index] = $newToken;
    }
private function parseRule()
    {
        $newToken = $this->tokens[$this->index];
        $set = false;
        if ($this->index > 0) {
            $prevToken = &$this->tokens[$this->index-1];
            $prevTokenType = &$prevToken[0];
            $prevTokenText = &$prevToken[1];
            $concat = false;

            $map = array(
                'DOT' => 'CLASS_SELECTOR',
                'HASH' => 'ID_SELECTOR',
                'COLON' => 'PSEUDO_SELECTOR',
                'DOUBLE_COLON' => 'PSEUDO_SELECTOR'
            );
            if (isset($map[$prevTokenType])) {
                // mark the prev token for deletion and concat into one.
                $newToken[0] = $map[$prevTokenType];
                $prevTokenType = self::$deleteToken;
                $newToken[1] = $prevTokenText . $newToken[1];
                $set = true;
            }
        }
        if (!$set) {
            // must be an element
            $newToken[0] = 'ELEMENT_SELECTOR';
        }
        $this->tokens[$this->index] = $newToken;
    }
private function parseRule ( ) { $ newToken = $ this -> tokens [ $ this -> index ] ; $ set = false ; if ( $ this -> index > 0 ) { $ prevToken = & $ this -> tokens [ $ this -> index - 1 ] ; $ prevTokenType = & $ prevToken [ 0 ] ; $ prevTokenText = & $ prevToken [ 1 ] ; $ concat = false ; $ map = array ( 'DOT' => 'CLASS_SELECTOR' , 'HASH' => 'ID_SELECTOR' , 'COLON' => 'PSEUDO_SELECTOR' , 'DOUBLE_COLON' => 'PSEUDO_SELECTOR' ) ; if ( isset ( $ map [ $ prevTokenType ] ) ) { // mark the prev token for deletion and concat into one. $ newToken [ 0 ] = $ map [ $ prevTokenType ] ; $ prevTokenType = self :: $ deleteToken ; $ newToken [ 1 ] = $ prevTokenText . $ newToken [ 1 ] ; $ set = true ; } } if ( ! $ set ) { // must be an element $ newToken [ 0 ] = 'ELEMENT_SELECTOR' ; } $ this -> tokens [ $ this -> index ] = $ newToken ; }
Parses a selector rule
Parses a selector rule