diff options
| author | WormHeamer | 2026-01-01 04:20:20 -0500 |
|---|---|---|
| committer | WormHeamer | 2026-01-01 04:20:20 -0500 |
| commit | fafa797d33d1e6fd0fa0cee9a8cd7eb90ba85782 (patch) | |
| tree | 547c072101f9c511232b82d7867216c162100a2f /main.c | |
| parent | d862b833292133948e67bfd39a20d825bc80733e (diff) | |
regex error reporting
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -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 +} |
