Uses the Logger.print function instead of Printf.eprintf
[SXSI/xpathcomp.git] / src / ata.ml
index b24fd6b..3c27ae8 100644 (file)
@@ -9,25 +9,24 @@ type t = {
   states : StateSet.t;
   init : StateSet.t;
   last : State.t;
-
-      (* Transitions of the Alternating automaton *)
+  (* Transitions of the Alternating automaton *)
   trans : (State.t, (TagSet.t * Transition.t) list) Hashtbl.t;
   marking_states : StateSet.t;
   topdown_marking_states : StateSet.t;
   bottom_states : StateSet.t;
   true_states : StateSet.t
- }
+}
 
 let print ppf a =
   fprintf ppf
-    "Automaton (%i) :
-States %a
-Initial states: %a
-Marking states: %a
-Topdown marking states: %a
-Bottom states: %a
-True states: %a
-Alternating transitions\n"
+    "Automaton (%i) :@\n\
+     States %a@\n\
+     Initial states: %a@\n\
+     Marking states: %a@\n\
+     Topdown marking states: %a@\n\
+     Bottom states: %a@\n\
+     True states: %a@\n\
+     Alternating transitions:@\n"
     a.id
     StateSet.print a.states
     StateSet.print a.init
@@ -37,18 +36,19 @@ Alternating transitions\n"
     StateSet.print a.true_states;
   let trs =
     Hashtbl.fold
-      (fun _ t acc ->
-       List.fold_left (fun acc (_, tr) -> tr::acc) acc t) a.trans []
+      (fun _ t acc -> List.fold_left (fun acc (_, tr) -> tr::acc) acc t)
+      a.trans
+      []
   in
   let sorted_trs = List.stable_sort Transition.compare trs in
   let strings = Transition.format_list sorted_trs in
   match strings with
-    [] -> ()
-  | line::_ -> 
+  | [] -> ()
+  | line::_ ->
     let sline = Pretty.line (Pretty.length line) in
-    fprintf ppf "%s\n%!" sline;
-    List.iter (fun s -> fprintf ppf "%s\n%!" s) strings;
-    fprintf ppf "%s\n%!" sline
+    fprintf ppf "%s@\n" sline;
+    List.iter (fun s -> fprintf ppf "%s@\n" s) strings;
+    fprintf ppf "%s@\n" sline
 
 
 type jump_kind =