From 8268e67875abeaae99d0793e424514662a84628d Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 1 Aug 2021 13:45:51 -0700 Subject: Bugfix for replacing @0 --- Makefile | 1 + print.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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) { -- cgit v1.2.3