]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/matita/matitaMisc.ml
snapshot, notably:
[helm.git] / helm / matita / matitaMisc.ml
index f332fcbd1e684bce9dbbcca5d3d546bfdc033dbb..1a55795a5536666d5c0adc993bdb5d1bcc1d7a13 100644 (file)
@@ -23,6 +23,8 @@
  * http://helm.cs.unibo.it/
  *)
 
+open Printf
+
 let is_dir fname = (Unix.stat fname).Unix.st_kind = Unix.S_DIR
 let is_regular fname = (Unix.stat fname).Unix.st_kind = Unix.S_REG
 
@@ -37,3 +39,13 @@ let input_file fname =
 let is_proof_script fname = true  (** TODO Zack *)
 let is_proof_object fname = true  (** TODO Zack *)
 
+let append_phrase_sep s =
+  if not (Pcre.pmatch ~pat:(sprintf "%s$" BuildTimeConf.phrase_sep) s) then
+    s ^ BuildTimeConf.phrase_sep
+  else
+    s
+
+let strip_trailing_blanks =
+  let rex = Pcre.regexp "\\s*$" in
+  fun s -> Pcre.replace ~rex s
+