| 1 | /** |
| 2 | * @file prettyprint.h |
| 3 | * |
| 4 | * An AST node pretty-printer. |
| 5 | */ |
| 6 | #ifndef PRISM_PRETTYPRINT_H |
| 7 | #define PRISM_PRETTYPRINT_H |
| 8 | |
| 9 | #include "prism/defines.h" |
| 10 | |
| 11 | #ifdef PRISM_EXCLUDE_PRETTYPRINT |
| 12 | |
| 13 | void pm_prettyprint(void); |
| 14 | |
| 15 | #else |
| 16 | |
| 17 | #include <stdio.h> |
| 18 | |
| 19 | #include "prism/ast.h" |
| 20 | #include "prism/parser.h" |
| 21 | #include "prism/util/pm_buffer.h" |
| 22 | |
| 23 | /** |
| 24 | * Pretty-prints the AST represented by the given node to the given buffer. |
| 25 | * |
| 26 | * @param output_buffer The buffer to write the pretty-printed AST to. |
| 27 | * @param parser The parser that parsed the AST. |
| 28 | * @param node The root node of the AST to pretty-print. |
| 29 | */ |
| 30 | PRISM_EXPORTED_FUNCTION void pm_prettyprint(pm_buffer_t *output_buffer, const pm_parser_t *parser, const pm_node_t *node); |
| 31 | |
| 32 | #endif |
| 33 | |
| 34 | #endif |