Skip to content

Commit

Permalink
Count lines in all cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
toots committed Jun 26, 2023
1 parent fa49875 commit 5696ddb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/lib/sedlexing.ml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ let empty_lexbuf =
offset = 0;
pos = 0;
curr_bol = 0;
curr_line = 0;
curr_line = 1;
start_pos = 0;
start_bol = 0;
start_line = 0;
Expand All @@ -75,7 +75,6 @@ let create refill =
empty_lexbuf with
refill;
buf = Array.make chunk_size dummy_uchar;
curr_line = 1;
}

let set_position lexbuf position =
Expand Down Expand Up @@ -139,7 +138,7 @@ let refill lexbuf =
if n = 0 then lexbuf.finished <- true else lexbuf.len <- lexbuf.len + n

let new_line lexbuf =
if lexbuf.curr_line != 0 then lexbuf.curr_line <- lexbuf.curr_line + 1;
lexbuf.curr_line <- lexbuf.curr_line + 1;
lexbuf.curr_bol <- lexbuf.pos + lexbuf.offset

let[@inline always] next_aux some none lexbuf =
Expand Down

0 comments on commit 5696ddb

Please sign in to comment.