/*\ title: js/JavaScriptParseTree.js This object stores a JavaScript parse tree in the format produced by the pegjs JavaScript parser. The parse tree represents the syntactical structure of a JavaScript program, represented as a tree structure built from JavaScript arrays and objects. The nodes of the tree are objects with a "type" field that indicates the type of the node (see the function renderNode() for a list of the types). Depending on the type, other fields provide further details about the node. \*/ (function(){ /*jslint node: true */ "use strict"; var utils = require("./Utils.js"); // Create a new JavaScript tree object var JavaScriptParseTree = function(tree) { this.tree = tree; }; // Render the entire JavaScript tree object to JavaScript source code JavaScriptParseTree.prototype.render = function() { this.output = []; this.renderSubTree(this.tree); return this.output.join(""); }; // Render a subtree of the parse tree to an array of fragments of JavaScript source code JavaScriptParseTree.prototype.renderSubTree = function(tree) { for(var t=0; t