equal
deleted
inserted
replaced
5 Input positions. |
5 Input positions. |
6 *) |
6 *) |
7 |
7 |
8 signature POSITION = |
8 signature POSITION = |
9 sig |
9 sig |
10 eqtype T |
10 type T |
11 val none: T |
11 val none: T |
12 val line: int -> T |
12 val line: int -> T |
13 val name: string -> T |
13 val name: string -> T |
14 val line_name: int -> string -> T |
14 val line_name: int -> string -> T |
15 val incr: T -> T |
15 val inc: T -> T |
16 val str_of: T -> string |
16 val str_of: T -> string |
17 end; |
17 end; |
18 |
18 |
19 structure Position: POSITION = |
19 structure Position: POSITION = |
20 struct |
20 struct |
29 fun line n = Pos (Some n, None); |
29 fun line n = Pos (Some n, None); |
30 fun name s = Pos (None, Some s); |
30 fun name s = Pos (None, Some s); |
31 fun line_name n s = Pos (Some n, Some s); |
31 fun line_name n s = Pos (Some n, Some s); |
32 |
32 |
33 |
33 |
34 (* incr *) |
34 (* increment *) |
35 |
35 |
36 fun incr (pos as Pos (None, _)) = pos |
36 fun inc (pos as Pos (None, _)) = pos |
37 | incr (Pos (Some n, opt_s)) = Pos (Some (n + 1), opt_s); |
37 | inc (Pos (Some n, opt_s)) = Pos (Some (n + 1), opt_s); |
38 |
38 |
39 |
39 |
40 (* str_of *) |
40 (* str_of *) |
41 |
41 |
42 fun str_of (Pos (None, None)) = "" |
42 fun str_of (Pos (None, None)) = "" |