Examples of JsPrettyPrinter


Examples of com.google.caja.render.JsPrettyPrinter

  }

  public final void testRenderPostRemove() {
    doRemove(5);
    StringBuilder sb = new StringBuilder();
    TokenConsumer tc = new JsPrettyPrinter(sb);
    root.render(new RenderContext(tc));
    tc.noMoreTokens();
    assertEquals(
        "$0: {\n"
        + "  $1: {\n"
        + "    2;\n"
        + "    3;\n"
View Full Code Here

Examples of com.google.caja.render.JsPrettyPrinter

  }

  public final void testRenderPostRemove2() {
    doRemove(1);
    StringBuilder sb = new StringBuilder();
    TokenConsumer tc = new JsPrettyPrinter(sb);
    root.render(new RenderContext(tc));
    tc.noMoreTokens();
    assertEquals(
        "$0: {\n"
        + "  $5: {\n"
        + "    6;\n"
        + "    7;\n"
View Full Code Here

Examples of com.google.caja.render.JsPrettyPrinter

  }

  private void assertRender(String code, String expectedRendering)
      throws Exception {
    StringBuilder sb = new StringBuilder();
    TokenConsumer tc = new JsPrettyPrinter(sb);
    RenderContext rc = new RenderContext(tc);
    js(fromString(code)).children().get(0).render(rc);
    tc.noMoreTokens();
    assertEquals(code, expectedRendering, sb.toString());
  }
View Full Code Here

Examples of com.google.caja.render.JsPrettyPrinter

      throws Exception {
    Statement parseTree = js(fromResource(testFile));
    checkFilePositionInvariants(parseTree);

    StringBuilder sb = new StringBuilder();
    TokenConsumer tc = new JsPrettyPrinter(sb);
    RenderContext rc = new RenderContext(tc);
    parseTree.render(rc);
    tc.noMoreTokens();
    sb.append('\n');

    String golden = TestUtil.readResource(getClass(), goldenFile);
    String actual = sb.toString();
    assertEquals(actual, golden, actual);
View Full Code Here

Examples of com.google.caja.render.JsPrettyPrinter

      boolean emitMarkup = asXml || output.getName().endsWith(".html");

      StringBuilder jsOut = new StringBuilder();
      TokenConsumer renderer;
      if ("pretty".equals(rendererType)) {
        renderer = new JsPrettyPrinter(jsOut);
      } else if ("minify".equals(rendererType)) {
        renderer = new JsMinimalPrinter(jsOut);
      } else {
        throw new RuntimeException("Unrecognized renderer " + rendererType);
      }
View Full Code Here

Examples of com.google.caja.render.JsPrettyPrinter

        getModuleBody().propertyWithName("instantiate")).getValueExpr();
  }

  public final TokenConsumer makeRenderer(
      Appendable out, Callback<IOException> exHandler) {
    return new JsPrettyPrinter(new Concatenator(out, exHandler));
  }
View Full Code Here

Examples of com.google.caja.render.JsPrettyPrinter

    StringBuilder buf = new StringBuilder();
    TokenConsumer tc;
    if (minify) {
      tc = new JsMinimalPrinter(new Concatenator(buf));
    } else {
      tc = new JsPrettyPrinter(new Concatenator(buf));
    }
    RenderContext rc = new RenderContext(tc);
    n.render(rc);
    tc.noMoreTokens();
    return buf.toString();
View Full Code Here

Examples of com.google.caja.render.JsPrettyPrinter

    return ch0 == '"' || ch0 == '\'';
  }

  public final TokenConsumer makeRenderer(
      Appendable out, Callback<IOException> handler) {
    return new JsPrettyPrinter(new Concatenator(out, handler));
  }
View Full Code Here

Examples of com.google.caja.render.JsPrettyPrinter

  public boolean isLeftHandSide() { return false; }

  public final TokenConsumer makeRenderer(
      Appendable out, Callback<IOException> exHandler) {
    return new JsPrettyPrinter(new Concatenator(out, exHandler));
  }
View Full Code Here

Examples of com.google.caja.render.JsPrettyPrinter

    }
  }

  public final TokenConsumer makeRenderer(
      Appendable out, Callback<IOException> exHandler) {
    return new JsPrettyPrinter(new Concatenator(out, exHandler));
  }
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.