aboutsummaryrefslogtreecommitdiff
path: root/src/formatter/formatter.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-09-21 16:54:36 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-09-21 16:54:36 -0400
commit1cec086a6034ad546977cae7aeaf4bb876d21970 (patch)
treecd2889aea7ca830359ba329a3f82b96e706bcdee /src/formatter/formatter.c
parent0ab878ff4f72f7f6f6f64c1fc5d8023cd19fbe82 (diff)
Deprecate `>> x ... = val` form of doctests and rename them to 'debugdoctests-to-debuglog
logs', also add multi-expression support
Diffstat (limited to 'src/formatter/formatter.c')
-rw-r--r--src/formatter/formatter.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/formatter/formatter.c b/src/formatter/formatter.c
index 69c1a213..42204b01 100644
--- a/src/formatter/formatter.c
+++ b/src/formatter/formatter.c
@@ -119,7 +119,7 @@ OptionalText_t format_inline_code(ast_t *ast, Table_t comments) {
/*inline*/ case Extend:
/*inline*/ case FunctionDef:
/*inline*/ case ConvertDef:
- /*inline*/ case DocTest:
+ /*inline*/ case DebugLog:
return NONE_TEXT;
/*inline*/ case Assert: {
DeclareMatch(assert, ast, Assert);
@@ -775,13 +775,13 @@ Text_t format_code(ast_t *ast, Table_t comments, Text_t indent) {
return Texts(termify(call->self, comments, indent), ".", Text$from_str(call->name), "(", args,
Text$has(args, Text("\n")) ? Texts("\n", indent) : EMPTY_TEXT, ")");
}
- /*multiline*/ case DocTest: {
- DeclareMatch(test, ast, DocTest);
- Text_t expr = fmt(test->expr, comments, indent);
- Text_t code = Texts(">> ", expr);
- if (test->expected) {
- Text_t expected = fmt(test->expected, comments, indent);
- code = Texts(code, "\n", indent, "= ", expected);
+ /*multiline*/ case DebugLog: {
+ DeclareMatch(debug, ast, DebugLog);
+ Text_t code = Texts(">> ");
+ for (ast_list_t *value = debug->values; value; value = value->next) {
+ Text_t expr = fmt(value->ast, comments, indent);
+ code = Texts(code, expr);
+ if (value->next) code = Texts(code, ", ");
}
return code;
}