Examples of ASTCssNode


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

  private void handleSemicolonSplitMixinReferenceArguments(HiddenTokenAwareTree token, MixinReference reference) {
    List<HiddenTokenAwareTree> children = token.getChildren();
    for (HiddenTokenAwareTree kid : children) {
      if (kid.getType() != LessLexer.SEMI) {
        ASTCssNode parameter = parentBuilder.switchOn(kid);
        if (parameter.getType() == ASTCssNodeType.VARIABLE_DECLARATION)
          reference.addNamedParameter((VariableDeclaration) parameter);
        else
          reference.addPositionalParameter((Expression) parameter);
      }
    }
View Full Code Here

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

  }

  private void handleCommaSplitMixinReferenceArguments(HiddenTokenAwareTree token, MixinReference reference) {
    List<HiddenTokenAwareTree> children = token.getChildren();
    for (HiddenTokenAwareTree kid : children) {
      ASTCssNode parameter = parentBuilder.switchOn(kid);
      if (parameter.getType() == ASTCssNodeType.VARIABLE_DECLARATION) {
        VariableDeclaration variableDeclaration = (VariableDeclaration) parameter;
        Iterator<Expression> expressions = variableDeclaration.getValue().splitByComma().iterator();
       
        variableDeclaration.setValue(expressions.next());
        reference.addNamedParameter(variableDeclaration);
View Full Code Here

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

  private void handleCommaSplitMixinDeclarationArguments(HiddenTokenAwareTree token, ReusableStructure declaration) {
    List<HiddenTokenAwareTree> children = token.getChildren();
    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();
View Full Code Here

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

    this.problemsHandler = problemsHandler;
  }

  public StyleSheet parse(HiddenTokenAwareTree tree) {
    ASTBuilderSwitch builder = new ASTBuilderSwitch(problemsHandler);
    ASTCssNode result = builder.switchOn(tree);
    convertComments(result);
    solveParentChildRelationShips(result);
    checkForWarnings(result);
    return (StyleSheet) result;
  }
View Full Code Here

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

    List<Selector> selectors = new ArrayList<Selector>();
    List<Guard> guards = new ArrayList<Guard>();
    List<HiddenTokenAwareTree> children = token.getChildren();

    ASTCssNode previousKid = null;
    for (HiddenTokenAwareTree kid : children) {
      if (kid.getType() == LessLexer.SELECTOR) {
        Selector selector = handleSelector(kid);
        if (selector != null)
          selectors.add(selector);
        previousKid = selector;
      } else if (kid.getType() == LessLexer.BODY) {
        GeneralBody body = handleGeneralBody(kid);
        ruleSet.setBody(body);
        previousKid = body;
      } else if (kid.getType() == LessLexer.GUARD) {
        guards.add(handleGuard(kid));
      } else if (kid.getType() == LessLexer.COMMA) {
        if (previousKid != null)
          previousKid.getUnderlyingStructure().addFollowing(kid.getPreceding());
      }
    }

    ruleSet.addSelectors(selectors);
    ruleSet.addGuards(guards);
View Full Code Here

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

    MixinReference reference = null;
    List<ReusableStructureName> nameChain = new ArrayList<ReusableStructureName>();

    List<HiddenTokenAwareTree> children = token.getChildren();
    for (HiddenTokenAwareTree kid : children) {
      ASTCssNode buildKid = switchOn(kid);
      if (buildKid.getType() == ASTCssNodeType.MIXIN_REFERENCE) {
        reference = (MixinReference) switchOn(kid);
      } else if (buildKid.getType() == ASTCssNodeType.REUSABLE_STRUCTURE_NAME) {
        nameChain.add(handleReusableStructureName(kid));
      } else {
        throw new BugHappened(GRAMMAR_MISMATCH, token);
      }
    }
View Full Code Here

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

    while (iterator.hasNext()) {
      HiddenTokenAwareTree token = iterator.next();
      if (token.getType() == LessLexer.COMMA) {
        token.pushHiddenToSiblings();
      } else {
        ASTCssNode urlMatchFunction = switchOn(token);
        if (urlMatchFunction.getType() == ASTCssNodeType.FUNCTION)
          result.add((FunctionExpression) termBuilder.buildFromChildTerm(token));
        else
          throw new BugHappened(GRAMMAR_MISMATCH, token);
      }
View Full Code Here

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

    if (!part.isEmpty())
      selector.addPart(part);
  }
 
  private Extend convertToExtend(PseudoClass extend) {
    ASTCssNode parameter = extend.getParameter();
    if (parameter.getType()!=ASTCssNodeType.EXTEND) {
      throw new BugHappened(ASTBuilderSwitch.GRAMMAR_MISMATCH, parameter.getUnderlyingStructure());
    }
   
    return (Extend) parameter;
  }
View Full Code Here

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

    return kid.getType() == ASTCssNodeType.RULE_SET;
  }

  private void replaceMixinReferences(Map<ASTCssNode, GeneralBody> solvedReferences) {
    for (Entry<ASTCssNode, GeneralBody> entry : solvedReferences.entrySet()) {
      ASTCssNode mixinReference = entry.getKey();
      GeneralBody replacement = entry.getValue();

      manipulator.setTreeSilentness(replacement, mixinReference.isSilent());
      manipulator.replaceInBody(mixinReference, replacement.getMembers());
    }
  }
View Full Code Here

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

  private boolean booleanEvalueate(Expression input) {
    if (input.getType() == ASTCssNodeType.COMPARISON_EXPRESSION)
      return booleanEvalueate((ComparisonExpression) input);

    ASTCssNode value = evaluate(input);
    if (value.getType() != ASTCssNodeType.IDENTIFIER_EXPRESSION)
      return false;

    //this comparison must be case sensitive!
    IdentifierExpression identifier = (IdentifierExpression) value;
    return "true".equals(identifier.getValue());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.