Package com.google.caja.parser

Examples of com.google.caja.parser.ParseTreeNode.children()


    Block topLevelBlock = (Block) parse(inputSource, pattern);
    ParseTreeNode topLevelNode = topLevelBlock;

    // If the top-level Block contains a single child, promote it to allow it to
    // match anywhere.
    if (topLevelNode.children().size() == 1) {
      topLevelNode = topLevelNode.children().get(0);
    }

    // If the top level is an ExpressionStmt, with one child, then promote its
    // single child to the top level to allow the contained expression to match
View Full Code Here


    ParseTreeNode topLevelNode = topLevelBlock;

    // If the top-level Block contains a single child, promote it to allow it to
    // match anywhere.
    if (topLevelNode.children().size() == 1) {
      topLevelNode = topLevelNode.children().get(0);
    }

    // If the top level is an ExpressionStmt, with one child, then promote its
    // single child to the top level to allow the contained expression to match
    // anywhere.
View Full Code Here

    // If the top level is an ExpressionStmt, with one child, then promote its
    // single child to the top level to allow the contained expression to match
    // anywhere.
    if (topLevelNode instanceof ExpressionStmt) {
      topLevelNode = topLevelNode.children().get(0);
    }

    // If the top level is a FunctionDeclaration, promote its single child to
    // the top level to allow the contained FunctionConstructor to match in any
    // context.
View Full Code Here

      // be property names.
      infected = true;
    } else if (Operation.is(n, Operator.MEMBER_ACCESS)) {
      // Do not let the property name reference be treated as a reference to
      // a var or global.
      attachScopes(AncestorChain.instance(ac, n.children().get(0)), scope);
      return false;
    }
    for (ParseTreeNode child : n.children()) {
      infected |= attachScopes(AncestorChain.instance(ac, child), scope);
    }
View Full Code Here

      // Do not let the property name reference be treated as a reference to
      // a var or global.
      attachScopes(AncestorChain.instance(ac, n.children().get(0)), scope);
      return false;
    }
    for (ParseTreeNode child : n.children()) {
      infected |= attachScopes(AncestorChain.instance(ac, child), scope);
    }
    if (infected) { scope.setDynamicUsePossible(); }
    return infected;
  }
View Full Code Here

      Map<String, ParseTreeNode> bindings) {
    if (bindings.containsKey(keyIdentifier)
        && bindings.containsKey(valueIdentifier)) {
      ParseTreeNode keyNode = bindings.get(keyIdentifier);
      ParseTreeNode valueNode = bindings.get(valueIdentifier);
      assert keyNode.children().size() == valueNode.children().size();
      List<ObjProperty> children = Lists.newArrayList();
      for (int i = 0; i < keyNode.children().size(); i++) {
        children.add(
            new ValueProperty(
                (StringLiteral) keyNode.children().get(i),
View Full Code Here

      List<ObjProperty> children = Lists.newArrayList();
      for (int i = 0; i < keyNode.children().size(); i++) {
        children.add(
            new ValueProperty(
                (StringLiteral) keyNode.children().get(i),
                (Expression) valueNode.children().get(i)));
      }
      substitutes.addAll(children);
      return true;
    }
    return false;
View Full Code Here

    // selectors, and then consider any rulesets that have become empty due to
    // a lack of selectors.
    t.node.acceptPreOrder(new Visitor() {
        public boolean visit(AncestorChain<?> ancestors) {
          ParseTreeNode node = ancestors.node;
          if ((node instanceof CssTree.Selector && node.children().isEmpty())
              || (node instanceof CssTree.RuleSet
                  && (node.children().isEmpty()
                      || node.children().get(0) instanceof CssTree.Declaration))
              ) {
            ((MutableParseTreeNode) ancestors.parent.node).removeChild(node);
View Full Code Here

    t.node.acceptPreOrder(new Visitor() {
        public boolean visit(AncestorChain<?> ancestors) {
          ParseTreeNode node = ancestors.node;
          if ((node instanceof CssTree.Selector && node.children().isEmpty())
              || (node instanceof CssTree.RuleSet
                  && (node.children().isEmpty()
                      || node.children().get(0) instanceof CssTree.Declaration))
              ) {
            ((MutableParseTreeNode) ancestors.parent.node).removeChild(node);
            return false;
          }
View Full Code Here

        public boolean visit(AncestorChain<?> ancestors) {
          ParseTreeNode node = ancestors.node;
          if ((node instanceof CssTree.Selector && node.children().isEmpty())
              || (node instanceof CssTree.RuleSet
                  && (node.children().isEmpty()
                      || node.children().get(0) instanceof CssTree.Declaration))
              ) {
            ((MutableParseTreeNode) ancestors.parent.node).removeChild(node);
            return false;
          }
          return true;
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.