Skip to content

Commit f2221ad

Browse files
author
Ben Lerner
committed
Adding ending line number to printing of positions when positions span multiple lines
1 parent 65c4a99 commit f2221ad

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/prelude.ml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,11 @@ let second2 f (a, b) = (a, f b)
6161
let third3 f (a, b, c) = (a, b, f c)
6262

6363
let string_of_position (p, e) =
64-
Format.sprintf "%s:%d:%d-%d" p.pos_fname p.pos_lnum (p.pos_cnum - p.pos_bol)
64+
if (p.pos_lnum = e.pos_lnum)
65+
then Format.sprintf "%s:%d:%d-%d" p.pos_fname p.pos_lnum (p.pos_cnum - p.pos_bol)
6566
(e.pos_cnum - e.pos_bol)
67+
else Format.sprintf "%s:%d:%d-%d:%d" p.pos_fname p.pos_lnum (p.pos_cnum - p.pos_bol)
68+
e.pos_lnum (e.pos_cnum - e.pos_bol)
6669

6770
let snd3 (a, b, c) = b
6871

0 commit comments

Comments
 (0)