summaryrefslogtreecommitdiffstats
path: root/match.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-09-23 13:33:37 -0700
committerKaz Kylheku <kaz@kylheku.com>2011-09-23 13:33:37 -0700
commit9974fbd107663e9fa6f23cca5eea1732b33dacb5 (patch)
tree01b4d6a3c9c7c10c2d1c709104bb3aced54147b6 /match.c
parentfe9d54633ec915d2a9e039e9e4ac4b64e91f6063 (diff)
downloadtxr-9974fbd107663e9fa6f23cca5eea1732b33dacb5.tar.gz
txr-9974fbd107663e9fa6f23cca5eea1732b33dacb5.tar.bz2
txr-9974fbd107663e9fa6f23cca5eea1732b33dacb5.zip
* match.c (match_files): Some cleanup in preparation of new
features. Support for obsolescent @(next) syntax is gone.
Diffstat (limited to 'match.c')
-rw-r--r--match.c55
1 files changed, 27 insertions, 28 deletions
diff --git a/match.c b/match.c
index 299246d1..dd30f72f 100644
--- a/match.c
+++ b/match.c
@@ -1065,37 +1065,45 @@ repeat_spec_same_data:
if (rest(first_spec) && rest(specline))
sem_error(spec_linenum, lit("invalid combination of old "
"and new next syntax"), nao);
+ if (rest(specline)) {
+ sem_error(spec_linenum, lit("obsolete next syntax: trailing material"), nao);
+ }
if ((spec = rest(spec)) == nil)
break;
if (rest(first_spec)) {
val source = rest(first_spec);
-
- if (eq(first(source), nothrow_k))
- push(nil, &source);
- else if (eq(first(source), args_k)) {
- val input_name = string(L"args");
- cons_bind (new_bindings, success,
- match_files(spec, cons(input_name, files),
- bindings, files, one));
- if (success)
- return cons(new_bindings,
- if3(data, cons(data, num(data_lineno)), t));
- return nil;
+ val keyword = first(source);
+ val arg = keyword;
+
+ if (keywordp(keyword)) {
+ if (eq(keyword, nothrow_k)) {
+ sem_error(spec_linenum, lit("misplaced :nothrow"), nao);
+ } else if (eq(keyword, args_k)) {
+ val input_name = string(L"args");
+ cons_bind (new_bindings, success,
+ match_files(spec, cons(input_name, files),
+ bindings, files, one));
+ if (success)
+ return cons(new_bindings,
+ if3(data, cons(data, num(data_lineno)), t));
+ return nil;
+ }
+ arg = second(source);
}
{
- val value = eval_form(first(source), bindings);
- val name = cdr(value);
+ val eval = eval_form(arg, bindings);
+ val str = cdr(eval);
- if (!value)
+ if (!eval)
sem_error(spec_linenum, lit("next: unbound variable in form ~a"),
first(source), nao);
if (eq(second(source), nothrow_k)) {
- if (name) {
- files = cons(cons(nothrow_k, name), files);
+ if (str) {
+ files = cons(cons(nothrow_k, str), files);
} else {
files = rest(files);
if (!files) {
@@ -1105,8 +1113,8 @@ repeat_spec_same_data:
files = cons(cons(nothrow_k, first(files)), rest(files));
}
} else {
- if (name) {
- files = cons(name, files);
+ if (str) {
+ files = cons(str, files);
} else {
files = rest(files);
if (!files)
@@ -1115,15 +1123,6 @@ repeat_spec_same_data:
}
}
}
- } else if (rest(specline)) {
- val sub = subst_vars(rest(specline), bindings);
- val str = cat_str(sub, nil);
- if (str == nil) {
- sem_error(spec_linenum, lit("bad substitution in next file spec"),
- nao);
- continue;
- }
- files = cons(cons(nothrow_k, str), files);
} else {
files = rest(files);
if (!files)