import {parser} from "./parser.js" const source = ` if foo then bar else asdf ` const parse = (source) => parser.parse(source.concat("\n")) const tree = parse(source) const cursor = tree.cursor() const report = (out) => { console.log(out); return true; } const visit = (node) => { switch (node.type.name) { case "Script": return report("Starting Script"); case "If": return report("Starting If"); case "Word": return report(node.) } } cursor.iterate( (node) => (console.log("Entering", node.type.name), true), (node) => (console.log("Leaving", node.type.name)) )