diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2011-09-23 13:33:37 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2011-09-23 13:33:37 -0700 |
commit | 9974fbd107663e9fa6f23cca5eea1732b33dacb5 (patch) | |
tree | 01b4d6a3c9c7c10c2d1c709104bb3aced54147b6 | |
parent | fe9d54633ec915d2a9e039e9e4ac4b64e91f6063 (diff) | |
download | txr-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.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | match.c | 55 |
2 files changed, 33 insertions, 29 deletions
@@ -1,4 +1,9 @@ -2011-09-21 Kaz Kylheku <kaz@kylheku.com> +2011-09-23 Kaz Kylheku <kaz@kylheku.com> + + * match.c (match_files): Some cleanup in preparation of new + features. Support for obsolescent @(next) syntax is gone. + +2011-09-23 Kaz Kylheku <kaz@kylheku.com> Semantics tweak: short circuiting behavior for @(all) and @(none). @@ -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) |