diff options
author | ppedrot <ppedrot@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2012-06-22 15:14:30 +0000 |
---|---|---|
committer | ppedrot <ppedrot@85f007b7-540e-0410-9357-904b9bb8a0f7> | 2012-06-22 15:14:30 +0000 |
commit | 6b45f2d36929162cf92272bb60c2c245d9a0ead3 (patch) | |
tree | 93aa975697b7de73563c84773d99b4c65b92173b /lib/loc.ml | |
parent | fea214f82954197d23fda9a0e4e7d93e0cbf9b4c (diff) |
Added an indirection with respect to Loc in Compat. As many [open Compat]
were closed (i.e. the only remaining ones are those of printing/parsing).
Meanwhile, a simplified interface is provided in loc.mli.
This also permits to put Pp in Clib, because it does not depend on
CAMLP4/5 anymore.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@15475 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'lib/loc.ml')
-rw-r--r-- | lib/loc.ml | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/loc.ml b/lib/loc.ml new file mode 100644 index 000000000..b2d83a78b --- /dev/null +++ b/lib/loc.ml @@ -0,0 +1,29 @@ +(************************************************************************) +(* v * The Coq Proof Assistant / The Coq Development Team *) +(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2010 *) +(* \VV/ **************************************************************) +(* // * This file is distributed under the terms of the *) +(* * GNU Lesser General Public License Version 2.1 *) +(************************************************************************) + +open Pp + +include Compat.Loc + +(* Locations management *) + +let dummy_loc = Compat.Loc.ghost +let join_loc = Compat.Loc.merge +let make_loc = Compat.make_loc +let unloc = Compat.unloc + +type 'a located = t * 'a +let located_fold_left f x (_,a) = f x a +let located_iter2 f (_,a) (_,b) = f a b +let down_located f (_,a) = f a + +let pr_located pr (loc, x) = + if Flags.do_beautify () && loc <> dummy_loc then + let (b, e) = unloc loc in + Pp.comment b ++ pr x ++ Pp.comment e + else pr x |