Package com.google.caja.parser.js

Examples of com.google.caja.parser.js.Statement


              .replaceChild(ref, use.node);
        }
      }
    }
    if (!decls.isEmpty()) {
      Statement first = body.children().get(0);
      MultiDeclaration md;
      if (first instanceof MultiDeclaration) {
        md = (MultiDeclaration) first;
      } else if (first instanceof Declaration) {
        md = new MultiDeclaration(
            FilePosition.span(pos, first.getFilePosition()),
            Collections.singletonList((Declaration) first));
        body.replaceChild(md, first);
      } else if (decls.size() == 1) {
        body.insertBefore(decls.get(0), first);
        return;
View Full Code Here


        .withExits(postBody.exits.intersection(ExitModes.COMPLETES));
  }

  private static LiveCalc processForEachLoop(ForEachLoop s, LiveSet onEntry) {
    LiveCalc postObj = liveness(s.getContainer(), onEntry);
    Statement receiver = s.getKeyReceiver();
    LiveCalc preBody = liveness(s.getKeyReceiver(), postObj.vars);
    preBody = preBody.withExits(preBody.exits.union(postObj.exits));
    if (receiver instanceof Declaration) {
      // Define any variable that holds the key.
      preBody = preBody.withVars(
View Full Code Here

                true),
            inputSource),
        DevNullMessageQueue.singleton(),
        true);

    Statement topLevelStatement = parser.parse();
    parser.getTokenQueue().expectEmpty();
    return topLevelStatement;
  }
View Full Code Here

        int i = 0;
        if (i < pos && startStatements.get(i) instanceof DirectivePrologue) {
          ++i;
        }
        if (i < pos) {
          Statement si = startStatements.get(i);
          if (si instanceof MultiDeclaration) {
            ((MultiDeclaration) si).appendChild(d);
            return;
          } else if (si.getClass() == Declaration.class) {
            startStatements.set(
                i,
                new MultiDeclaration(
                    FilePosition.UNKNOWN, Arrays.asList((Declaration) si, d)));
            return;
View Full Code Here

          substitutes="<expanded>")
      public ParseTreeNode fire(ParseTreeNode node, Scope scope) {
        Map<String, ParseTreeNode> bindings = this.match(node);
        if (bindings != null && isSynthetic((Identifier) bindings.get("v"))) {
          Declaration d = (Declaration) expandAll(node, scope);
          Statement s;
          if (d.getInitializer() == null) {
            s = new Noop(d.getFilePosition());
          } else {
            s = new ExpressionStmt(
                Operation.createInfix(
View Full Code Here

        pool[0] = regexPool.size();
        regexPool.add(makeRegexp(commonSubstringMap, pattern));
      }
    }

    Statement poolDecls = null;
    if (!stringPool.isEmpty()) {
      poolDecls = joinDeclarations(
          poolDecls,
          new Declaration(unk, new Identifier(unk, "s"),
              new ArrayConstructor(unk, stringPool)));
View Full Code Here

TOP

Related Classes of com.google.caja.parser.js.Statement

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.