Commits

Peter Szilagyi  committed d98e9b3

ocp-indent update from github.com/OCamlPro/ocp-indent

  • Participants
  • Parent commits e8c880e

Comments (0)

Files changed (2)

File ocaml/contrib/ocp-indent/src/block.ml

   let pad k path =
     match Nstream.next stream with
     | Some (tok,_) when tok.newlines = 0 ->
-        append k T (tok.spaces + 1) path
+        append k L (tok.spaces + 1) path
     | _ -> append k L 2 path in
 
   match tok.token with
     | SEMISEMI    -> append KNone L 0 (unwind_top t.path)
-    | OPEN        -> append KOpen L 2 (unwind_top t.path)
     | INCLUDE     -> append KInclude L 2 (unwind_top t.path)
     | EXCEPTION   -> append KException L 2 (unwind_top t.path)
     | BEGIN       -> append KBegin L 2 t.path
     | WHEN        -> append KWhen L 4 t.path
     | SIG         -> append KSig L 2 t.path
 
+    | OPEN when last_token t = Some LET -> append KOpen L 2 t.path
+
+    | OPEN -> append KOpen L 2 (unwind_top t.path)
+
     | LET when close_top_let t.last ->
         append KLet L 4 (unwind_top t.path)
 

File ocaml/contrib/ocp-indent/tests/let-open.ml

+
+let _ =
+  (* ... *)
+  let open Option in
+  indented_line