diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2012-03-01 16:19:43 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2012-03-01 16:19:43 -0800 |
commit | c99e75b3f7458084072743aaa38b8a56197084d6 (patch) | |
tree | f18f01c610cfbeaf6f8d0b27794e1d4c3841eb5b /match.c | |
parent | 99d8182e6b8dcc7ed772c78e9d417b9f528e3723 (diff) | |
download | txr-c99e75b3f7458084072743aaa38b8a56197084d6.tar.gz txr-c99e75b3f7458084072743aaa38b8a56197084d6.tar.bz2 txr-c99e75b3f7458084072743aaa38b8a56197084d6.zip |
* match.c (v_load): Fixed broken functionality. Failing to evaluate
directives following the load and consume input properly.
Diffstat (limited to 'match.c')
-rw-r--r-- | match.c | 25 |
1 files changed, 24 insertions, 1 deletions
@@ -3415,7 +3415,30 @@ static val v_load(match_files_ctx *c) gc_state(gc); { val spec = get_spec(); - return match_files(mf_spec(*c, spec)); + val result = match_files(mf_spec(*c, spec)); + + if (!result) { + debuglf(specline, lit("load: ~s failed"), path, nao); + return nil; + } else { + cons_bind (new_bindings, success, result); + + if (consp(success)) { + debuglf(specline, + lit("load: ~s matched; " + "advancing from line ~a to ~a"), + path, c->data_lineno, cdr(success), nao); + c->data = car(success); + c->data_lineno = cdr(success); + c->bindings = new_bindings; + } else { + debuglf(specline, lit("load: ~s consumed entire file"), path, + nao); + c->data = nil; + } + + return next_spec_k; + } } } } |