Bugfix for replacing @0

This commit is contained in:
Bruce Hill 2021-08-01 13:45:51 -07:00
parent d3c1526f71
commit 8268e67875
2 changed files with 2 additions and 1 deletions

View File

@ -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

View File

@ -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) {