1995-08-09 08:06:35 -07:00
|
|
|
(***********************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* Caml Special Light *)
|
|
|
|
(* *)
|
|
|
|
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
|
|
|
|
(* *)
|
|
|
|
(* Copyright 1995 Institut National de Recherche en Informatique et *)
|
|
|
|
(* Automatique. Distributed only by permission. *)
|
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
|
|
|
(* $Id$ *)
|
|
|
|
|
1995-05-04 03:15:53 -07:00
|
|
|
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)
|