summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
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
+}