File: repl.mli

package info (click to toggle)
ocamlformat 0.28.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 14,436 kB
  • sloc: ml: 63,321; pascal: 4,769; lisp: 229; sh: 217; makefile: 121
file content (99 lines) | stat: -rw-r--r-- 1,592 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
type t = k
(** VALID BLOCKS:

    Block delimiters should be on their own line:
    {[ let x = 1 ]}

    As of odoc 2.1, a block can carry metadata:
    {@ocaml[
      let x = 2
    ]}

    An OCaml block that should break:
    {[
      let x = 2 in x + x
    ]}

    A toplevel phrase with no output:
    {[
    # let x = 2 and y = 3 in x+y;;
    ]}

    A toplevel phrase with output:
    {@ocaml[
    # let x = 2;;
    val x : int = 2
    ]}

    Many toplevel phrases without output:
    {[
    # let x = 2;;
    # x + 2;;
    # let x = 2 and y = 3 in x+y;;
    ]}

    Many toplevel phrases with output:
    {[
    # let x = 2;;
    val x : int = 2
    # x + 2;;
    - : int = 4
    # let x = 2 and y = 3 in x+y;;
    ]}

    Output are printed after a newline:
    {[
    # let x = 2;; val x : int = 2
    # let x = 3;;
    # let x = 4;; val x : int = 4
    ]}

    Excessive linebreaks are removed:
    {[

      # let x = 2 in x+1;;

      output

      # let y = 3 in y+1;;

    ]}

    Linebreak after `#`:
    {[
    #
      let x = 2 in x+1;;
    ]}
*)

(** INVALID BLOCKS: The formatting of invalid blocks is preserved.

    Invalid toplevel phrase/ocaml block:
    {[
    - : int =
     4
    ]}

    Output before a toplevel phrase:
    {[
    - : int = 4
    # 2+2;;
    ]}

    No `;;` at the end of the phrase, no output:
    {[
    # let x = 2 in x+1
    ]}

    No `;;` at the end of the phrase, with output:
    {[
    # let x = 2 in x+1
    some output
    ]}

    Multiple phrases without `;;` at the end:
    {[
    # let x = 2 in x+1
    # let x = 4 in x+1
    ]}
*)