summaryrefslogtreecommitdiffstats
path: root/regex.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-09-27 21:12:39 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-09-27 21:12:39 -0700
commitd7fa4564690c217d6ac6c62019938a84627f1468 (patch)
treecced3fb9b3e15d673aeffc6275bb9978955d7b7f /regex.c
parent8942eea65595fb5ecee17af71c466b44d1bce741 (diff)
downloadtxr-d7fa4564690c217d6ac6c62019938a84627f1468.tar.gz
txr-d7fa4564690c217d6ac6c62019938a84627f1468.tar.bz2
txr-d7fa4564690c217d6ac6c62019938a84627f1468.zip
Replace internal_error with exception throws in regex.
* regex.c (nfa_compile_regex, dv_compile_regex, reg_nullable, reg_matches_all, reg_derivative, regex_requires_dv): Throw an exception for the bad operator case.
Diffstat (limited to 'regex.c')
-rw-r--r--regex.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/regex.c b/regex.c
index 8a9bc6ef..8da87469 100644
--- a/regex.c
+++ b/regex.c
@@ -1042,7 +1042,7 @@ static nfa_t nfa_compile_regex(val exp)
nfa_state_empty_convert(nfa_second.accept, acc, 0);
return nfa_make(s, acc);
} else {
- internal_error("bad operator in regex");
+ uw_throwf(error_s, lit("bad operator in regex syntax: ~s"), sym, nao);
}
} else {
uw_throwf(error_s, lit("bad object in regex syntax: ~s"), exp, nao);
@@ -1395,7 +1395,7 @@ static val dv_compile_regex(val exp)
xsecond, nao);
}
} else {
- internal_error("bad operator in regex");
+ uw_throwf(error_s, lit("bad operator in regex syntax: ~s"), sym, nao);
}
} else {
uw_throwf(error_s, lit("bad object in regex syntax: ~s"), exp, nao);
@@ -1445,7 +1445,7 @@ static val reg_nullable(val exp)
} else if (sym == and_s) {
return if2((reg_nullable(first(args)) && reg_nullable(second(args))), t);
} else {
- internal_error("bad operator in regex");
+ uw_throwf(error_s, lit("bad operator in regex syntax: ~s"), sym, nao);
}
}
}
@@ -1486,7 +1486,7 @@ static val reg_matches_all(val exp)
} else if (sym == and_s) {
return tnil(reg_matches_all(pop(&args)) && reg_matches_all(pop(&args)));
} else {
- internal_error("bad operator in regex");
+ uw_throwf(error_s, lit("bad operator in regex syntax: ~s"), sym, nao);
}
}
}
@@ -1605,7 +1605,7 @@ static val reg_derivative(val exp, val ch)
val args = rest(exp);
if (sym == set_s || sym == cset_s) {
- internal_error("uncompiled regex passed to reg_derivative");
+ uw_throwf(error_s, lit("uncompiled regex passed to reg_derivative"));
} else if (sym == compound_s) {
return reg_derivative_list(args, ch);
} else if (sym == optional_s) {
@@ -1660,7 +1660,7 @@ static val reg_derivative(val exp, val ch)
return cons(and_s, cons(d_arg1, cons(d_arg2, nil)));
} else {
- internal_error("bad operator in regex");
+ uw_throwf(error_s, lit("bad operator in regex syntax: ~s"), sym, nao);
}
}
}
@@ -1709,7 +1709,7 @@ static val regex_requires_dv(val exp)
} else if (sym == and_s || sym == nongreedy_s) {
return t;
} else {
- internal_error("bad operator in regex");
+ uw_throwf(error_s, lit("bad operator in regex syntax: ~s"), sym, nao);
}
}
}