1 // This file defines utility functions for autoformatting code
8 #include "../stdlib/datatypes.h"
9 #include "../stdlib/optionals.h"
15 OptionalText_t _expr = expr; \
16 if (_expr.tag == TEXT_NONE) return NONE_TEXT; \
20 extern const Text_t single_indent;
22 void add_line(Text_t *code, Text_t line, Text_t indent);
23 OptionalText_t next_comment(Table_t comments, const char **pos, const char *end);
24 bool range_has_comment(const char *start, const char *end, Table_t comments);
25 CONSTFUNC int suggested_blank_lines(ast_t *first, ast_t *second);
26 Text_t indent_code(Text_t code);
27 Text_t parenthesize(Text_t code, Text_t indent);
28 CONSTFUNC ast_t *unwrap_block(ast_t *ast);
29 OptionalText_t termify_inline(ast_t *ast, Table_t comments);
30 Text_t termify(ast_t *ast, Table_t comments, Text_t indent);