about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEvan Silberman <evan@jklol.net>2024-11-11 12:22:00 -0800
committerLeah Neukirchen <leah@vuxu.org>2024-11-12 17:07:53 +0100
commite472b9a64c9f104a67f0503d46d7da7b28be1fc4 (patch)
treee7d313c1344351928f61141f1a6f9993343ff6c6
parent8c9e94a8b6e9fb0aad16baa21a5ab8d1e2719151 (diff)
downloadlr-e472b9a64c9f104a67f0503d46d7da7b28be1fc4.tar.gz
lr-e472b9a64c9f104a67f0503d46d7da7b28be1fc4.tar.xz
lr-e472b9a64c9f104a67f0503d46d7da7b28be1fc4.zip
skip leading -t expression whitespace HEAD master
Seems like there shouldn't be terrible consequences, the parse error
without it is hard to understand and took me a while to debug when I was
trying to use lr in a shell script like

    lr -t '
        -- nicely-formatted multiline expression goes here
    '

Message-ID: <2MWMP6HZDV8FW.2JYP28P850115@silby.fyi>
-rw-r--r--lr.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lr.c b/lr.c
index 17236c5..049b535 100644
--- a/lr.c
+++ b/lr.c
@@ -914,6 +914,7 @@ static struct expr *
 parse_expr(const char *s)
 {
 	pos = (char *)s;
+	ws();
 	struct expr *e = parse_cond();
 	if (*pos)
 		parse_error("trailing garbage at '%.15s'", pos);