summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorWormHeamer2026-01-01 04:20:20 -0500
committerWormHeamer2026-01-01 04:20:20 -0500
commitfafa797d33d1e6fd0fa0cee9a8cd7eb90ba85782 (patch)
tree547c072101f9c511232b82d7867216c162100a2f /main.c
parentd862b833292133948e67bfd39a20d825bc80733e (diff)
regex error reporting
Diffstat (limited to 'main.c')
-rw-r--r--main.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/main.c b/main.c
index a1281a9..a6caab0 100644
--- a/main.c
+++ b/main.c
@@ -531,8 +531,9 @@ done:;
int search_next_regex(TxtLoc l, Str src, TxtLoc *out) {
RegEx re = { 0 };
ReSearch s = { 0 };
- if (re_comp_ex(&re, src, &e.scratch, &e.scratch, RE_COMP_NO_GROUPS)) {
- /* TODO: report parse error */
+ int err = re_comp_ex(&re, src, &e.scratch, &e.scratch, RE_COMP_NO_GROUPS);
+ if (err) {
+ e.msg = str_printf(&e.scratch, "Regex error: %s", re_comp_strerror(err));
return 0;
}
TxtLoc t = l;
@@ -561,8 +562,9 @@ search_from_start:
int search_prev_regex(TxtLoc start, Str src, TxtLoc *out) {
RegEx re = { 0 };
ReSearch s = { 0 };
- if (re_comp_ex(&re, src, &e.scratch, &e.scratch, RE_COMP_NO_GROUPS)) {
- /* TODO: report parse error */
+ int err = re_comp_ex(&re, src, &e.scratch, &e.scratch, RE_COMP_NO_GROUPS);
+ if (err) {
+ e.msg = str_printf(&e.scratch, "Regex error: %s", re_comp_strerror(err));
return 0;
}
int match_found = 0;
@@ -1251,4 +1253,4 @@ int main(int argc, const char **argv) {
vui_fini();
arena_free(&e.scratch);
return 0;
-} \ No newline at end of file
+}