aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
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 2eb79c100e..789de81603 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 bc7d58a0b4..09efc57a1d 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