aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-12 01:04:53 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-12 01:04:53 -0400
commitde235770913f286a42600f1e3ccf2205b5ff09c3 (patch)
treeb980dd1f2436bc79beb4cb00fac90558e701a48c
parent327d466b9543aee3983277ca4158e5b7aa06fdf8 (diff)
Allow trailing whitespace in parens expressions
-rw-r--r--builtins/functions.c1
-rw-r--r--parse.c1
2 files changed, 2 insertions, 0 deletions
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: