summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--match.c5
2 files changed, 17 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index a9b65e4a..aeaf659a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
2011-09-27 Kaz Kylheku <kaz@kylheku.com>
+ * match.c (match_files): Bugfix in skip directive.
+ We should try the match at least once even if there is no data
+ after a hard skip, so that the query has an opportunity
+ to do an explicit match for no data, as with @(endp).
+ This commit makes possible queries like:
+ @fourth_line_from_bottom
+ @(skip 1 3)
+ @(eof)
+ This query depends on @(skip 1 3) not failing when
+ it runs out of data, because @(eof) checks for htis.
+
+2011-09-27 Kaz Kylheku <kaz@kylheku.com>
+
* lib.c (eof_s): New symbol variable.
(obj_init): New variable initialized.
diff --git a/match.c b/match.c
index 73435770..bb44ff52 100644
--- a/match.c
+++ b/match.c
@@ -992,7 +992,7 @@ repeat_spec_same_data:
num(data_lineno), nao);
}
- while (data && (!max || reps_max++ < cmax)) {
+ while (!max || reps_max++ < cmax) {
result = match_files(spec, files, bindings,
data, num(data_lineno));
@@ -1006,6 +1006,9 @@ repeat_spec_same_data:
num(data_lineno), nao);
data = rest(data);
data_lineno++;
+
+ if (!data)
+ break;
}
uw_block_end;