aboutsummaryrefslogtreecommitdiff
path: root/compiler.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2020-09-28 17:10:13 -0700
committerBruce Hill <bruce@bruce-hill.com>2020-09-28 17:10:13 -0700
commit54b14a35573aed89670228e5cbfbd820da24aeaf (patch)
tree332e62e481f78e360f5ad42ba143c5694489940c /compiler.c
parentc15b118bb431bffaebb1f2a2d14c3f4e74a3218b (diff)
Tolerate spaces around `=` in @foo = baz
Diffstat (limited to 'compiler.c')
-rw-r--r--compiler.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler.c b/compiler.c
index 1f2d9ff..ba53579 100644
--- a/compiler.c
+++ b/compiler.c
@@ -267,9 +267,9 @@ vm_op_t *bpeg_simplepattern(file_t *f, const char *str)
case '@': {
op->op = VM_CAPTURE;
const char *a = *str == '!' ? &str[1] : after_name(str);
- if (a > str && a[0] == '=' && a[1] != '>') {
+ if (a > str && after_spaces(a)[0] == '=' && after_spaces(a)[1] != '>') {
op->args.capture.name = strndup(str, (size_t)(a-str));
- str = a + 1;
+ str = after_spaces(a) + 1;
}
vm_op_t *pat = bpeg_simplepattern(f, str);
check(pat, "Expected pattern after @");