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

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


    for (HiddenTokenAwareTree kid : children) {
      if (kid.getType() != LessLexer.SEMI) {
        ASTCssNode argument = parentBuilder.switchOn(kid);
       
        if (argument.getType() == ASTCssNodeType.ARGUMENT_DECLARATION) {
          ArgumentDeclaration argumentDeclaration = (ArgumentDeclaration) argument;
          addParameter(declaration, argumentDeclaration);

          if (argumentDeclaration.getValue()!=null) {
            Iterator<Expression> expressions = argumentDeclaration.getValue().splitByComma().iterator();
            argumentDeclaration.setValue(expressions.next());
            addParameters(declaration, expressions);
          }
        } else {
          Iterator<Expression> expressions = ((Expression) argument).splitByComma().iterator();
          addParameters(declaration, expressions);
View Full Code Here


  private void addParameters(ReusableStructure declaration, Iterator<Expression> expressions) {
    while (expressions.hasNext()) {
      Expression next = expressions.next();
     
      if (next.getType()==ASTCssNodeType.VARIABLE) {
        addParameter(declaration, new ArgumentDeclaration((Variable)next, null));
      } else {
        addParameter(declaration, next);
      }
    }
  }
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

TOP

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

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.