pub fn scan_location_lines(base_line: u32, text: &str) -> Vec<(u32, u32, u32)>Expand description
CM.3c: scan a block of streamed text for severity lines, returning
(absolute_line, severity) for each match. base_line is the 0-based
buffer line number the block’s FIRST line lands on; line i of the
block (via str::lines) maps to absolute line base_line + i.
This is the pure, host-free unit-test seam the compilation drain uses:
the drain tracks the running buffer line number (a Reset sets it to
the header’s newline count; each Append/Finished advances it by its
own newline count) and calls this per chunk to grow the buffer’s
severity index. Text is assumed newline-terminated per line (the pipe
readers append \n after every captured line); a trailing partial line
with no \n is still scanned but a following chunk that continues it
may not be re-attributed (erring toward not-decorating a partial line,
which is acceptable and does not occur with the newline-terminated
reader output).
CM.3c: scan a block of streamed text for location-bearing
lines (lines whose text contains a file path + line:col that
parse_location_line can navigate to). Returns
(absolute_line, path_byte_start, path_byte_end) for each match.
Mirrors scan_severities: base_line is the 0-based buffer
line number the block’s FIRST line lands on; line i of the
block maps to absolute line base_line + i. The compilation
drain calls this per chunk to grow the buffer’s location-line
index. The byte range is the span of the file-path portion
within the line text (for link-like fg highlighting).