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 @@ - - - - -