Commit fe33901
committed
t: fix Lexer line count for $() inside double-quoted strings
scan_dqstring's post-loop newline counter re-counts newlines that
were already counted during recursive parsing of $() bodies. This
happens because scan_dollar returns text containing newlines (from
multi-line command substitutions), and the catch-all counter at the
end of scan_dqstring counts all of them again.
Fix this by counting newlines inline as non-special characters are
consumed, and removing the post-loop catch-all. Each newline is
now counted exactly once: literal newlines at the inline match,
line splices at the backslash handler, and $() newlines by
scan_token during the recursive parse.
This does not affect chainlint's output because chainlint annotates
the original body text using byte offsets, not token line numbers.
It matters for greplint.pl (introduced in a subsequent commit) which
uses token line numbers to report the source location of bare grep
assertions.
Signed-off-by: Michael Montalbo <mmontalbo@gmail.com>1 parent a7e3fb1 commit fe33901
1 file changed
Lines changed: 7 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
97 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
98 | 103 | | |
99 | 104 | | |
100 | 105 | | |
| |||
111 | 116 | | |
112 | 117 | | |
113 | 118 | | |
114 | | - | |
115 | 119 | | |
116 | 120 | | |
117 | 121 | | |
| |||
0 commit comments