summaryrefslogtreecommitdiffstats
path: root/match.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-02-16 16:03:38 -0800
committerKaz Kylheku <kaz@kylheku.com>2018-02-16 16:03:38 -0800
commit4c8dfaaf842db7c8e34d34b83d9cf38627f120da (patch)
tree8f80502cd7a821fa7c0fe9ba45cb4ad7043f78f1 /match.c
parent9a78780d28d1e74f66338376f9604b4773161d8a (diff)
downloadtxr-4c8dfaaf842db7c8e34d34b83d9cf38627f120da.tar.gz
txr-4c8dfaaf842db7c8e34d34b83d9cf38627f120da.tar.bz2
txr-4c8dfaaf842db7c8e34d34b83d9cf38627f120da.zip
Lisp load function supports .txr files.
* eval.c (load): Instead of throwing error when a .txr file is opened, process it according to sensible requirements. * match.c (v_load): Store bindings in the current environment frame before evaluating Lisp, and then update afterward. This allows .txr files loaded from Lisp to continue matching with the current bindings and extend those bindings. * txr.1: Update documentation of load.
Diffstat (limited to 'match.c')
-rw-r--r--match.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/match.c b/match.c
index 5ce37849..10fd1770 100644
--- a/match.c
+++ b/match.c
@@ -4308,11 +4308,15 @@ static val v_load(match_files_ctx *c)
}
}
} else {
+ uw_set_match_context(cons(c->spec, c->bindings));
+
if (!read_eval_stream(stream, std_error)){
close_stream(stream, nil);
sem_error(specline, lit("load: ~a contains errors"), path, nao);
}
+ c->bindings = cdr(uw_get_match_context());
+
ret = (sym == include_s) ? nil : next_spec_k;
}