From 530fb4b2354b5ee366d1c789e53a5236637cdbc9 Mon Sep 17 00:00:00 2001 From: Shaofei Cheng Date: Sun, 29 Apr 2012 16:02:41 +0800 Subject: [PATCH] fix several bugs --- samples/Beautifier.html | 142 ++++++ samples/Compressor.html | 85 ++++ samples/Highlighter.html | 55 +++ {tools => samples}/Visualizer.html | 16 +- source/Parser.js | 19 +- source/SyntaticalParser.js | 18 + tools/Compressor.html | 43 -- tools/HighLighter.html | 38 -- tools/grammar.html | 667 ----------------------------- 9 files changed, 312 insertions(+), 771 deletions(-) create mode 100644 samples/Beautifier.html create mode 100644 samples/Compressor.html create mode 100644 samples/Highlighter.html rename {tools => samples}/Visualizer.html (81%) delete mode 100644 tools/Compressor.html delete mode 100644 tools/HighLighter.html delete mode 100644 tools/grammar.html diff --git a/samples/Beautifier.html b/samples/Beautifier.html new file mode 100644 index 0000000..5be895b --- /dev/null +++ b/samples/Beautifier.html @@ -0,0 +1,142 @@ + + + + + +

+
+
+
\ No newline at end of file
diff --git a/samples/Compressor.html b/samples/Compressor.html
new file mode 100644
index 0000000..a12304b
--- /dev/null
+++ b/samples/Compressor.html
@@ -0,0 +1,85 @@
+
+
+
+
+
+

+
+
+
\ No newline at end of file
diff --git a/samples/Highlighter.html b/samples/Highlighter.html
new file mode 100644
index 0000000..f06165e
--- /dev/null
+++ b/samples/Highlighter.html
@@ -0,0 +1,55 @@
+
+
+
+
+
+

+
+
+
\ No newline at end of file
diff --git a/tools/Visualizer.html b/samples/Visualizer.html
similarity index 81%
rename from tools/Visualizer.html
rename to samples/Visualizer.html
index 109c6bb..dd6322c 100644
--- a/tools/Visualizer.html
+++ b/samples/Visualizer.html
@@ -11,7 +11,9 @@
     padding-left:30px;
 }
 
-
+
+
+
 
diff --git a/source/Parser.js b/source/Parser.js
index 334b7ad..d3f8af9 100644
--- a/source/Parser.js
+++ b/source/Parser.js
@@ -9,24 +9,7 @@
         {
             Object.defineProperty(terminalSymbolIndex, e, {});
         });
-    function Symbol(symbolName, token)
-    {
-        this.name = symbolName;
-        this.token = token;
-        this.childNodes = [];
-        this. toString  = 
-            function(indent)
-            {
-                if(!indent)
-                    indent = "";
-                if(this.childNodes.length == 1)
-                    return this.childNodes[0]. toString (indent);
-                var str = indent + this.name + (this.token != undefined && this.name != this.token ? ":" + this.token:"") + "\n";
-                for(var i = 0;i < this.childNodes.length;i++)
-                    str += this.childNodes[i]. toString (indent + "    ");
-                return str;
-            };
-    }
+
     this.parse = 
         function(source, onInputElement)
         {
diff --git a/source/SyntaticalParser.js b/source/SyntaticalParser.js
index beecddc..1670f82 100644
--- a/source/SyntaticalParser.js
+++ b/source/SyntaticalParser.js
@@ -80,6 +80,24 @@
     "SourceElements":[["SourceElement"], ["SourceElements", "SourceElement"]], "SourceElement":[["Statement"], ["FunctionDeclaration"]]
     
 };
+function Symbol(symbolName, token)
+{
+    this.name = symbolName;
+    this.token = token;
+    this.childNodes = [];
+    this. toString  = 
+        function(indent)
+        {
+            if(!indent)
+                indent = "";
+            if(this.childNodes.length == 1)
+                return this.childNodes[0]. toString (indent);
+            var str = indent + this.name + (this.token != undefined && this.name != this.token ? ":" + this.token:"") + "\n";
+            for(var i = 0;i < this.childNodes.length;i++)
+                str += this.childNodes[i]. toString (indent + "    ");
+            return str;
+        };
+}
 function SyntacticalParser()
 {
     var currentRule;
diff --git a/tools/Compressor.html b/tools/Compressor.html
deleted file mode 100644
index 2d977ce..0000000
--- a/tools/Compressor.html
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
-javascript code compressor
-
-
-
-
-
-
- - - \ No newline at end of file diff --git a/tools/HighLighter.html b/tools/HighLighter.html deleted file mode 100644 index 32e2565..0000000 --- a/tools/HighLighter.html +++ /dev/null @@ -1,38 +0,0 @@ - - - -

-
\ No newline at end of file
diff --git a/tools/grammar.html b/tools/grammar.html
deleted file mode 100644
index e3a164f..0000000
--- a/tools/grammar.html
+++ /dev/null
@@ -1,667 +0,0 @@
-
-
- - - -
-

-
-
-
\ No newline at end of file