]> matita.cs.unibo.it Git - fireball-separation.git/blobdiff - ocaml/parser.ml
Parser.from_file, and p* problems moved to problems/p
[fireball-separation.git] / ocaml / parser.ml
index ac692516a68cc1786e4b46c08435992236b8e478..379fb2edff3697e3e8c9740909223b1d705f61b6 100644 (file)
@@ -246,3 +246,18 @@ let ps = List.map (
  ) ps in\r
  name, div, conv, ps, free\r
 ;;\r
+\r
+\r
+let from_file path =\r
+ let lines = ref [] in\r
+ let chan = open_in path in\r
+ let _ = try\r
+  while true; do\r
+    lines := input_line chan :: !lines\r
+  done\r
+ with End_of_file ->\r
+  close_in chan in\r
+ let txt = String.concat "\n" (List.rev !lines) in\r
+ let problems = Str.split (Str.regexp "\r?\n\r?\n\\#") txt in\r
+ List.map problem_of_string problems\r
+;;\r