18 lines
377 B
OCaml
18 lines
377 B
OCaml
|
type t =
|
||
|
Pident of Ident.t
|
||
|
| Pdot of t * string * int
|
||
|
|
||
|
let nopos = -1
|
||
|
|
||
|
let rec same p1 p2 =
|
||
|
match (p1, p2) with
|
||
|
(Pident id1, Pident id2) -> Ident.same id1 id2
|
||
|
| (Pdot(p1, s1, pos1), Pdot(p2, s2, pos2)) -> s1 = s2 & same p1 p2
|
||
|
| (_, _) -> false
|
||
|
|
||
|
let rec root = function
|
||
|
Pident id -> id
|
||
|
| Pdot(p, s, pos) -> root p
|
||
|
|
||
|
let isfree id p = Ident.same id (root p)
|