Skip to content

Commit

Permalink
Avoid folding over source lines that only denote the end-of-input/file
Browse files Browse the repository at this point in the history
  • Loading branch information
nberth committed Oct 5, 2023
1 parent a7c4e8b commit da10525
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lsp/cobol_preproc/preproc.ml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,9 @@ let fold_source_lines pl ~f acc =
spit_chunk suffix (acc, new_lnum, [])
in
let acc, last_lnum, tail = fold_source_chunks pl spit_chunk (acc, 1, []) in
f last_lnum tail acc (* fold on the last line upon exit *)
match tail with (* fold on the last line upon exit... *)
| [] | { payload = Eof; _ } :: _ -> acc (* ... if non-empty *)
| _ -> f last_lnum tail acc

(* --- *)

Expand Down

0 comments on commit da10525

Please sign in to comment.