From de235770913f286a42600f1e3ccf2205b5ff09c3 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 12 Sep 2024 01:04:53 -0400 Subject: Allow trailing whitespace in parens expressions --- builtins/functions.c | 1 + parse.c | 1 + 2 files changed, 2 insertions(+) diff --git a/builtins/functions.c b/builtins/functions.c index 51d0d189..b91180d4 100644 --- a/builtins/functions.c +++ b/builtins/functions.c @@ -221,6 +221,7 @@ public void start_test(const char *filename, int64_t start, int64_t end) if (filename && file) { for (int i = 0; i < 3*TEST_DEPTH; i++) fputc(' ', stderr); + // TODO: dedent indented multi-line expressions fprintf(stderr, USE_COLOR ? "\x1b[33;1m>> \x1b[0m%.*s\x1b[m\n" : ">> %.*s\n", (end - start), file->text + start); } ++TEST_DEPTH; diff --git a/parse.c b/parse.c index 8ce53944..d88ef043 100644 --- a/parse.c +++ b/parse.c @@ -458,6 +458,7 @@ PARSER(parse_parens) { whitespace(&pos); ast_t *expr = optional(ctx, &pos, parse_extended_expr); if (!expr) return NULL; + whitespace(&pos); expect_closing(ctx, &pos, ")", "I wasn't able to parse the rest of this expression"); // Update the span to include the parens: -- cgit v1.2.3