* Walks the AST and calls member methods for each Node type. * * @param ast {Node} The root of the abstract syntax tree.
(ast)
| 2610 | * @param ast {Node} The root of the abstract syntax tree. |
| 2611 | */ |
| 2612 | function render(ast) { |
| 2613 | var walker = ast.walker() |
| 2614 | , event |
| 2615 | , type; |
| 2616 | |
| 2617 | this.buffer = ''; |
| 2618 | this.lastOut = '\n'; |
| 2619 | |
| 2620 | while((event = walker.next())) { |
| 2621 | type = event.node.type; |
| 2622 | if (this[type]) { |
| 2623 | this[type](event.node, event.entering); |
| 2624 | } |
| 2625 | } |
| 2626 | return this.buffer; |
| 2627 | } |
| 2628 | |
| 2629 | /** |
| 2630 | * Concatenate a literal string to the buffer. |