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

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


  public SupportsCondition handleSupportsSimpleCondition(HiddenTokenAwareTree token) {
    token.pushHiddenToKids();
    Iterator<HiddenTokenAwareTree> children = token.getChildren().iterator();
    HiddenTokenAwareTree first = children.next();
    if (first.getType() == LessLexer.LPAREN) {
      SyntaxOnlyElement openingParentheses = toSyntaxOnlyElement(first);
      SupportsCondition condition = (SupportsCondition) switchOn(children.next());
      SyntaxOnlyElement closingParentheses = toSyntaxOnlyElement(children.next());

      SupportsConditionInParentheses result = new SupportsConditionInParentheses(token, openingParentheses, condition, closingParentheses);
      return result;
    } else if (first.getType() == LessLexer.IDENT) {
      //TODO: warning on wrong operator (anything that is not 'not')
      SyntaxOnlyElement negation = toSyntaxOnlyElement(first);
      SupportsCondition condition = (SupportsCondition) switchOn(children.next());

      SupportsConditionNegation result = new SupportsConditionNegation(token, negation, condition);
      return result;
    }
View Full Code Here


    return (SupportsCondition) switchOn(first);
  }

  public SupportsCondition handleSupportsQuery(HiddenTokenAwareTree token) {
    Iterator<HiddenTokenAwareTree> children = token.getChildren().iterator();
    SyntaxOnlyElement openingParentheses = toSyntaxOnlyElement(children.next());
    Declaration declaration = (Declaration) switchOn(children.next());
    SyntaxOnlyElement closingParentheses = toSyntaxOnlyElement(children.next());
    SupportsQuery result = new SupportsQuery(token, openingParentheses, closingParentheses, declaration);
    return result;
  }
View Full Code Here

    SupportsQuery result = new SupportsQuery(token, openingParentheses, closingParentheses, declaration);
    return result;
  }

  private SyntaxOnlyElement toSyntaxOnlyElement(HiddenTokenAwareTree token) {
    return new SyntaxOnlyElement(token, token.getText());
  }
View Full Code Here

    List<ASTCssNode> list = handleBodyMembers(token);

    if (list.size() < 2)
      throw new BugHappened(GRAMMAR_MISMATCH, token);

    SyntaxOnlyElement lbrace = (SyntaxOnlyElement) list.remove(0);
    SyntaxOnlyElement rbrace = (SyntaxOnlyElement) list.remove(list.size() - 1);
    List<CommonToken> orphansOrFollowLastMember = rbrace.getUnderlyingStructure().chopPreceedingUpToLastOfType(LessLexer.NEW_LINE);
    if (list.isEmpty()) {
      token.addOrphans(orphansOrFollowLastMember);
    } else {
      list.get(list.size() - 1).getUnderlyingStructure().addFollowing(orphansOrFollowLastMember);
    }
View Full Code Here

TOP

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

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.