diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2009-10-30 17:34:12 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2009-10-30 17:34:12 -0800 |
commit | 4b493073a6deafa6b4ac6386a0eab034e0e20082 (patch) | |
tree | eb2dfcef8f75ff7cceeda12e841623e0caa28771 /regex.c | |
parent | d79ac8185c3533a5ea89c4a7e12b01f64f349e30 (diff) | |
download | txr-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.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -593,6 +593,11 @@ obj_t *regex_compile(obj_t *regex_sexp) return cobj(pnfa, regex, ®ex_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); |