aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2012-06-20 14:46:45 +0000
committerGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2012-06-20 14:46:45 +0000
commite5840a45ad77ddf648871f142707924624311725 (patch)
tree96c59ee8aad852db781d6abf9dcce7d50f5730aa /lib
parent12ca0c207832ee3138c3015726b4f7e615887cc5 (diff)
Fixing bug #2809 (anomaly when printing a module with notations due to
bad interaction between lazy evaluation of pp streams and temporary effectful extension of global environment). git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@15457 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'lib')
-rw-r--r--lib/pp.ml411
-rw-r--r--lib/pp.mli4
2 files changed, 15 insertions, 0 deletions
diff --git a/lib/pp.ml4 b/lib/pp.ml4
index 2eb79c100..789de8160 100644
--- a/lib/pp.ml4
+++ b/lib/pp.ml4
@@ -159,6 +159,17 @@ let tclose () = [< 'Ppcmd_close_tbox >]
let (++) = Stream.iapp
+let rec eval_ppcmds l =
+ let rec aux l =
+ try
+ let a = match Stream.next l with
+ | Ppcmd_box (b,s) -> Ppcmd_box (b,eval_ppcmds s)
+ | a -> a in
+ let rest = aux l in
+ a :: rest
+ with Stream.Failure -> [] in
+ Stream.of_list (aux l)
+
(* In new syntax only double quote char is escaped by repeating it *)
let rec escape_string s =
let rec escape_at s i =
diff --git a/lib/pp.mli b/lib/pp.mli
index bc7d58a0b..09efc57a1 100644
--- a/lib/pp.mli
+++ b/lib/pp.mli
@@ -41,6 +41,10 @@ val comments : ((int * int) * string) list ref
val (++) : std_ppcmds -> std_ppcmds -> std_ppcmds
+(** {6 Evaluation. } *)
+
+val eval_ppcmds : std_ppcmds -> std_ppcmds
+
(** {6 Derived commands. } *)
val spc : unit -> std_ppcmds