| 1 | (************************************************************************) |
| 2 | (* * The Rocq Prover / The Rocq Development Team *) |
| 3 | (* v * Copyright INRIA, CNRS and contributors *) |
| 4 | (* <O___,, * (see version control and CREDITS file for authors & dates) *) |
| 5 | (* \VV/ **************************************************************) |
| 6 | (* // * This file is distributed under the terms of the *) |
| 7 | (* * GNU Lesser General Public License Version 2.1 *) |
| 8 | (* * (see LICENSE file for the text of the license) *) |
| 9 | (************************************************************************) |
| 10 | |
| 11 | (** ['a CAst.t] wraps a value of type ['a] with (optional) source location information. |
| 12 | It is notably used to add location information to AST nodes. *) |
| 13 | type 'a t = private { |
| 14 | v : 'a; |
| 15 | loc : Loc.t option; |
| 16 | } |
| 17 | |
| 18 | val make : ?loc:Loc.t -> 'a -> 'a t |
| 19 | |
| 20 | val map : ('a -> 'b) -> 'a t -> 'b t |
| 21 | val map_with_loc : (?loc:Loc.t -> 'a -> 'b) -> 'a t -> 'b t |
| 22 | val map_from_loc : (?loc:Loc.t -> 'a -> 'b) -> 'a Loc.located -> 'b t |
| 23 | |
| 24 | val with_val : ('a -> 'b) -> 'a t -> 'b |
| 25 | val with_loc_val : (?loc:Loc.t -> 'a -> 'b) -> 'a t -> 'b |
| 26 | |
| 27 | val eq : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool |
| 28 | |
| 29 | module Smart : sig |
| 30 | val map : ('a -> 'a) -> 'a t -> 'a t |
| 31 | end |