summaryrefslogtreecommitdiffstats
path: root/match.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-03-01 16:19:43 -0800
committerKaz Kylheku <kaz@kylheku.com>2012-03-01 16:19:43 -0800
commitc99e75b3f7458084072743aaa38b8a56197084d6 (patch)
treef18f01c610cfbeaf6f8d0b27794e1d4c3841eb5b /match.c
parent99d8182e6b8dcc7ed772c78e9d417b9f528e3723 (diff)
downloadtxr-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.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/match.c b/match.c
index a65d6d00..66325ddd 100644
--- a/match.c
+++ b/match.c
@@ -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;
+ }
}
}
}