summaryrefslogtreecommitdiffstats
path: root/regex.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2009-10-30 17:34:12 -0800
committerKaz Kylheku <kaz@kylheku.com>2009-10-30 17:34:12 -0800
commit4b493073a6deafa6b4ac6386a0eab034e0e20082 (patch)
treeeb2dfcef8f75ff7cceeda12e841623e0caa28771 /regex.c
parentd79ac8185c3533a5ea89c4a7e12b01f64f349e30 (diff)
downloadtxr-4b493073a6deafa6b4ac6386a0eab034e0e20082.tar.gz
txr-4b493073a6deafa6b4ac6386a0eab034e0e20082.tar.bz2
txr-4b493073a6deafa6b4ac6386a0eab034e0e20082.zip
Trivial change allows regexps to be bound to variables,
and used for matching. This Just Works because of the way match_line treats variables.
Diffstat (limited to 'regex.c')
-rw-r--r--regex.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/regex.c b/regex.c
index 51c95bc4..926ae4fd 100644
--- a/regex.c
+++ b/regex.c
@@ -593,6 +593,11 @@ obj_t *regex_compile(obj_t *regex_sexp)
return cobj(pnfa, regex, &regex_obj_ops);
}
+obj_t *regexp(obj_t *obj)
+{
+ return (obj->co.type == COBJ && obj->co.cls == regex) ? t : nil;
+}
+
nfa_t *regex_nfa(obj_t *reg)
{
assert (reg->co.type == COBJ && reg->co.cls == regex);