From 7efed55d76454af8c674b23fc40c4602da82c2cd Mon Sep 17 00:00:00 2001 From: Erik Rantapaa Date: Fri, 30 Jun 2017 23:41:55 -0500 Subject: [PATCH] Fix example code for constructing ASTs. Fixed the second example so it produces the same AST as the first. Also, I figured out that the variable `ast` was just the same as `tree`. Didn't do this, but the second example could also be formatted like the first to more clearly show the structure of the calls. --- lib/treehugger/tree.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/treehugger/tree.js b/lib/treehugger/tree.js index f271335..033a605 100644 --- a/lib/treehugger/tree.js +++ b/lib/treehugger/tree.js @@ -60,9 +60,9 @@ Node.prototype.findNode = function(pos) { * * Example: Add(Num("1"), Num("2")) is constucted * using new ConsNode(new ConsNode("Num", [new StringNode("1")]), - * new ConsNode("Num", [new StringNode("2")])) - * or, more briefly: - * tree.cons("Add", [tree.cons("Num", [ast.string("1"), ast.string("2")])]) + * new ConsNode("Num", [new StringNode("2")])) + * or, equivalently: + * tree.cons("Add", [tree.cons("Num", [tree.string("1")]) , tree.cons("Num", [tree.string("2")])]) */ function ConsNode(cons, children) { this.cons = cons;