Add option iter
[tiger.ml.git] / compiler / src / lib / tiger / tiger_position.ml
CommitLineData
28875fec
SK
1type t =
2 { file : string
3 ; start_char : int
4 ; start_line : int
5 ; end_char : int
6 ; end_line : int
7 }
8
9let of_lexing_positions
10 ~pos_start:
11 Lexing.({pos_fname=sfile; pos_lnum=sline; pos_bol=sbol; pos_cnum=scnum})
12 ~pos_end:
13 Lexing.({pos_fname=efile; pos_lnum=eline; pos_bol=ebol; pos_cnum=ecnum})
14 =
15 assert (sfile = efile);
16 { file = sfile
17 ; start_char = scnum - sbol
18 ; start_line = sline
19 ; end_char = ecnum - ebol
20 ; end_line = eline
21 }
7c14a966
SK
22
23let to_string
24 { file
25 ; start_char
26 ; start_line
27 ; end_char
28 ; end_line
29 }
30=
31 Printf.sprintf
c16dd441 32 "file: %S, between (line,char) %d,%d and %d,%d"
7c14a966 33 file start_line start_char end_line end_char
This page took 0.03333 seconds and 4 git commands to generate.