From ffcb9954a9ab4c0ddbc9458be67f9c40ab13ae7a Mon Sep 17 00:00:00 2001
From: Thomas Voss <mail@thomasvoss.com>
Date: Wed, 13 Nov 2024 19:49:18 +0100
Subject: Print the regex that failed to compile

---
 src/main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'src')

diff --git a/src/main.c b/src/main.c
index 40c9de4..1679da1 100644
--- a/src/main.c
+++ b/src/main.c
@@ -367,7 +367,8 @@ pattern_comp(u8view_t pat)
 			if (op.re == nullptr) {
 				/* TODO: Print which regex failed to compile */
 				pcre2_bitch_and_die(
-					ec, "failed to compile regex at byte offset %zu", eoff);
+					ec, "failed to compile regex %s%.*s%s at byte offset %zu",
+					lquot, SV_PRI_ARGS(re), rquot, eoff);
 			}
 			if ((ec = pcre2_jit_compile(op.re, PCRE2_JIT_COMPLETE)) != 0)
 				pcre2_bitch_and_die(ec, "failed to JIT compile regex");
-- 
cgit v1.2.3