From 849d39783113dab5f3130e3e59cd8b30f53b136e Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Fri, 1 Nov 2024 20:48:33 +0100 Subject: Print the compile error offset --- src/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index f702842..a23ff56 100644 --- a/src/main.c +++ b/src/main.c @@ -343,8 +343,10 @@ pattern_comp(u8view_t pat) int ec; size_t eoff; op.re = pcre2_compile(re.p, re.len, reopts, &ec, &eoff, nullptr); - if (op.re == nullptr) - pcre2_bitch_and_die(ec, "failed to compile regex: %s"); + if (op.re == nullptr) { + pcre2_bitch_and_die( + ec, "failed to compile regex at byte offset %zu: %s", eoff); + } if ((ec = pcre2_jit_compile(op.re, PCRE2_JIT_COMPLETE)) != 0) { pcre2_bitch_and_die(ec, "failed to JIT compile regex: %s"); rv = EXIT_WARNING; -- cgit v1.2.3