diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2009-11-02 19:09:45 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2009-11-02 19:09:45 -0800 |
commit | 0f9f85d9edaa26285d596f5fe7ee04ff95a2aa84 (patch) | |
tree | 451a2b8684468d3ebe62b37f9b6cad4385a729f0 /match.c | |
parent | f6c4f253681b576f39d939e602e9de7bc1b8892b (diff) | |
download | txr-0f9f85d9edaa26285d596f5fe7ee04ff95a2aa84.tar.gz txr-0f9f85d9edaa26285d596f5fe7ee04ff95a2aa84.tar.bz2 txr-0f9f85d9edaa26285d596f5fe7ee04ff95a2aa84.zip |
Got regex working over lazy strings from freeform.
Bugfixes.
Diffstat (limited to 'match.c')
-rw-r--r-- | match.c | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -318,8 +318,7 @@ obj_t *match_line(obj_t *bindings, obj_t *specline, obj_t *dataline, } else if (nump(modifier)) { obj_t *past = plus(pos, modifier); - if (c_num(past) > c_num(length_str(dataline)) || - c_num(past) < c_num(pos)) + if (length_str_lt(dataline, past) || lt(past, pos)) { LOG_MISMATCH("fixed field size"); return nil; @@ -351,8 +350,7 @@ obj_t *match_line(obj_t *bindings, obj_t *specline, obj_t *dataline, pos = past; } else if (nump(modifier)) { obj_t *past = plus(pos, modifier); - if (c_num(past) > c_num(length_str(dataline)) || - c_num(past) < c_num(pos)) + if (length_str_lt(dataline, past) || lt(past, pos)) { LOG_MISMATCH("count based var"); return nil; @@ -466,12 +464,12 @@ obj_t *match_line(obj_t *bindings, obj_t *specline, obj_t *dataline, if (new_pos && !equal(new_pos, pos)) { pos = new_pos; - assert (c_num(pos) <= c_num(length_str(dataline))); + bug_unless (length_str_ge(dataline, pos)); } else { pos = plus(pos, one); } - if (c_num(pos) >= c_num(length_str(dataline))) + if (length_str_le(dataline, pos)) break; } @@ -984,7 +982,7 @@ repeat_spec_same_data: return nil; } } else if (sym == freeform) { - obj_t *args = rest(rest(first_spec)); + obj_t *args = rest(first_spec); obj_t *vals = mapcar(func_n1(cdr), mapcar(bind2other(func_n2(eval_form), bindings), args)); |