summaryrefslogtreecommitdiffstats
path: root/match.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-09-27 19:34:49 -0700
committerKaz Kylheku <kaz@kylheku.com>2011-09-27 19:34:49 -0700
commitc9de9a30bd682bd3d36f87e47f4b1dd9d5854dd9 (patch)
treefaea785e5bfd8b48df6e07bd2888ed8b13bcd8f1 /match.c
parent0a6161f1d4c617582cab236042eea6a628e81bd3 (diff)
downloadtxr-c9de9a30bd682bd3d36f87e47f4b1dd9d5854dd9.tar.gz
txr-c9de9a30bd682bd3d36f87e47f4b1dd9d5854dd9.tar.bz2
txr-c9de9a30bd682bd3d36f87e47f4b1dd9d5854dd9.zip
* match.c (match_files): One more fix to this, argh.
The test for !data should be done after matching, before incrementing to the next line. Then it is a true bottom of the loop test. This commit allows @(skip) @first_line @(skip nil 3) @(eof) to correctly match the first line of the input, not the fourth one from the bottom, since the second skip has an unbounded range.
Diffstat (limited to 'match.c')
-rw-r--r--match.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/match.c b/match.c
index ab0cd9ae..a00064ca 100644
--- a/match.c
+++ b/match.c
@@ -978,24 +978,24 @@ repeat_spec_same_data:
{
cnum reps_max = 0, reps_min = 0;
- cnum old_lineno = data_lineno;
uw_block_begin(nil, result);
- while (data && min && reps_min++ < cmin) {
+ while (data && min && reps_min < cmin) {
data = rest(data);
data_lineno++;
+ reps_min++;
}
if (min) {
if (reps_min != cmin) {
- debuglf(spec_linenum, lit("skipped ~a/~a lines to ~a:~a"),
- num(data_lineno - old_lineno), num(cmin),
+ debuglf(spec_linenum, lit("skipped only ~a/~a lines to ~a:~a"),
+ num(reps_min), num(cmin),
first(files), num(data_lineno), nao);
uw_block_return(nil, nil);
}
debuglf(spec_linenum, lit("skipped ~a lines to ~a:~a"),
- num(data_lineno - old_lineno), first(files),
+ num(reps_min), first(files),
num(data_lineno), nao);
}
@@ -1009,13 +1009,13 @@ repeat_spec_same_data:
break;
}
+ if (!data)
+ break;
+
debuglf(spec_linenum, lit("skip didn't match ~a:~a"), first(files),
num(data_lineno), nao);
data = rest(data);
data_lineno++;
-
- if (!data)
- break;
}
uw_block_end;