Example usage for com.google.common.css.compiler.ast CssBooleanExpressionNode getType

List of usage examples for com.google.common.css.compiler.ast CssBooleanExpressionNode getType

Introduction

In this page you can find the example usage for com.google.common.css.compiler.ast CssBooleanExpressionNode getType.

Prototype

public Type getType() 

Source Link

Usage

From source file:com.google.gwt.resources.gss.PermutationsCollector.java

private void visitBooleanExpression(CssBooleanExpressionNode booleanExpressionNode) {
    if (booleanExpressionNode.getType() == Type.CONSTANT && booleanExpressionNode.getValue() != null) {
        Matcher m = IS_FUNCTION.matcher(booleanExpressionNode.getValue());

        if (m.matches()) {
            String permutationName = m.group(1);
            String permutationValue = m.group(2);

            if (permutationValue == null) {
                permutationValue = permutationName;
                permutationName = USER_AGENT_PERMUTATION;
            }//from w  w w.  j ava  2 s  . c  om

            booleanExpressionNode.setValue(permutationName + ":" + permutationValue);

            permutationAxesListBuilder.add(permutationName);

        } else {
            // TODO warning or error ?
            GssError warning = new GssError(
                    "The expression [" + booleanExpressionNode.getValue()
                            + "] cannot be evaluated. It will be considered as false.",
                    booleanExpressionNode.getSourceCodeLocation());
            errorManager.reportWarning(warning);
        }
    }
}