diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2011-09-27 13:29:49 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2011-09-27 13:29:49 -0700 |
commit | 0a4e0f2ff76761efe933d4ccae4c17efa286f4e3 (patch) | |
tree | bb5230f4d00084d5216438f56df0779efc1391b7 | |
parent | 2722c5140685064be3df771eb9c0e0feff4fded0 (diff) | |
download | txr-0a4e0f2ff76761efe933d4ccae4c17efa286f4e3.tar.gz txr-0a4e0f2ff76761efe933d4ccae4c17efa286f4e3.tar.bz2 txr-0a4e0f2ff76761efe933d4ccae4c17efa286f4e3.zip |
* lib.c (eof_s): New symbol variable.
(obj_init): New variable initialized.
* lib.h (eof_s): Declared.
* match.c (match_files): New @(eof) directive explicitly
matches end of data.
* txr.1: Updated.
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | lib.c | 3 | ||||
-rw-r--r-- | lib.h | 2 | ||||
-rw-r--r-- | match.c | 8 | ||||
-rw-r--r-- | txr.1 | 4 |
5 files changed, 27 insertions, 2 deletions
@@ -1,3 +1,15 @@ +2011-09-27 Kaz Kylheku <kaz@kylheku.com> + + * lib.c (eof_s): New symbol variable. + (obj_init): New variable initialized. + + * lib.h (eof_s): Declared. + + * match.c (match_files): New @(eof) directive explicitly + matches end of data. + + * txr.1: Updated. + 2011-09-26 Kaz Kylheku <kaz@kylheku.com> Version 037 @@ -60,7 +60,7 @@ val all_s, some_s, none_s, maybe_s, cases_s, collect_s, until_s, coll_s; val define_s, output_s, single_s, first_s, last_s, empty_s; val repeat_s, rep_s, flatten_s, forget_s; val local_s, merge_s, bind_s, cat_s; -val try_s, catch_s, finally_s, throw_s, defex_s, deffilter_s; +val try_s, catch_s, finally_s, throw_s, defex_s, deffilter_s, eof_s; val error_s, type_error_s, internal_error_s; val numeric_error_s, range_error_s; val query_error_s, file_error_s, process_error_s; @@ -2132,6 +2132,7 @@ static void obj_init(void) throw_s = intern(lit("throw"), user_package); defex_s = intern(lit("defex"), user_package); deffilter_s = intern(lit("deffilter"), user_package); + eof_s = intern(lit("eof"), user_package); error_s = intern(lit("error"), user_package); type_error_s = intern(lit("type_error"), user_package); internal_error_s = intern(lit("internal_error"), user_package); @@ -227,7 +227,7 @@ extern val all_s, some_s, none_s, maybe_s, cases_s, collect_s, until_s, coll_s; extern val define_s, output_s, single_s, first_s, last_s, empty_s; extern val repeat_s, rep_s, flatten_s, forget_s; extern val local_s, merge_s, bind_s, cat_s; -extern val try_s, catch_s, finally_s, throw_s, defex_s, deffilter_s; +extern val try_s, catch_s, finally_s, throw_s, defex_s, deffilter_s, eof_s; extern val error_s, type_error_s, internal_error_s; extern val numeric_error_s, range_error_s; extern val query_error_s, file_error_s, process_error_s; @@ -1707,6 +1707,14 @@ repeat_spec_same_data: if ((spec = rest(spec)) == nil) break; goto repeat_spec_same_data; + } else if (sym == eof_s) { + if (data) { + debugf(lit("eof failed to match at ~a"), num(data_lineno), nao); + return nil; + } + if ((spec = rest(spec)) == nil) + break; + goto repeat_spec_same_data; } else { val func = uw_get_func(sym); @@ -854,6 +854,10 @@ argument material. Most directives must be the first item of a line. A summary of the available directives follows: +.IP @(eof) +Explicitly match the end of file. Fails if unmatched data remains in +the input stream. + .IP @(next) Continue matching in another file. |