Package com.google.caja.render

Examples of com.google.caja.render.JsMinimalPrinter.noMoreTokens()


    if (!(node.makeRenderer(sb, null) instanceof JsPrettyPrinter)) {
      throw new ClassCastException(node.getClass().getName());
    }
    TokenConsumer tc = new JsMinimalPrinter(sb);
    node.render(new RenderContext(tc));
    tc.noMoreTokens();
    return sb.toString();
  }

  /**
   * Ensures that a given node is cloneable by calling {@code clone()} on it and
View Full Code Here


  private static String renderMin(Block js) {
    StringBuilder sb = new StringBuilder();
    JsMinimalPrinter p = new JsMinimalPrinter(sb);
    p.setLineLengthLimit(1000);
    js.renderBody(new RenderContext(p));
    p.noMoreTokens();
    return sb.toString();
  }
}
View Full Code Here

      throws Exception {
    StringBuilder sb = new StringBuilder();
    TokenConsumer tc = new JsMinimalPrinter(sb);
    RenderContext rc = new RenderContext(tc);
    js(fromString(code)).children().get(0).render(rc);
    tc.noMoreTokens();
    assertEquals(code, expectedRendering, sb.toString());
  }

  private static void log(String testName, String code) {
    System.err.println();
View Full Code Here

      String dataJs;
      {
        StringBuilder js = new StringBuilder();
        JsMinimalPrinter tokenConsumer = new JsMinimalPrinter(js);
        dataObj.render(new RenderContext(tokenConsumer));
        tokenConsumer.noMoreTokens();
        dataJs = js.toString();
      }

      String equivKey = dataJsToKey.get(dataJs);
      Expression value = dataObj;
View Full Code Here

    if (out instanceof Block) {
      ((Block) out).renderBody(rc);
    } else {
      out.render(rc);
    }
    printer.noMoreTokens();
  }

  private static Block js(CharProducer cp, MessageQueue mq)
      throws ParseException {
    return jsParser(cp, mq).parse();
View Full Code Here

      return NumberLiteral.numberToString(((NumberLiteral) l).doubleValue());
    } else {
      StringBuilder sb = new StringBuilder();
      JsMinimalPrinter p = new JsMinimalPrinter(sb);
      l.render(new RenderContext(p));
      p.noMoreTokens();
      return sb.toString();
    }
  }

  static StringLiteral asStringLiteral(Expression e) {
View Full Code Here

    if (!(node.makeRenderer(sb, null) instanceof JsPrettyPrinter)) {
      throw new ClassCastException(node.getClass().getName());
    }
    TokenConsumer tc = new JsMinimalPrinter(sb);
    node.render(new RenderContext(tc));
    tc.noMoreTokens();
    return sb.toString();
  }

  /**
   * Ensures that a given node is cloneable by calling {@code clone()} on it and
View Full Code Here

      throws Exception {
    StringBuilder sb = new StringBuilder();
    TokenConsumer tc = new JsMinimalPrinter(sb);
    RenderContext rc = new RenderContext(tc);
    js(fromString(code)).children().get(0).render(rc);
    tc.noMoreTokens();
    assertEquals(code, expectedRendering, sb.toString());
  }

  private void log(String testName, String code) {
    System.err.println();
View Full Code Here

  private static String renderMin(Block js) {
    StringBuilder sb = new StringBuilder();
    JsMinimalPrinter p = new JsMinimalPrinter(sb);
    p.setLineLengthLimit(1000);
    js.renderBody(new RenderContext(p));
    p.noMoreTokens();
    return sb.toString();
  }
}
View Full Code Here

    if (out instanceof Block) {
      ((Block) out).renderBody(rc);
    } else {
      out.render(rc);
    }
    printer.noMoreTokens();
  }

  private static Block js(CharProducer cp, MessageQueue mq)
      throws ParseException {
    return jsParser(cp, mq).parse();
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.