Some -dump-ast outputs have an irregularity where particular nodes have incorrect indentation, thus causing to be grouped under the wrong parent. This irregularity materializes as a newline with only n whitespace characters that should be prepended to the following line.
This change modifies sanitize(lines:) to account for this possibility. Introduces a helper flatMapScanPrevious which allows for scanning the previous element within flatMap.
Some
-dump-ast
outputs have an irregularity where particular nodes have incorrect indentation, thus causing to be grouped under the wrong parent. This irregularity materializes as a newline with onlyn
whitespace characters that should be prepended to the following line.This change modifies
sanitize(lines:)
to account for this possibility. Introduces a helperflatMapScanPrevious
which allows for scanning the previous element withinflatMap
.