aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2021-08-01 13:45:51 -0700
committerBruce Hill <bruce@bruce-hill.com>2021-08-01 13:45:51 -0700
commit8268e67875abeaae99d0793e424514662a84628d (patch)
tree70120e92618860374016af294e31bdf135404dee
parentd3c1526f71a083b98b7ac8833434cd0347d8fc7f (diff)
Bugfix for replacing @0
-rw-r--r--Makefile1
-rw-r--r--print.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 0a9cb22..7b3bc8f 100644
--- a/Makefile
+++ b/Makefile
@@ -43,6 +43,7 @@ clean:
rm -f $(NAME) $(OBJFILES)
test: $(NAME)
+ ./$(NAME) Comment -r '[@0]'
./$(NAME) -g ./grammars/bp.bp -p Grammar ./grammars/bp.bp
leaktest: bp
diff --git a/print.c b/print.c
index e4e8ef8..6cccba2 100644
--- a/print.c
+++ b/print.c
@@ -130,7 +130,7 @@ static void _print_match(FILE *out, printer_t *pr, match_t *m)
// Capture substitution
if (*r == '@' && r[1] && r[1] != '@') {
++r;
- match_t *cap = get_capture(m, &r);
+ match_t *cap = get_capture(m->children[0], &r);
if (cap != NULL) {
_print_match(out, pr, cap);
if (pr->use_color && current_color != color_replace) {