summaryrefslogtreecommitdiffstats
path: root/match.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-01-02 09:37:27 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-01-02 09:37:27 -0800
commite694dde54a71cad3e2df5b28400aac8c7d564932 (patch)
treed53c8ee9274a1b890b621bd94f9e171973b264f3 /match.c
parent31c0ddaa876f22274193f6656498d247e42236e6 (diff)
downloadtxr-e694dde54a71cad3e2df5b28400aac8c7d564932.tar.gz
txr-e694dde54a71cad3e2df5b28400aac8c7d564932.tar.bz2
txr-e694dde54a71cad3e2df5b28400aac8c7d564932.zip
Use last-form-evaled mechanism for pattern language.
We need this now, since file system errors aren't handled in the pattern language any more, after the complex_open refactoring. * eval.c (set_last_form_evaled): New function. * eval.h (set_last_form_evaled): Declared. * match.c (do_match_line, match_files): Save, set up and restore last_form_evaled via set_last_form_evaled function.
Diffstat (limited to 'match.c')
-rw-r--r--match.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/match.c b/match.c
index cd57e946..3c78e651 100644
--- a/match.c
+++ b/match.c
@@ -1229,21 +1229,20 @@ static val v_fun(match_files_ctx *c);
static val do_match_line(match_line_ctx *c)
{
+ val lfe_save = set_last_form_evaled(nil);
+
debug_enter;
- for (;;) {
- val elem;
+ while (c->specline) {
+ val elem = first(c->specline);
- if (c->specline == nil)
- break;
+ set_last_form_evaled(elem);
if (c->pos == t)
c->pos = length_str(c->dataline);
consume_prefix(c);
- elem = first(c->specline);
-
debug_check(c->specline, c->bindings, c->dataline, c->data_lineno,
c->pos, c->base);
@@ -1348,6 +1347,8 @@ static val do_match_line(match_line_ctx *c)
debug_return (cons(c->bindings, plus(c->pos, c->base)));
debug_leave;
+
+ set_last_form_evaled(lfe_save);
}
static val match_line(match_line_ctx c)
@@ -3882,6 +3883,7 @@ repeat_spec_same_data:
debug_check(specline, c.bindings, c.data, c.data_lineno, nil, nil);
if (consp(first_spec) && !rest(specline)) {
+ val lfe_save = set_last_form_evaled(first_spec);
val sym = first(first_spec);
val entry = gethash(v_directive_table, sym);
@@ -3891,6 +3893,8 @@ repeat_spec_same_data:
result = vmf(&c);
+ set_last_form_evaled(lfe_save);
+
if (result == next_spec_k) {
if ((c.spec = rest(c.spec)) == nil)
break;
@@ -3903,6 +3907,8 @@ repeat_spec_same_data:
} else {
val result = v_fun(&c);
+ set_last_form_evaled(lfe_save);
+
if (result == next_spec_k) {
if ((c.spec = rest(c.spec)) == nil)
break;