private void parseMedia() {
        assertTypeAndAdvance(PXStylesheetTokenType.MEDIA);
        // TODO: support media types, NOT, and ONLY. Skipping for now
        while (isType(PXStylesheetTokenType.IDENTIFIER)) {
            advance();
        }
        // 'and' may appear here
        advanceIfIsType(PXStylesheetTokenType.AND);
        // parse optional expressions
        if (isType(PXStylesheetTokenType.LPAREN)) {
            parseMediaExpressions();
        }
        // parse body
        if (isType(PXStylesheetTokenType.LCURLY)) {
            try {
                advance();
                while (currentLexeme != null
                        && currentLexeme.getType() != PXStylesheetTokenType.EOF
                        && !isType(PXStylesheetTokenType.RCURLY)) {
                    parseRuleSet();
                }
                advanceIfIsType(PXStylesheetTokenType.RCURLY,
                        "Expected @media body closing curly brace");
            } finally {
                // reset active media query to none
                currentStyleSheet.setActiveMediaQuery(null);
            }
        }
    }
private void parseMedia() {
        assertTypeAndAdvance(PXStylesheetTokenType.MEDIA);
       
        while (isType(PXStylesheetTokenType.IDENTIFIER)) {
            advance();
        }
       
        advanceIfIsType(PXStylesheetTokenType.AND);
       
        if (isType(PXStylesheetTokenType.LPAREN)) {
            parseMediaExpressions();
        }
       
        if (isType(PXStylesheetTokenType.LCURLY)) {
            try {
                advance();
                while (currentLexeme != null
                        && currentLexeme.getType() != PXStylesheetTokenType.EOF
                        && !isType(PXStylesheetTokenType.RCURLY)) {
                    parseRuleSet();
                }
                advanceIfIsType(PXStylesheetTokenType.RCURLY,
                        "Expected @media body closing curly brace");
            } finally {
               
                currentStyleSheet.setActiveMediaQuery(null);
            }
        }
    }
private void parsemedia() { asserttypeandadvance(pxstylesheettokentype.media); while (istype(pxstylesheettokentype.identifier)) { advance(); } advanceifistype(pxstylesheettokentype.and); if (istype(pxstylesheettokentype.lparen)) { parsemediaexpressions(); } if (istype(pxstylesheettokentype.lcurly)) { try { advance(); while (currentlexeme != null && currentlexeme.gettype() != pxstylesheettokentype.eof && !istype(pxstylesheettokentype.rcurly)) { parseruleset(); } advanceifistype(pxstylesheettokentype.rcurly, "expected @media body closing curly brace"); } finally { currentstylesheet.setactivemediaquery(null); } } }