1. camlspotter
  2. ocaml-indent

Commits

camlspotter  committed f9f7c9b

bug fix for non let =

  • Participants
  • Parent commits 2fc21e6
  • Branches default

Comments (0)

Files changed (2)

File main.ml

View file
  • Ignore whitespace
           (* Definition equal rolls things back to its head *)
           | {k = (KLet (_,cols) | KType cols | KModule cols) } :: _ ->
               bases, bases
-          (* Equal cannot exceed the following *)
-          | { k = (KBrace _ | KBracket _ | KParen _) } :: _ -> bases0, bases0
+          (* Equal can exceed the following *)
+          | { k = (KExpr _ | KNone) } :: bs -> f bs  
+          (* Equal cannot exceed the other *)
+          | _ :: bs -> bases0, bases0
           | [] -> [], []
-          | _ :: bs -> f bs
         in
         f bases0
         

File tests/non_let_equal.ml

View file
  • Ignore whitespace
+let token state str at_the_head region (t : Parser.token) : State.t * State.t = 
+
+  let pre_bases, post_bases = match t with
+    | TYPE ->
+        bases0, bases0 
+          
+
+    | TYPE when state.last_token = Some MODULE -> (* = is for when. Not for the let *)
+        bases0, bases0 
+      
+          
+    | TYPE ->
+        let bases = unwind_top bases0 in
+        bases, 
+        { k = KType cols; indent = cols + 2; } :: bases