Package com.github.sommeri.less4j.core.ast

Examples of com.github.sommeri.less4j.core.ast.Variable


  }

  private Variable buildFromVariable(HiddenTokenAwareTree realOwner, HiddenTokenAwareTree variableToken) {
    if (realOwner != null) {
      realOwner.addFollowing(variableToken.getFollowing());
      return new Variable(realOwner, variableToken.getText());
    }
    return new Variable(variableToken, variableToken.getText());
  }
View Full Code Here


    }
    return result;
  }

  private Variable toInterpolabledVariable(HiddenTokenAwareTree token, String text) {
    return new Variable(token, "@" + text.substring(2, text.length() - 1), true);
  }
View Full Code Here

  public InterpolatedMediaExpression handleInterpolatedMediaExpression(HiddenTokenAwareTree token) {
    Iterator<HiddenTokenAwareTree> children = token.getChildren().iterator();
    List<Expression> expressions = new ArrayList<Expression>();
       
    while (children.hasNext()) {
      Variable expression = (Variable) switchOn(children.next());
      expressions.add(expression);
    }
    ListExpression list = new ListExpression(token, expressions, new ListExpressionOperator(token, ListExpressionOperator.Operator.EMPTY_OPERATOR));
    return new InterpolatedMediaExpression(token, list);
  }
View Full Code Here

      colon.giveHidden(name, expression);
      semi.giveHidden(expression, null);
      token.addBeforeFollowing(semi.getFollowing());
    }

    Variable variable = new Variable(name, name.getText());
    Expression value = variableValue(token, expression);
    return new VariableDeclaration(token, variable, value);
  }
View Full Code Here

  // last, those with default must be first)
  public ArgumentDeclaration handleArgumentDeclaration(HiddenTokenAwareTree token) {
    List<HiddenTokenAwareTree> children = token.getChildren();
    HiddenTokenAwareTree firstChild = children.get(0);
    if (firstChild.getType() == LessLexer.DOT3)
      return new ArgumentDeclaration(firstChild, new Variable(firstChild, "@"), null, true);

    HiddenTokenAwareTree name = firstChild;

    if (children.size() == 1)
      return new ArgumentDeclaration(token, new Variable(name, name.getText()), null);

    HiddenTokenAwareTree separator = children.get(1);
    if (separator.getType() == LessLexer.DOT3) {
      return new ArgumentDeclaration(token, new Variable(name, name.getText()), null, true);
    }
    HiddenTokenAwareTree expression = children.get(2);
    separator.giveHidden(name, expression);

    return new ArgumentDeclaration(token, new Variable(name, name.getText()), (Expression) switchOn(expression));
  }
View Full Code Here

    return "@" + group.substring(2, group.length() - 1);
  }

  @Override
  protected String replacementValue(ExpressionEvaluator expressionEvaluator, HiddenTokenAwareTree technicalUnderlying, MatchRange matchRange) {
    Expression value = expressionEvaluator.evaluateIfPresent(new Variable(technicalUnderlying, matchRange.getName()));
    if (value == null) {
      return matchRange.getFullMatch();
    }

    String result = embeddedScriptEvaluator.toScript(value, problemsHandler);
View Full Code Here

    CssPrinter printer = new InStringCssPrinter();
    printer.append(reference);
    String realName = printer.toString();

    Variable directVariable = new Variable(input.getUnderlyingStructure(), "@" + realName);
    return evaluate(directVariable);
  }
View Full Code Here

 
  public String toVariablesString(List<Variable> cycle) {
    String result = "";
    Iterator<Variable> iCycle = cycle.iterator();
    while (iCycle.hasNext()) {
      Variable variable = iCycle.next();
      result += variable.getName() + " ("+ variable.getSourceLine()+":"+variable.getSourceColumn()+") ";
      if (iCycle.hasNext())
        result +="-> ";
    }
   
    return result;
View Full Code Here

  private void checkDeprecatedParameterType(PseudoClass pseudo) {
    ASTCssNode parameter = pseudo.getParameter();
    if (parameter == null || parameter.getType() != ASTCssNodeType.VARIABLE)
      return;
   
    Variable variable = (Variable) parameter;
    if (!variable.hasInterpolatedForm())
      problemsHandler.variableAsPseudoclassParameter(pseudo);
  }
View Full Code Here

TOP

Related Classes of com.github.sommeri.less4j.core.ast.Variable

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.