Examples of ParseTreeNodeContainer


Examples of com.google.caja.parser.ParseTreeNodeContainer

    }
    // If the input NameContext contains (foo => a, bar => b) then the program
    // looks like { (function (a, b) { @rewrittenExpression; }; }
    Block program = (Block) QuasiBuilder.substV(
        "{ (function (@formals*) { @f; }); }",
        "formals", new ParseTreeNodeContainer(
            Lists.newArrayList(rewrittenNames.values())),
        "f", new ExpressionStmt(f));
    MessageQueue sanityCheckMq = DevNullMessageQueue.singleton();
    Set<String> freeIdents = Sets.newLinkedHashSet();
    Scope programScope = Scope.fromProgram(
View Full Code Here

Examples of com.google.caja.parser.ParseTreeNodeContainer

      Map<String, ParseTreeNode> bindings) {
    List<ParseTreeNode> matches = new ArrayList<ParseTreeNode>();
    while (specimens.size() > 0 && isCompatibleClass(specimens.get(0))) {
      matches.add(specimens.remove(0));
    }
    return putIfDeepEquals(bindings, getIdentifier(), new ParseTreeNodeContainer(matches));
  }
View Full Code Here

Examples of com.google.caja.parser.ParseTreeNodeContainer

    }
    return new ExpressionStmt(unk,
        (Expression) QuasiBuilder.substV(
            "html4.@i = { @k*: @v* };",
            "i", new Reference(new Identifier(unk, key)),
            "k", new ParseTreeNodeContainer(keys),
            "v", new ParseTreeNodeContainer(values)));
  }
View Full Code Here

Examples of com.google.caja.parser.ParseTreeNodeContainer

        }
      }
      definitions.appendChild(new ExpressionStmt(unk, (Expression)
          QuasiBuilder.substV(
              "html4.ATTRIBS = { @k*: @v* };",
              "k", new ParseTreeNodeContainer(keys),
              "v", new ParseTreeNodeContainer(values))));
    }

    definitions.appendChild(mapFromEnum(
        EnumSet.allOf(EFlag.class),
        "eflags",
        new Function<EFlag, String>() {
          public String apply(EFlag f) {
            return f.name();
          }
        },
        new Function<EFlag, Integer>() {
          public Integer apply(EFlag f) {
            return f.bitMask;
          }
        })
    );

    {
      List<StringLiteral> keys = new ArrayList<StringLiteral>();
      List<IntegerLiteral> values = new ArrayList<IntegerLiteral>();
      for (Map.Entry<ElKey, EnumSet<EFlag>> e : eflags.entrySet()) {
        ElKey key = e.getKey();
        int value = 0;
        for (EFlag f : e.getValue()) { value |= f.bitMask; }
        keys.add(StringLiteral.valueOf(unk, key.toString()));
        values.add(new IntegerLiteral(unk, value));
      }
      definitions.appendChild(new ExpressionStmt(unk, (Expression)
          QuasiBuilder.substV(
              "html4.ELEMENTS = { @k*: @v* };",
              "k", new ParseTreeNodeContainer(keys),
              "v", new ParseTreeNodeContainer(values))));
    }

    definitions.appendChild(mapFromEnum(
        EnumSet.allOf(UriEffect.class),
        "ueffects",
View Full Code Here

Examples of com.google.caja.parser.ParseTreeNodeContainer

            }

            FunctionConstructor out = (FunctionConstructor) substV(
                "name", rewrittenName,
                "headDecls", optionalDeclarations(headDecls),
                "params", new ParseTreeNodeContainer(newFormals),
                "body", expandAll(bindings.get("body"), newScope));
            return isDeclaration ? new FunctionDeclaration(out) : out;
          }
          return NONE;
        }
View Full Code Here

Examples of com.google.caja.parser.ParseTreeNodeContainer

      ValueProperty prop = (ValueProperty) quasi;
      keyList.add(prop.getPropertyNameNode());
      valueList.add(prop.getValueExpr());
    }
    if (putIfDeepEquals(
            bindings, keyIdentifier, new ParseTreeNodeContainer(keyList))
        && putIfDeepEquals(
              bindings, valueIdentifier,
              new ParseTreeNodeContainer(valueList))) {
      specimens.clear();
      return true;
    }
    return false;
  }
View Full Code Here

Examples of com.google.caja.parser.ParseTreeNodeContainer

    /**
     * The temporaries required by LHS and RHS in order of initialization.
     */
    public List<Expression> getTemporaries() { return temporaries; }
    public ParseTreeNodeContainer getTemporariesAsContainer() {
      return new ParseTreeNodeContainer(temporaries);
    }
View Full Code Here

Examples of com.google.caja.parser.ParseTreeNodeContainer

      return refs[i];
    }

    // Returns a list of value references starting at the i'th value.
    public ParseTreeNodeContainer refListFrom(int i) {
      return new ParseTreeNodeContainer(
          Arrays.asList(Arrays.copyOfRange(refs, i, refs.length)));
    }
View Full Code Here

Examples of com.google.caja.parser.ParseTreeNodeContainer

    }
    if (scope.hasFreeThis()) {
      stmts.add(QuasiBuilder.substV(
          "var dis___ = (this && this.___) ? void 0 : this;"));
    }
    return new ParseTreeNodeContainer(stmts);
  }
View Full Code Here

Examples of com.google.caja.parser.ParseTreeNodeContainer

    } else if (node instanceof ParseTreeNodeContainer) {
      List<ParseTreeNode> nodes = Lists.newArrayList(node.children());
      int lasti = lastRealJavascriptChild(nodes);
      if (lasti >= 0) {
        nodes.set(lasti, returnLast(nodes.get(lasti)));
        result = new ParseTreeNodeContainer(nodes);
      }
    } else if (node instanceof Block) {
      List<Statement> stats = Lists.newArrayList();
      stats.addAll((Collection<? extends Statement>) node.children());
      int lasti = lastRealJavascriptChild(stats);
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.