Examples of ASTCssNode


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

  private boolean pseudoclassesEqual(PseudoClass pClass1, PseudoClass pClass2) {
    if (!utils.nullSafeEquals(pClass1.getFullName(), pClass2.getFullName()))
      return false;

    ASTCssNode parameter1 = pClass1.getParameter();
    ASTCssNode parameter2 = pClass2.getParameter();

    if (parameter1 == null && parameter2 == null)
      return true;

    return generalComparator.equals(parameter1, parameter2);
View Full Code Here

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

    cssOnly.ensureNewLine().increaseIndentationLevel();

    Iterator<ASTCssNode> declarations = node.getDeclarations().iterator();
    List<ASTCssNode> notDeclarations = node.getNotDeclarations();
    while (declarations.hasNext()) {
      ASTCssNode declaration = declarations.next();
      append(declaration);
      if (declarations.hasNext() || notDeclarations.isEmpty())
        cssOnly.ensureNewLine();
    }
    for (ASTCssNode body : notDeclarations) {
View Full Code Here

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

    ASTManipulator astManipulator = new ASTManipulator();
    Iterator<ASTCssNode> iterator = less.getChilds().iterator();
    if (!iterator.hasNext())
      return;

    ASTCssNode node = iterator.next();
    if (node.getType() != ASTCssNodeType.CHARSET_DECLARATION)
      return;

    if (!iterator.hasNext())
      return;

    while (iterator.hasNext()) {
      node = iterator.next();
      if (node.getType() != ASTCssNodeType.CHARSET_DECLARATION)
        return;

      astManipulator.removeFromBody(node);
    }
  }
View Full Code Here

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

  }

  private CompilationResult doCompile(LessSource source, Configuration options) throws Less4jException {
    ANTLRParser.ParseResult result = toAntlrTree(source);
    StyleSheet lessStyleSheet = astBuilder.parse(result.getTree());
    ASTCssNode cssStyleSheet = compiler.compileToCss(lessStyleSheet, source, options);

    CompilationResult compilationResult = createCompilationResult(cssStyleSheet, source, compiler.getImportedsources(), options);
    return compilationResult;
  }
View Full Code Here

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

  public String toNodesPositions(List<? extends ASTCssNode> nodes) {
    String result = "";
    Iterator<? extends ASTCssNode> node = nodes.iterator();
    while (node.hasNext()) {
      ASTCssNode reference = node.next();
      result += "("+ reference.getSourceLine()+":"+reference.getSourceColumn()+")";
      if (node.hasNext())
        result +=" -> ";
    }
   
    return result;
View Full Code Here

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

    }

  }

  private void checkInapropriateLocation(DetachedRuleset detachedRuleset) {
    ASTCssNode parent = detachedRuleset.getParent();
    if (!isVariableDeclaration(parent) && !isMixinReference(parent)) {
      manipulator.replace(detachedRuleset, new FaultyExpression(detachedRuleset));
      problemsHandler.wrongDetachedRulesetLocation(detachedRuleset);
    }
  }
View Full Code Here

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

      manipulator.removeFromClosestBody(reference);
    }
  }

  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

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

    // selectors are able to extend only rulesets inside the same @media body.
    return compatibleMediaLocation(extendingSelector, targetRuleSet);
  }

  private boolean compatibleMediaLocation(Selector extendingSelector, RuleSet targetRuleSet) {
    ASTCssNode grandParent = findOwnerNode(extendingSelector);
    if (grandParent == null || grandParent.getType() == ASTCssNodeType.STYLE_SHEET)
      return true;

    return grandParent == findOwnerNode(targetRuleSet);
  }
View Full Code Here

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

    astManipulator.removeFromBody(media);
    BodiesStorage bodiesStorage = new BodiesStorage();

    //move all kids of media into the empty clone. It is wasteful, they are going to be cloned but does not need to.
    Body oldBody = parentChainIterator.getParentAsBody();
    ASTCssNode currentNode = parentChainIterator.getCurrentNode();
    parentChainIterator.moveUpToNextBody();

    Body emptyClone = bodiesStorage.storeAndReplaceBySingleMemberClone(oldBody, null);
    astManipulator.moveMembersBetweenBodies(media.getBody(), emptyClone);

    while (!parentChainIterator.finished()) {
      //store current node and
      oldBody = parentChainIterator.getParentAsBody();
      currentNode = parentChainIterator.getCurrentNode();
      //move up
      parentChainIterator.moveUpToNextBody();

      bodiesStorage.storeAndReplaceBySingleMemberClone(oldBody, currentNode);
    }

    //clone whole parental chain
    currentNode = parentChainIterator.getCurrentNode();
    ASTCssNode currentNodeClone = currentNode.clone();

    //make it media child
    media.getBody().addMember(currentNodeClone);
    currentNodeClone.setParent(media.getBody());

    //restore bodies and add media
    bodiesStorage.restore();
    astManipulator.addIntoBody(media, currentNode);
  }
View Full Code Here

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

    Iterator<ASTCssNode> keepChildsIterator = keepChilds.iterator();

    while (bodiesIterator.hasNext()) {
      BodyOwner<Body> bodyOwner = parentsIterator.next();
      Body body = bodiesIterator.next();
      ASTCssNode keepChild = keepChildsIterator.next();

      bodyOwner.getBody().setParent(null);
      replaceBody(bodyOwner, body);
      moveToBody(body, keepChild);
    }
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.