From 2cc166bafadd85ca85680997072c8380d039f8c9 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 19 Nov 2011 20:43:13 -0800 Subject: Bug #34866 * match.c (h_skip): Bugfix. Return the length of the line if the skip is to the end of line, not the value t. * txr.1: Clarify that @var@(skip)text is useless. --- ChangeLog | 9 +++++++++ match.c | 2 +- txr.1 | 8 +++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0f35be54..dd5fda61 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-11-19 Kaz Kylheku + + Bug #34866 + + * match.c (h_skip): Bugfix. Return the length of the line if + the skip is to the end of line, not the value t. + + * txr.1: Clarify that @var@(skip)text is useless. + 2011-11-19 Kaz Kylheku * match.c (v_deffilter): Even better. Just evaluate diff --git a/match.c b/match.c index bb3da027..3df2656c 100644 --- a/match.c +++ b/match.c @@ -621,7 +621,7 @@ static val h_skip(match_line_ctx c, match_line_ctx *cout) if (!rest(c.specline)) { debuglf(elem, lit("skip to end of line ~a:~a"), c.file, c.data_lineno, nao); - return cons(c.bindings, t); + return cons(c.bindings, length_str(c.dataline)); } { diff --git a/txr.1 b/txr.1 index f108639d..17c4307c 100644 --- a/txr.1 +++ b/txr.1 @@ -591,7 +591,7 @@ the trailing material did not occur. A variable may be followed by a piece of text, a regular expression directive, a function call, a directive, another variable, or nothing (i.e. occurs at the -end of a line). +end of a line). These cases are discussed in detail below. .SS Variable Followed by Nothing @@ -631,6 +631,12 @@ call, or a directive, the extent is determined by scanning the text for the first position where a match occurs for the regular expression, call or directive. (See Regular Expressions section below, and FUNCTIONS.) +Note that the given variable and the function or directive are considered +in isolation. This means, for instance, that @var@(skip)text is a degenerate +form. The @(skip) will be processed alone, without regard for the trailing +text and so consume the input to the end of the line. The right way to +express the most probable intent of this is @{var}text. + .SS Consecutive Variables If an unbound variable specified a fixed-width match or a regular expression, -- cgit v1.2.3