Skip to content

Commit

Permalink
[ocaml] Allow blank lines between recursive type definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
nbacquey committed Sep 13, 2023
1 parent fe6083d commit 0cdd133
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions topiary/languages/ocaml.scm
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@
(let_and_operator) @allow_blank_line_before
)

; In a definition including several mutually recursive types,
; one can skip a line before each of them.
(type_definition
"and" @allow_blank_line_before
)

; Append line breaks. If there is a comment following, we don't add anything,
; because the input softlines and spaces above will already have sorted out the
; formatting.
Expand Down
4 changes: 4 additions & 0 deletions topiary/tests/samples/expected/ocaml.ml
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,10 @@ let [1; snd] = [1; 2]
type a = int
and b = float

type a = int

and b = float

(* Messing around with quoted strings and curly brackets *)
type string_record = { my_string: string; }
let quoted_string =
Expand Down
4 changes: 4 additions & 0 deletions topiary/tests/samples/input/ocaml.ml
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,10 @@ let [1; snd] = [1; 2]
type a = int and
b = float

type a = int

and b = float

(* Messing around with quoted strings and curly brackets *)
type string_record = { my_string: string; }
let quoted_string =
Expand Down

0 comments on commit 0cdd133

Please sign in to comment.