@Override public void replaceVariables(ArrayList<VariableNode> variables) { for (final VariableNode var : variables) { for (final VariableNode arg : new ArrayList<VariableNode>(arglist)) { if (arg.getName().equals(var.getName()) && arg.getExpr() == null) { arglist.add(arglist.indexOf(arg), (VariableNode) DeepCopy.copy(var)); arglist.remove(arg); } } } }
@Override public void variable(String name, LexicalUnitImpl value, boolean guarded) { VariableNode node = new VariableNode(name, value, guarded); nodeStack.peek().appendChild(node); }
public static void traverse(VariableNode node) { VariableNode variable = ScssStylesheet.getVariable(node.getName()); if (!node.isGuarded() || variable == null || variable.getExpr() == null || (variable.getExpr().getLexicalUnitType() == SCSSLexicalUnit.SCSS_NULL && variable .getExpr().getNextLexicalUnit() == null)) { ScssStylesheet.addVariable(node); } node.getParentNode().removeChild(node); } }
var = vr; if (asn.getExpression() instanceof ValueNode) { if (asn.getLvalue().getName().equals(var.getName())) { value = (ValueNode) asn.getExpression(); answer += var.getName() + ": .word " + value.getAttribute() + "\n"; var.setDone(true); break; if (!var.isDone()) { answer += var.getName() + ": .word " + value.getAttribute() + "\n"; var.setDone(true); break;
@Override public void replaceVariables(ArrayList<VariableNode> variables) { for (final VariableNode node : variables) { if (!equals(node)) { if (StringUtil .containsVariable(expr.toString(), node.getName())) { if (expr.getParameters() != null && StringUtil.containsVariable(expr.getParameters() .toString(), node.getName())) { replaceValues(expr.getParameters(), node); } else if (expr.getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE) { replaceValues(expr, node); } } } } }
&& unit.getNextLexicalUnit() != null) { for (final VariableNode node : def.getArglist()) { if (node.getName().equals(unit.getValue().toString())) { node.setExpr((LexicalUnitImpl) DeepCopy.copy(unit .getNextLexicalUnit())); remainingNodes.remove(node); && i < remainingUnits.size(); i++) { LexicalUnitImpl unit = remainingUnits.get(i); remainingNodes.get(i).setExpr( (LexicalUnitImpl) DeepCopy.copy(unit));
public static void addVariable(VariableNode node) { variables.put(node.getName(), node); }
@Override public void traverse() { if (!arglist.isEmpty()) { for (final VariableNode arg : arglist) { if (arg.getExpr() != null) { ScssStylesheet.addVariable(arg); } } } }
@Override public void traverse() { /* * "replaceVariables(ScssStylesheet.getVariables());" seems duplicated * and can be extracted out of if, but it is not. * containsArithmeticalOperator must be called before replaceVariables. * Because for the "/" operator, it needs to see if its predecessor or * successor is a Variable or not, to determine it is an arithmetic * operator. */ if (ArithmeticExpressionEvaluator.get().containsArithmeticalOperator( expr)) { replaceVariables(ScssStylesheet.getVariables()); expr = ArithmeticExpressionEvaluator.get().evaluate(expr); } else { replaceVariables(ScssStylesheet.getVariables()); } VariableNodeHandler.traverse(this); } }
@Override public void replaceVariables(ArrayList<VariableNode> variables) { for (final VariableNode node : variables) { String interpolation = "#{$" + node.getName() + "}"; if (animationName != null && animationName.contains(interpolation)) { if (animationName.contains(interpolation)) { animationName = animationName.replaceAll(Pattern .quote(interpolation), node.getExpr() .unquotedString()); } } } }
@Override public VariableNode getModifiedList() { String contains = "" + list.containsAll(modify); VariableNode node = new VariableNode(variable.substring(1), LexicalUnitImpl.createString(contains), false); return node; } }
boolean checkMixinForNonOptionalArguments(VariableNode arg, boolean hasNonOptionalArguments) throws ParseException { boolean currentArgHasArguments = arg.getExpr() != null && arg.getExpr().getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE && arg.getExpr().getNextLexicalUnit() != null; if(currentArgHasArguments) { if(hasNonOptionalArguments) { throw new ParseException("Sass Error: Required argument $"+ arg.getName() +" must come before any optional arguments."); } return hasNonOptionalArguments; }else { return true; } }
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; }
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); }
VariableNode arg = new VariableNode(name, first, false); {if (true) return arg;} throw new Error("Missing return statement in function");
@Override public void replaceVariables(ArrayList<VariableNode> variables) { if (selectorList == null || selectorList.isEmpty()) { return; } for (final VariableNode var : variables) { for (final String selector : new ArrayList<String>(selectorList)) { String interpolation = "#{$" + var.getName() + "}"; if (selector.contains(interpolation)) { String replace = selector.replace(interpolation, var .getExpr().unquotedString()); selectorList.add(selectorList.indexOf(selector), replace); selectorList.remove(selector); } } } }