From e564e0af5c2f7b9732e89707655068e507579a89 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 8 Jan 2015 10:21:30 -0800 Subject: Use linked list instead of arrays for AST. Use the same doubly linked node structure that cmark uses. The primary advantages of this change are (a) simplified code, especially in the renderers, and (b) elimination of the need for recursion, so we can render deeply-nested structures without a stack overflow. A node walker has also been added, for easy AST traversal. * Added js/lib/node.js for nodes. Includes a node walker. * All modules updated to use node structures. * Regularized position information into pos property. * Performance is slightly worse than before, but only marginally, and no doubt there are more optimizations that can be done. --- js/bin/commonmark | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/bin/commonmark') diff --git a/js/bin/commonmark b/js/bin/commonmark index 3c222f8..ac53e6e 100755 --- a/js/bin/commonmark +++ b/js/bin/commonmark @@ -14,7 +14,7 @@ var files = []; if (process.argv[2] === '--ast') { files = process.argv.slice(3); renderer = { render: function(x) { - return util.inspect(x, null, Infinity) + '\n'; + return util.inspect(x.toAST(), null, Infinity, true) + '\n'; } }; } else { files = process.argv.slice(2); -- cgit v1.2.3