From 8dd7315d3c319c735ec77dc874ebc37c300be3bc Mon Sep 17 00:00:00 2001 From: Jeremy Ruston Date: Tue, 3 Jan 2012 17:08:16 +0000 Subject: [PATCH] Changed function ordering to keep jshint happy It's a fastidious task master --- js/WikiTextCompiler.js | 229 +++++++++++++++++++++-------------------- 1 file changed, 115 insertions(+), 114 deletions(-) diff --git a/js/WikiTextCompiler.js b/js/WikiTextCompiler.js index 7ae1186e2..a47bb403a 100644 --- a/js/WikiTextCompiler.js +++ b/js/WikiTextCompiler.js @@ -17,6 +17,121 @@ var WikiTextCompiler = function(store,title,parser) { this.title = title; }; +// Compile a javascript tree into an array of string fragments +var compileJavaScript = function(tree) { + var output = [], + compileJavaScriptTree, + compileJavaScriptNode = function(node) { + var p; + switch(node.type) { + case "StringLiteral": + output.push(utils.stringify(node.value)); + break; + case "StringLiterals": + output.push(utils.stringify(node.value.join(""))); + break; + case "FunctionCall": + output.push("("); + compileJavaScriptNode(node.name); + output.push(")"); + output.push("("); + for(p=0; p