aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2020-09-28 22:22:05 -0700
committerBruce Hill <bruce@bruce-hill.com>2020-09-28 22:22:05 -0700
commitf2f10586bb446cf3c6a3d7cc0965005e94dfcc81 (patch)
tree6ce6d6647fc3c1d24ffe4c0825bef4460eaa574d
parentf7430e443a8882021d619ecf51f95ee682e5d27d (diff)
Bugfixes
-rw-r--r--bpeg.c7
-rw-r--r--vm.c2
2 files changed, 5 insertions, 4 deletions
diff --git a/bpeg.c b/bpeg.c
index 651577e..e1b603f 100644
--- a/bpeg.c
+++ b/bpeg.c
@@ -180,10 +180,11 @@ int main(int argc, char *argv[])
}
if (isatty(STDOUT_FILENO)) {
- file_t *is_tty_file = spoof_file("<is-tty>", flag);
- vm_op_t *p = bpeg_pattern(is_tty_file, "''");
+ char *epsilon = "''";
+ file_t *is_tty_file = spoof_file("<is-tty>", epsilon);
+ vm_op_t *p = bpeg_pattern(is_tty_file, epsilon);
check(p, "Failed to compile is-tty");
- add_def(g, is_tty_file, "''", "is-tty", p);
+ add_def(g, is_tty_file, epsilon, "is-tty", p);
}
vm_op_t *pattern = lookup(g, rule);
diff --git a/vm.c b/vm.c
index ac0a52a..ffcfdb0 100644
--- a/vm.c
+++ b/vm.c
@@ -545,7 +545,7 @@ static match_t *get_cap(match_t *m, const char **r)
match_t *cap = get_capture_named(m, name);
free(name);
*r = end;
- if (*end == ';') ++(*r);
+ if (**r == ';') ++(*r);
return cap;
}
return NULL;