private void replaceValues(LexicalUnitImpl unit, VariableNode node) { while (unit != null) { if (unit.getLexicalUnitType() == LexicalUnitImpl.SCSS_VARIABLE && unit.getValue().toString().equals(node.getName())) { LexicalUnitImpl.replaceValues(unit, node.getExpr()); } unit = unit.getNextLexicalUnit(); } }
private static float getAmountValue(LexicalUnitImpl color) { LexicalUnit next = color.getNextLexicalUnit(); float amount = 10f; if (next != null && next.getNextLexicalUnit() != null) { next = next.getNextLexicalUnit(); amount = next.getFloatValue(); } return amount; }
@Override 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; } } } }
LexicalUnitImpl replaceNullValues(LexicalUnitImpl unit) throws ParseException { if(unit == null){ return null; } if (unit.getNextLexicalUnit() != null) { unit.setNextLexicalUnit(replaceNullValues(unit.getNextLexicalUnit())); } if (unit.getLexicalUnitType() == SCSSLexicalUnit.SAC_IDENT && "null".equals(unit.getStringValue())) { LexicalUnitImpl next = unit.getNextLexicalUnit(); unit = LexicalUnitImpl.createNull(unit.getLineNumber(), unit.getColumnNumber(), unit.getPreviousLexicalUnit()); unit.setNextLexicalUnit(next); } return unit; }
createNewOperand((BinaryOperator) operator, operands); current = current.getNextLexicalUnit(); continue; current = current.getNextLexicalUnit(); continue inputTermLoop; current = current.getNextLexicalUnit(); continue; current = current.getNextLexicalUnit();
&& 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); remainingUnits.remove(unit);
if (unit.getNextLexicalUnit() != null) { unit = unit.getNextLexicalUnit();
public boolean containsArithmeticalOperator(LexicalUnitImpl term) { LexicalUnitImpl current = term; while (current != null) { for (BinaryOperator operator : BinaryOperator.values()) { /* * '/' is treated as an arithmetical operator when one of its * operands is Variable, or there is another binary operator. * Otherwise, '/' is treated as a CSS operator. */ if (current.getLexicalUnitType() == operator.type) { if (current.getLexicalUnitType() != BinaryOperator.DIV.type) { return true; } else { if (current.getPreviousLexicalUnit() .getLexicalUnitType() == SCSS_VARIABLE || current.getNextLexicalUnit() .getLexicalUnitType() == SCSS_VARIABLE) { return true; } } } } current = current.getNextLexicalUnit(); } return false; }
break; hslParam = hslParam.getNextLexicalUnit(); i++;
param.replaceValue(node.getExpr()); param = param.getNextLexicalUnit(); node.getExpr().unquotedString())); current = current.getNextLexicalUnit(); current = current.getNextLexicalUnit();
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 void replaceValue(LexicalUnitImpl another) { // shouldn't modify 'another' directly, should only modify its copy. LexicalUnitImpl deepCopyAnother = (LexicalUnitImpl) DeepCopy .copy(another); type = deepCopyAnother.getLexicalUnitType(); i = deepCopyAnother.getIntegerValue(); f = deepCopyAnother.getFloatValue(); s = deepCopyAnother.getStringValue(); fname = deepCopyAnother.getFunctionName(); prev = deepCopyAnother.getPreviousLexicalUnit(); dimension = deepCopyAnother.getDimension(); sdimension = deepCopyAnother.getSdimension(); params = deepCopyAnother.getParameters(); LexicalUnitImpl finalNextInAnother = deepCopyAnother; while (finalNextInAnother.getNextLexicalUnit() != null) { finalNextInAnother = finalNextInAnother.getNextLexicalUnit(); } finalNextInAnother.setNextLexicalUnit(next); next = deepCopyAnother.next; }
@Override public LexicalUnitImpl modulo(LexicalUnitImpl another) { if (getLexicalUnitType() != another.getLexicalUnitType()) { throw new IncompatibleUnitsException(toString()); } setIntegerValue(getIntegerValue() % another.getIntegerValue()); setNextLexicalUnit(another.getNextLexicalUnit()); return this; }
break; if (getNextLexicalUnit() != null) { if (getNextLexicalUnit().getLexicalUnitType() == SAC_OPERATOR_COMMA) { return text + getNextLexicalUnit(); return text + ' ' + getNextLexicalUnit(); } else { return text;
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); } }
@Override public LexicalUnitImpl divide(LexicalUnitImpl denominator) { if (denominator.getLexicalUnitType() != SAC_INTEGER && denominator.getLexicalUnitType() != SAC_REAL && getLexicalUnitType() != denominator.getLexicalUnitType()) { throw new IncompatibleUnitsException(toString()); } setFloatValue(getFloatValue() / denominator.getFloatValue()); if (getLexicalUnitType() == denominator.getLexicalUnitType()) { setLexicalUnitType(SAC_REAL); } setNextLexicalUnit(denominator.getNextLexicalUnit()); return this; }
protected void checkAndSetUnit(LexicalUnitImpl another) { if (getLexicalUnitType() != SAC_INTEGER && getLexicalUnitType() != SAC_REAL && another.getLexicalUnitType() != SAC_INTEGER && another.getLexicalUnitType() != SAC_REAL && getLexicalUnitType() != another.getLexicalUnitType()) { throw new IncompatibleUnitsException(toString()); } if (another.getLexicalUnitType() != SAC_INTEGER && another.getLexicalUnitType() != SAC_REAL) { setLexicalUnitType(another.getLexicalUnitType()); } setNextLexicalUnit(another.getNextLexicalUnit()); }
l = (LexicalUnitImpl) l.getNextLexicalUnit(); i ++; {if (true) throw new ParseException("implementation error");} l = (LexicalUnitImpl) l.getNextLexicalUnit(); i ++; {if (true) throw new ParseException("implementation error");} l = (LexicalUnitImpl) l.getNextLexicalUnit(); i ++; && (l.getNextLexicalUnit() == null) && (l.getLexicalUnitType() == LexicalUnit.SAC_IDENT)) { {if (true) return LexicalUnitImpl.createAttr(l.getLineNumber(), {if (true) throw new ParseException("implementation error");} l = (LexicalUnitImpl) l.getNextLexicalUnit(); i ++;
break; rgbParam = rgbParam.getNextLexicalUnit(); i++;