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; } } VariableNode node = new VariableNode(variable.substring(1), unit, false); return node; }
public static LexicalUnitImpl hslToHexColor(LexicalUnitImpl hsl, int lengh) { int[] rgb = calculateRgb(hsl); StringBuilder builder = new StringBuilder("#"); for (int i = 0; i < 3; i++) { String color = Integer.toHexString(rgb[i]); if (lengh == 6) { if (color.length() == 1) { color = "0" + color; } } if (lengh == 3) { color = color.substring(0, 1); } builder.append(color); } return LexicalUnitImpl.createIdent(hsl.getLineNumber(), hsl.getColumnNumber(), hsl.getPreviousLexicalUnit(), builder.toString()); }
/** * @exception ParseException exception during the parse */ final public LexicalUnitImpl hexcolor(LexicalUnitImpl prev) throws ParseException { Token n; n = jj_consume_token(HASH); int r; LexicalUnitImpl first, params = null; String s = n.image.substring(1); if(s.length()!=3 && s.length()!=6) { first = null; {if (true) throw new CSSParseException("invalid hexadecimal notation for RGB: " + s, getLocator());} } {if (true) return LexicalUnitImpl.createIdent(n.beginLine, n.beginColumn, prev, n.image);} throw new Error("Missing return statement in function"); }
private static void replaceEachDefNode(EachDefNode defNode) { Node last = defNode; for (final String var : defNode.getVariables()) { VariableNode varNode = new VariableNode(defNode.getVariableName() .substring(1), LexicalUnitImpl.createIdent(var), false); ArrayList<VariableNode> variables = new ArrayList<VariableNode>( ScssStylesheet.getVariables()); variables.add(varNode); for (final Node child : defNode.getChildren()) { Node copy = (Node) DeepCopy.copy(child); replaceInterpolation(copy, variables); defNode.getParentNode().appendChild(copy, last); last = copy; } } defNode.setChildren(new ArrayList<Node>()); defNode.getParentNode().removeChild(defNode); }
if("alpha(".equals(fname)){ String body = skipStatementUntilSemiColon(); {if (true) return LexicalUnitImpl.createIdent(n.beginLine, n.beginColumn, null, "alpha("+body);} }else if("expression(".equals(fname)){ String body = skipStatementUntilSemiColon(); {if (true) return LexicalUnitImpl.createIdent(n.beginLine, n.beginColumn, null, "expression("+body);}
prev); } else { result = LexicalUnitImpl.createIdent(n.beginLine, n.beginColumn, prev, convertIdent(n.image));