// parse body
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);
            }
        }
    }
parseMediaExpressions();
}
// parse body
if (isType(PXStylesheetTokenType.LCURLY)) {
try {
// 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");
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);
}
}
}