Package com.vaadin.sass.internal.parser

Examples of com.vaadin.sass.internal.parser.LexicalUnitImpl


            if (value.getLexicalUnitType() == LexicalUnitImpl.SAC_FUNCTION) {

                if (value.getParameters() != null) {
                    if (StringUtil.containsVariable(value.getParameters()
                            .toString(), node.getName())) {
                        LexicalUnitImpl param = value.getParameters();
                        while (param != null) {
                            if (param.getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE
                                    && param.getValue().toString()
                                            .equals(node.getName())) {
                                param.replaceValue(node.getExpr());
                            }
                            param = param.getNextLexicalUnit();
                        }
                    }
                }
            } else if (value.getStringValue() != null
                    && value.getStringValue().contains(interpolation)) {
                LexicalUnitImpl current = value;
                while (current != null) {
                    if (current.getValue().toString().contains(interpolation)) {

                        current.setStringValue(current
                                .getValue()
                                .toString()
                                .replaceAll(Pattern.quote(interpolation),
                                        node.getExpr().toString()));
                    }
                    current = current.getNextLexicalUnit();
                }
            } else {
                LexicalUnitImpl current = value;
                while (current != null) {
                    if (current.getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE
                            && current.getValue().toString()
                                    .equals(node.getName())) {

                        current.replaceValue(node.getExpr());
                    }
                    current = current.getNextLexicalUnit();
                }
            }
        }
    }
View Full Code Here


    public void replaceVariables(ArrayList<VariableNode> variables) {
        if (listVariable != null) {
            for (final VariableNode var : variables) {
                if (listVariable.equals(var.getName())) {

                    LexicalUnitImpl current = var.getExpr();
                    list = new ArrayList<String>();

                    while (current != null) {
                        if (current.getValue() != null
                                && current.getLexicalUnitType() != LexicalUnitImpl.SAC_OPERATOR_COMMA) {
                            list.add(current.getValue().toString());
                        }
                        current = current.getNextLexicalUnit();
                    }
                    listVariable = null;
                    break;
                }
            }
View Full Code Here

        return m1;
    }

    private static LexicalUnitImpl createRgbParameters(int r, int g, int b,
            int ln, int cn, LexicalUnitImpl prev) {
        LexicalUnitImpl red = LexicalUnitImpl.createInteger(ln, cn, prev, r);
        LexicalUnitImpl firstComma = LexicalUnitImpl.createComma(ln, cn, red);
        LexicalUnitImpl green = LexicalUnitImpl.createInteger(ln, cn,
                firstComma, g);
        LexicalUnitImpl secondComma = LexicalUnitImpl
                .createComma(ln, cn, green);
        LexicalUnitImpl.createInteger(ln, cn, secondComma, b);
        return red;
    }
View Full Code Here

        return red;
    }

    private static LexicalUnitImpl createHslParameters(int h, int s, int l,
            int ln, int cn, LexicalUnitImpl prev) {
        LexicalUnitImpl hue = LexicalUnitImpl.createInteger(ln, cn, prev, h);
        LexicalUnitImpl firstComma = LexicalUnitImpl.createComma(ln, cn, hue);
        LexicalUnitImpl saturation = LexicalUnitImpl.createPercentage(ln, cn,
                firstComma, s);
        LexicalUnitImpl secondComma = LexicalUnitImpl.createComma(ln, cn,
                saturation);
        LexicalUnitImpl.createPercentage(ln, cn, secondComma, l);
        return hue;
    }
View Full Code Here

        LexicalUnitImpl.createPercentage(ln, cn, secondComma, l);
        return hue;
    }

    public static LexicalUnitImpl darken(LexicalUnitImpl darkenFunc) {
        LexicalUnitImpl color = darkenFunc.getParameters();
        float amount = getAmountValue(color);
        LexicalUnitImpl pre = darkenFunc.getPreviousLexicalUnit();

        return adjust(color, amount, ColorOperation.Darken, pre);
    }
View Full Code Here

                return hslToHexColor(
                        adjust(hexColorToHsl(color), amountByPercent, op, pre),
                        color.getStringValue().substring(1).length());
            }
        } else if (color.getLexicalUnitType() == LexicalUnit.SAC_RGBCOLOR) {
            LexicalUnitImpl hsl = rgbToHsl(color);
            LexicalUnitImpl hslAfterDarken = adjust(hsl, amountByPercent, op,
                    pre);
            return hslToRgb(hslAfterDarken);
        }
        return color;
    }
View Full Code Here

        }
        return color;
    }

    public static LexicalUnitImpl lighten(LexicalUnitImpl lightenFunc) {
        LexicalUnitImpl color = lightenFunc.getParameters();
        float amount = getAmountValue(color);
        LexicalUnitImpl pre = lightenFunc.getPreviousLexicalUnit();

        return adjust(color, amount, ColorOperation.Lighten, pre);
    }
View Full Code Here

    public VariableNode getModifiedList() {
        final ArrayList<String> newList = new ArrayList<String>(list);
        modifyList(newList);

        LexicalUnitImpl unit = null;
        if (newList.size() > 0) {
            unit = LexicalUnitImpl.createIdent(newList.get(0));
            LexicalUnitImpl last = unit;
            for (int i = 1; i < newList.size(); i++) {
                LexicalUnitImpl current = LexicalUnitImpl.createIdent(newList
                        .get(i));
                last.setNextLexicalUnit(current);
                last = current;
            }
View Full Code Here

    @Override
    public void replaceVariables(ArrayList<VariableNode> variables) {
        for (final VariableNode var : variables) {
            for (final LexicalUnitImpl arg : new ArrayList<LexicalUnitImpl>(
                    arglist)) {
                LexicalUnitImpl unit = arg;
                // only perform replace in the value if separate argument
                // name
                // and value
                if (unit.getNextLexicalUnit() != null) {
                    unit = unit.getNextLexicalUnit();
                }
                if (unit.getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE
                        && unit.getStringValue().equals(var.getName())) {
                    unit.replaceValue(var.getExpr());
                }
            }

            if (name.startsWith("$")) {
                if (name.equals("$" + var.getName())) {
View Full Code Here

            g = Integer.parseInt(s.substring(2, 4), 16);
            b = Integer.parseInt(s.substring(4, 6), 16);
        }
        int hsl[] = calculateHsl(r, g, b);

        LexicalUnitImpl hslParams = createHslParameters(hsl[0], hsl[1], hsl[2],
                hexColor.getLineNumber(), hexColor.getColumnNumber(),
                hexColor.getPreviousLexicalUnit());

        return LexicalUnitImpl.createFunction(hexColor.getLineNumber(),
                hexColor.getColumnNumber(), hexColor.getPreviousLexicalUnit(),
View Full Code Here

TOP

Related Classes of com.vaadin.sass.internal.parser.LexicalUnitImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.