Revision: 4280
Author: mikesamuel
Date: Mon Sep 20 14:30:08 2010
Log: Some cleanup of the JsonML that I'm working on with closure
http://codereview.appspot.com/2231043
This replaces the jsonml.jar with one that got rid of a node-type
that was undocumented and unused in es-lab.
Also:
- gets rid of a reference to it in JsonMLConverter
- cleanup warnings around NaN check in NumberLiteral.
- misc. other warning cleanup.
[email protected]
http://code.google.com/p/google-caja/source/detail?r=4280
Added:
/trunk/third_party/java/jsonml/LICENSE
/trunk/third_party/java/jsonml/README
Modified:
/trunk/src/com/google/caja/demos/playground/client/ui/PlaygroundEditor.java
/trunk/src/com/google/caja/demos/playground/client/ui/PlaygroundView.java
/trunk/src/com/google/caja/parser/html/OpenElementStack.java
/trunk/src/com/google/caja/parser/js/CajoledModuleExpression.java
/trunk/src/com/google/caja/parser/js/Elision.java
/trunk/src/com/google/caja/parser/js/JsonMLCompatible.java
/trunk/src/com/google/caja/parser/js/JsonMLConverter.java
/trunk/src/com/google/caja/parser/js/NumberLiteral.java
/trunk/src/com/google/caja/tools/EnumsToJs.java
/trunk/src/com/google/caja/util/RhinoExecutor.java
/trunk/third_party/java/jsonml/jsonml.jar
=======================================
--- /dev/null
+++ /trunk/third_party/java/jsonml/LICENSE Mon Sep 20 14:30:08 2010
@@ -0,0 +1,2 @@
+Per http://code.google.com/p/closure-compiler/ this is licensed under
+the Apache License, Version 2.0 available at
http://www.apache.org/licenses/LICENSE-2.0
=======================================
--- /dev/null
+++ /trunk/third_party/java/jsonml/README Mon Sep 20 14:30:08 2010
@@ -0,0 +1,4 @@
+A parse tree representation based on
+http://code.google.com/p/es-lab/wiki/JsonMLASTFormat that allows parse
+trees to be round-tripped through closure compiler without an extra
+render and parse cycle that loses position info.
=======================================
---
/trunk/src/com/google/caja/demos/playground/client/ui/PlaygroundEditor.java
Thu Aug 5 23:43:16 2010
+++
/trunk/src/com/google/caja/demos/playground/client/ui/PlaygroundEditor.java
Mon Sep 20 14:30:08 2010
@@ -22,13 +22,14 @@
/**
* Editor that is a thin wrapper around CodeMirror
- *
+ *
* @author [email protected] (Jasvir Nagra)
*/
public class PlaygroundEditor extends Composite {
+ @SuppressWarnings("unused") // Used in GWT native methods
private JavaScriptObject editor;
private TextArea feralTextArea;
-
+
public PlaygroundEditor() {
feralTextArea = new TextArea();
initWidget(feralTextArea);
@@ -38,7 +39,7 @@
public void onLoad() {
editor = initialize(feralTextArea.getElement());
}
-
+
public native JavaScriptObject initialize(Element el) /*-{
var jsEditor = $wnd.CodeMirror.fromTextArea(el, {
parserfile: ["parsecss.js", "tokenizejavascript.js",
@@ -52,8 +53,8 @@
breakPoints: true,
});
return jsEditor;
- }-*/;
-
+ }-*/;
+
public native String getText() /*-{
var e = this.
@com.google.caja.demos.playground.client.ui.PlaygroundEditor::editor;
=======================================
---
/trunk/src/com/google/caja/demos/playground/client/ui/PlaygroundView.java
Tue Sep 14 16:08:36 2010
+++
/trunk/src/com/google/caja/demos/playground/client/ui/PlaygroundView.java
Mon Sep 20 14:30:08 2010
@@ -138,7 +138,7 @@
logoPanel.add(loadingLabel);
return logoPanel;
}
-
+
private Widget createSourcePanel() {
sourceExamples = new MultiWordSuggestOracle();
for (Example eg : Example.values()) {
@@ -536,6 +536,7 @@
return $wnd.prettyPrintOne($wnd.indentAndWrapCode(result));
}-*/;
+ @SuppressWarnings("unused") // Used in native GWT methods
private ScriptElement scriptOf(String text) {
Element el = DOM.createElement("script");
ScriptElement script = ScriptElement.as(el);
@@ -560,7 +561,7 @@
renderResult.setText(getRenderResult());
}
-
+
private native void setRenderedResultBridge(boolean es53,
Element div, String policy, String html, String js) /*-{
$wnd.caja___.enable(es53, div, policy, html, js);
=======================================
--- /trunk/src/com/google/caja/parser/html/OpenElementStack.java Mon Aug 16
13:03:24 2010
+++ /trunk/src/com/google/caja/parser/html/OpenElementStack.java Mon Sep 20
14:30:08 2010
@@ -101,9 +101,9 @@
boolean needsNamespaceFixup();
/**
- * Returns text with semicolons added to entities that lack them.
- * This may emit {...@link MessageType#MALFORMED_HTML_ENTITY} messages about
- * missing semicolons.
+ * Returns text with semicolons added to entities that lack them. This
may
+ * emit {...@link
com.google.caja.reporting.MessageType#MALFORMED_HTML_ENTITY}
+ * messages about missing semicolons.
* @param textPos the position of rawText in the input.
*/
String fixBrokenEntities(String rawText, FilePosition textPos);
=======================================
--- /trunk/src/com/google/caja/parser/js/CajoledModuleExpression.java Sat
Sep 4 11:51:37 2010
+++ /trunk/src/com/google/caja/parser/js/CajoledModuleExpression.java Mon
Sep 20 14:30:08 2010
@@ -77,8 +77,9 @@
.setAttribute(TagAttr.TYPE, "string")
.setAttribute(TagAttr.VALUE, "prepareModule").build();
return JsonMLBuilder.builder(TagType.InvokeExpr, pos)
+ .setAttribute(TagAttr.OP, ".")
.addChild(JsonMLBuilder.builder(
- TagType.LiteralExpr, FilePosition.startOf(pos))
+ TagType.IdExpr, FilePosition.startOf(pos))
.setAttribute(TagAttr.NAME, "___").build())
.addChild(prepareModuleFnName)
.addChild(getCajoledModule().getModuleBody())
=======================================
--- /trunk/src/com/google/caja/parser/js/Elision.java Fri Sep 3 17:29:26
2010
+++ /trunk/src/com/google/caja/parser/js/Elision.java Mon Sep 20 14:30:08
2010
@@ -35,8 +35,8 @@
/**
* This ctor is provided for reflection.
- * @param value unused.
- * @param children unused.
+ * @param op unused.
+ * @param operands unused.
*/
@ReflectiveCtor
public Elision(
=======================================
--- /trunk/src/com/google/caja/parser/js/JsonMLCompatible.java Fri Sep 3
17:29:26 2010
+++ /trunk/src/com/google/caja/parser/js/JsonMLCompatible.java Mon Sep 20
14:30:08 2010
@@ -28,7 +28,7 @@
* format that can then be converted into a parse tree for another tool
such as
* closure compiler.
*
- * @athor Mike Samuel <[email protected]>
+ * @author Mike Samuel <[email protected]>
*/
public interface JsonMLCompatible {
=======================================
--- /trunk/src/com/google/caja/parser/js/JsonMLConverter.java Fri Sep 3
17:29:26 2010
+++ /trunk/src/com/google/caja/parser/js/JsonMLConverter.java Mon Sep 20
14:30:08 2010
@@ -199,8 +199,6 @@
String regex = "/" + jsonML.getAttribute(TagAttr.BODY) + "/" +
flags;
return new RegexpLiteral(pos, regex);
}
- case ResultExpr:
- throw new IllegalArgumentException(jsonML.toString());
case ThisExpr:
return new Reference(new Identifier(pos, "this"));
case BlockStmt: case Program:
=======================================
--- /trunk/src/com/google/caja/parser/js/NumberLiteral.java Fri Sep 3
17:29:26 2010
+++ /trunk/src/com/google/caja/parser/js/NumberLiteral.java Mon Sep 20
14:30:08 2010
@@ -192,7 +192,7 @@
double d = value.doubleValue();
if (Double.isNaN(d) || Double.isInfinite(d)) {
NumberLiteral num = new IntegerLiteral(
- FilePosition.startOf(pos), d == d ? d < 0 ? -1 : 1 : 0);
+ FilePosition.startOf(pos), Double.isNaN(d) ? 0 : d < 0 ? -1 :
1);
NumberLiteral den = new IntegerLiteral(FilePosition.endOf(pos), 0);
return Operation.createInfix(Operator.DIVISION, num,
den).toJsonML();
}
=======================================
--- /trunk/src/com/google/caja/tools/EnumsToJs.java Tue Aug 24 13:37:35 2010
+++ /trunk/src/com/google/caja/tools/EnumsToJs.java Mon Sep 20 14:30:08 2010
@@ -37,8 +37,8 @@
*/
public final class EnumsToJs implements BuildCommand {
- public boolean build(List<File> inputs, List<File> dependencies, File
output)
- throws IOException {
+ public boolean build(
+ List<File> inputs, List<File> dependencies, File output) {
List<Class<? extends Enum<?>>> enumClasses = loadEnumClasses(
inputs, System.err);
if (enumClasses == null) { return false; }
=======================================
--- /trunk/src/com/google/caja/util/RhinoExecutor.java Fri Aug 6 18:54:18
2010
+++ /trunk/src/com/google/caja/util/RhinoExecutor.java Mon Sep 20 14:30:08
2010
@@ -137,7 +137,7 @@
// Deny reflective access up front. This should not be
triggered due
// to getter filtering, but let's be paranoid.
if (javaObject != null
- && (javaObject instanceof Class
+ && (javaObject instanceof Class<?>
|| javaObject instanceof ClassLoader
|| "java.lang.reflect".equals(
javaObject.getClass().getPackage().getName()))) {
=======================================
--- /trunk/third_party/java/jsonml/jsonml.jar Fri Sep 3 17:29:26 2010
+++ /trunk/third_party/java/jsonml/jsonml.jar Mon Sep 20 14:30:08 2010
Binary file, no diff available.