Commits

camlspotter committed 9053664

rename

Comments (0)

Files changed (25)

 .PHONY: test
 
 
-TESTS=$(glob tests/test_*.ml)
+TESTS=$(glob tests/*.ml)
 test_out(file) = 
     return $(addprefix tests_out, $(removeprefix tests, $(file)))
 
+let token state region str at_the_head (t : Parser.token) : State.t * State.t = 
+  let line = Region.lnum region in
+  let columns = Region.columns region in
+  let indent = state.last_indent in
+  let bases0 = state.bases in
+
+  let pre_bases, post_bases = match t with
+    | SEMISEMI ->
+        (* unwind the top *)
+        let bases = unwind_top bases0 in
+        bases, bases
+
+    | OPEN -> 
+        let bases = unwind_top bases0 in
+        bases, { k = KOpen; indent = Indent.Set (columns + 2); line } :: bases
+
+
+let token state region str at_the_head (t : Parser.token) : State.t * State.t = 
+  let pre_bases, post_bases = match t with
+    | EQUAL ->
+        (* CR jfuruse: TODO
+           - pre bases
+           - for non definition equals *)
+        let rec f = function
+          | ({k = (KLet (_,columns) | KType columns | KModule columns) } :: bs as bases) -> 
+              bases, bases
+          | { k = (KBrace _ | KBracket _ | KParen _) } :: _ -> bases0, bases0
+          | [] -> [], []
+          | _ :: bs -> f bs
+        in
+        f bases0
+  in
+  ()
+
+let f = function
+  | X -> 1
+  | X | Y -> 2
+  | X -> 1
+  | (X | Y) -> 3
+  | X -> 1
+  | Y -> 
+      1
+  | Y -> 1
+           2
+  | _ -> Z
+  | ( X 
+    | Y
+    | Z ) -> 4
+
+let x y =
+  1, 2
+
+let x y =
+  1, 
+  2
+
+let x y = 1
+          , 2 
+
+let x y = 1,
+          2 
+
+let x y = ( 1
+          , 2) 
+
+let x y = ( 1,
+            2 )
+let x = 
+  f 1 2 3
+    4 5 6
+    7 8 9
+  + 1 2 3

tests/expr_binop.ml

+let f x = 
+  1 + 2
+    3 -
+    4
+  * 5
+    6
+;;
+let f x 
+  = 1
+
+let
+  f 
+    x 
+  = 
+  1
+
+and 
+  g
+    y
+  =
+  2
+let x =
+  let y = 10 in
+  x
+;;
+let rec lparen_read_ahead lnum str =
+  match Filter.destr str with
+  | None -> false
+  | Some (i, _) when Region.lnum i.Filter.region <> lnum -> false
+  | Some (i, str) ->
+      match i.Filter.token with
+      | FUN -> false
+      | FUNCTION -> false
+      | COMMENT -> lparen_read_ahead lnum str
+      | _ -> true
+let x = 
+  let y = 1
+          + 2
+          - 3
+  and z = foo
+  in
+  y + z
+let x = ( 1,
+          2,
+          3 )
+
+let x = (
+  1,
+  2,
+  3
+)
+
+let x = f (fun x ->
+  1
+)
+
+let x = (f
+           g)
+
+let x = (
+  f g
+)
+
+let x = ( 1
+        , 2
+        , 3
+        )
+
+let x = f (fun x -> y
+  z
+)
+
+let z = let x = 
+          f ( (* com *) 1, 
+              2 )
+
+type t = {
+  f : int;
+  g : int 
+}
+let x =
+  if true then
+    1;
+  2;
+  3
+;;
+

tests/test_bar.ml

-let token state region str at_the_head (t : Parser.token) : State.t * State.t = 
-  let line = Region.lnum region in
-  let columns = Region.columns region in
-  let indent = state.last_indent in
-  let bases0 = state.bases in
-
-  let pre_bases, post_bases = match t with
-    | SEMISEMI ->
-        (* unwind the top *)
-        let bases = unwind_top bases0 in
-        bases, bases
-
-    | OPEN -> 
-        let bases = unwind_top bases0 in
-        bases, { k = KOpen; indent = Indent.Set (columns + 2); line } :: bases
-
-
-let token state region str at_the_head (t : Parser.token) : State.t * State.t = 
-  let pre_bases, post_bases = match t with
-    | EQUAL ->
-        (* CR jfuruse: TODO
-           - pre bases
-           - for non definition equals *)
-        let rec f = function
-          | ({k = (KLet (_,columns) | KType columns | KModule columns) } :: bs as bases) -> 
-              bases, bases
-          | { k = (KBrace _ | KBracket _ | KParen _) } :: _ -> bases0, bases0
-          | [] -> [], []
-          | _ :: bs -> f bs
-        in
-        f bases0
-  in
-  ()
-

tests/test_cases.ml

-let f = function
-  | X -> 1
-  | X | Y -> 2
-  | X -> 1
-  | (X | Y) -> 3
-  | X -> 1
-  | Y -> 
-      1
-  | Y -> 1
-           2
-  | _ -> Z
-  | ( X 
-    | Y
-    | Z ) -> 4
-

tests/test_comma.ml

-let x y =
-  1, 2
-
-let x y =
-  1, 
-  2
-
-let x y = 1
-          , 2 
-
-let x y = 1,
-          2 
-
-let x y = ( 1
-          , 2) 
-
-let x y = ( 1,
-            2 )

tests/test_expr.ml

-let x = 
-  f 1 2 3
-    4 5 6
-    7 8 9
-  + 1 2 3

tests/test_expr_binop.ml

-let f x = 
-  1 + 2
-    3 -
-    4
-  * 5
-    6
-;;

tests/test_let.ml

-let f x 
-  = 1
-
-let
-  f 
-    x 
-  = 
-  1
-
-and 
-  g
-    y
-  =
-  2

tests/test_let_in.ml

-let x =
-  let y = 10 in
-  x
-;;

tests/test_match.ml

-let rec lparen_read_ahead lnum str =
-  match Filter.destr str with
-  | None -> false
-  | Some (i, _) when Region.lnum i.Filter.region <> lnum -> false
-  | Some (i, str) ->
-      match i.Filter.token with
-      | FUN -> false
-      | FUNCTION -> false
-      | COMMENT -> lparen_read_ahead lnum str
-      | _ -> true

tests/test_ops.ml

-let x = 
-  let y = 1
-          + 2
-          - 3
-  and z = foo
-  in
-  y + z

tests/test_paren.ml

-let x = ( 1,
-          2,
-          3 )
-
-let x = (
-  1,
-  2,
-  3
-)
-
-let x = f (fun x ->
-  1
-)
-
-let x = (f
-           g)
-
-let x = (
-  f g
-)
-
-let x = ( 1
-        , 2
-        , 3
-        )
-
-let x = f (fun x -> y
-  z
-)
-
-let z = let x = 
-          f ( (* com *) 1, 
-              2 )
-

tests/test_record.ml

-type t = {
-  f : int;
-  g : int 
-}

tests/test_semi.ml

-let x =
-  if true then
-    1;
-  2;
-  3
-;;
-