Package com.google.caja.parser.js

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


  private static StringLiteral lit(String s) {
    return StringLiteral.valueOf(FilePosition.UNKNOWN, s);
  }

  private static IntegerLiteral lit(int i) {
    return new IntegerLiteral(FilePosition.UNKNOWN, i);
  }
View Full Code Here


        + "})",
        "moduleInvocations", moduleInvocations,
        "cajolerName", StringLiteral.valueOf(unk, "com.google.caja"),
        "cajolerVersion", StringLiteral.valueOf(
            unk, buildInfo.getBuildVersion()),
        "cajoledDate", new IntegerLiteral(unk, buildInfo.getCurrentTime()));
    return new CajoledModule(oc);
  }
View Full Code Here

  public final void testNegatedNegativeNumericConstants() {
    assertRendered(
        "-(-3)"// not --3
        Operation.create(
            FilePosition.UNKNOWN, Operator.NEGATION,
            new IntegerLiteral(FilePosition.UNKNOWN,-3)));
  }
View Full Code Here

  public final void testNegatedNegativeNumericConstants() {
    assertRendered(
        "- (-3)"// not --3
        Operation.create(
            FilePosition.UNKNOWN, Operator.NEGATION,
            new IntegerLiteral(FilePosition.UNKNOWN,-3)));
  }
View Full Code Here

    //   12;
    // }

    ExpressionStmt[] b = new ExpressionStmt[13];
    for (int i = b.length; --i >= 0;) {
      b[i] = new ExpressionStmt(unk, new IntegerLiteral(unk, i));
    }

    LabeledStmtWrapper b1 = new LabeledStmtWrapper(
        unk, "$1", new Block(unk, Arrays.asList(b[2], b[3], b[4])));
View Full Code Here

  // setComments causes a warning about generic array for varargs
  public final void testImmutability() throws Exception {
    Block n = new Block(
        FilePosition.UNKNOWN,
        Arrays.asList(
            new ExpressionStmt(new IntegerLiteral(FilePosition.UNKNOWN, 42)),
            new ExpressionStmt(new IntegerLiteral(FilePosition.UNKNOWN, 13))));
    assertTrue(n.makeImmutable());
    assertTrue(n.isImmutable());
    assertTrue(n.children().get(0).isImmutable());
    assertTrue(n.children().get(0).children().get(0).isImmutable());
    assertTrue(n.children().get(1).isImmutable());
View Full Code Here

  public final void testIncompleteImmutability() throws Exception {
    // Immutability should be best-effort, stopping at a node that refuses
    Block n = new Block(
        FilePosition.UNKNOWN,
        Arrays.asList(
            new ExpressionStmt(new IntegerLiteral(FilePosition.UNKNOWN, 42)),
            new ExpressionStmt(new AlwaysMutable())));
    assertFalse(n.makeImmutable());
    assertFalse(n.isImmutable());
    assertTrue(n.children().get(0).isImmutable());
    assertTrue(n.children().get(0).children().get(0).isImmutable());
View Full Code Here

          }
        }
        for (int i = 0; i < toAdd.length; ++i) {
          p.appendChild(new ExpressionStmt(
              FilePosition.UNKNOWN,
              new IntegerLiteral(FilePosition.UNKNOWN, toAdd[i])));
        }
      }
      return true;
    }
View Full Code Here

        AncestorChain<Reference> toReplace = read.parent.cast(Reference.class);
        Expression repl;
        if (value == null) {
          FilePosition fp = toReplace.node.getFilePosition();
          repl = Operation.create(fp, Operator.VOID, new IntegerLiteral(fp, 0));
        } else {
          repl = (Expression) value.clone();
        }
        toReplace.parent.cast(MutableParseTreeNode.class)
            .node.replaceChild(repl, toReplace.node);
View Full Code Here

    List<? extends ParseTreeNode> children = returnThrowOrExprStmt.children();
    assert children.size() < 2;
    if (children.isEmpty()) {
      FilePosition pos = FilePosition.endOf(
          returnThrowOrExprStmt.getFilePosition());
      return Operation.create(pos, Operator.VOID, new IntegerLiteral(pos, 0));
    }
    return (Expression) children.get(0);
  }
View Full Code Here

TOP

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

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.