From 9974fbd107663e9fa6f23cca5eea1732b33dacb5 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 23 Sep 2011 13:33:37 -0700 Subject: * match.c (match_files): Some cleanup in preparation of new features. Support for obsolescent @(next) syntax is gone. --- ChangeLog | 7 ++++++- match.c | 55 +++++++++++++++++++++++++++---------------------------- 2 files changed, 33 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9d2b76b3..58869bd3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,9 @@ -2011-09-21 Kaz Kylheku +2011-09-23 Kaz Kylheku + + * match.c (match_files): Some cleanup in preparation of new + features. Support for obsolescent @(next) syntax is gone. + +2011-09-23 Kaz Kylheku Semantics tweak: short circuiting behavior for @(all) and @(none). 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) -- cgit v1.2.3