Formatting/code clean-up.
[SXSI/xpathcomp.git] / src / ata.ml
index 96d13d4..21c1a7f 100644 (file)
@@ -3,23 +3,23 @@ INCLUDE "utils.ml"
 
 open Format
 
-type t =
-    { id : int;
-      states : StateSet.t;
-      init : StateSet.t;
-      last : State.t;
-
-    (* 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   }
-
+type t = {
+  id : int;
+  states : StateSet.t;
+  init : StateSet.t;
+  last : State.t;
+
+      (* 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) :
+    "Automaton (%i) :
 States %a
 Initial states: %a
 Marking states: %a
@@ -37,17 +37,17 @@ Alternating transitions\n"
   let trs =
     Hashtbl.fold
       (fun _ t acc ->
-        List.fold_left (fun acc (_, tr) -> tr::acc) acc t) a.trans []
+       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::_ ->
-      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
+  match strings with
+    [] -> ()
+  | 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
 
 
 type jump_kind =
@@ -170,10 +170,10 @@ let top_down_approx auto states tree =
   try Cache.find cache states with
   | Not_found ->
     let trs =
-       (* Collect all (ts, (l, r, m)) where
-          ts is a tagset, l and r are left and right set of states
-          m is marking flag
-       *)
+      (* Collect all (ts, (l, r, m)) where
+        ts is a tagset, l and r are left and right set of states
+        m is marking flag
+      *)
       fold_trans_of_states auto
        (fun acc_tr (ts, tr) ->
          let pos =
@@ -190,7 +190,7 @@ let top_down_approx auto states tree =
        states
        []
     in
-      (* for all labels in the tree compute which transition is taken *)
+    (* for all labels in the tree compute which transition is taken *)
     let all_trs =
       Ptset.Int.fold (fun tag acc ->
        List.fold_left (fun acc' (ts, rhs) ->
@@ -199,11 +199,11 @@ let top_down_approx auto states tree =
          else acc') acc trs)
        (Tree.node_tags tree) []
     in
-      (* merge together states that have common labels *)
+    (* merge together states that have common labels *)
     let uniq_states_trs =
       merge_trans by_labels merge_states (List.sort by_labels all_trs)
     in
-      (* merge together labels that have common states *)
+    (* merge together labels that have common states *)
     let td_approx =
       merge_trans by_states merge_labels
        (List.sort by_states uniq_states_trs)