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

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


  }

  public Declaration handleDeclaration(HiddenTokenAwareTree token) {
    Iterator<HiddenTokenAwareTree> iterator = token.getChildren().iterator();
    HiddenTokenAwareTree nameToken = iterator.next();
    InterpolableName name = toInterpolableName(nameToken, nameToken.getChildren());

    if (!iterator.hasNext())
      return new Declaration(token, name);

    HiddenTokenAwareTree expressionToken = iterator.next();
View Full Code Here


    List<HiddenTokenAwareTree> children = token.getChildren();
    return new IdSelector(token, toInterpolableName(token, children));
  }

  private InterpolableName toInterpolableName(HiddenTokenAwareTree token, List<HiddenTokenAwareTree> children) {
    InterpolableName result = new InterpolableName(token);
    for (HiddenTokenAwareTree kid : children) {
      String text = kid.getText();
      if (text == null || text.length() < 1)
        throw new BugHappened(GRAMMAR_MISMATCH, kid);

      if (kid.getType() == LessLexer.INTERPOLATED_VARIABLE) {
        result.add(new VariableNamePart(kid, toInterpolabledVariable(kid, text)));
      } else if (kid.getType() == LessLexer.HASH_SYMBOL) {
        // do nothing
      } else {
        result.add(new FixedNamePart(kid, toFixedName(kid.getType(), text)));
      }
    }
    return result;
  }
View Full Code Here

    token.pushHiddenToKids();
    Iterator<HiddenTokenAwareTree> iterator = token.getChildren().iterator();
    HiddenTokenAwareTree kid = iterator.next();
    if (kid.getType() == LessLexer.ELEMENT_NAME) {
      List<HiddenTokenAwareTree> elementNameParts = kid.getChildren();
      InterpolableName interpolableName = toInterpolableName(kid, elementNameParts);
      result = new SimpleSelector(kid, null, interpolableName, isStarElementName(elementNameParts));
      if (!iterator.hasNext())
        return result;
      kid = iterator.next();
    } else {
View Full Code Here

  }

  private SimpleSelector interpolateEscapedSelector(EscapedSelector input, ExpressionEvaluator expressionEvaluator) {
    HiddenTokenAwareTree underlying = input.getUnderlyingStructure();
    String value = stringInterpolator.replaceIn(input.getValue(), expressionEvaluator, input.getUnderlyingStructure());
    InterpolableName interpolableName = new InterpolableName(underlying, new FixedNamePart(underlying, value));
    return new SimpleSelector(input.getUnderlyingStructure(), input.getLeadingCombinator(), interpolableName, false);
  }
View Full Code Here

  }

  private void appendSimpleSelectorHead(SimpleSelector selector) {
    cssOnly.ensureSeparator();
    if (!selector.isStar() || !selector.isEmptyForm()) {
      InterpolableName elementName = selector.getElementName();
      cssAndSM.appendIgnoreNull(elementName.getName(), elementName.getUnderlyingStructure());
    }
  }
View Full Code Here

TOP

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

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.