File: cinaps.ml

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 (81 lines) | stat: -rw-r--r-- 1,067 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
(*$
  for i = 1 to 3 do
    Printf.printf "let x%d = %d\n" i i
  done
$*)
let x1 = 1

(*$*)

let x = 1

(*$
  print_newline () ;
  List.iter
    (fun s -> Printf.printf "let ( %s ) = Pervasives.( %s )\n" s s)
    ["+"; "-"; "*"; "/"]
*)

(*$*)
let y = 2

(*$ ;; #use "import.cinaps"

  ;; List.iter all_fields ~f:(fun (name, type_) -> printf "\nexternal get_%s
  : unit -> %s = \"get_%s\"" name type_ name) *)
external get_name : unit -> string = "get_name"

(*$*)

let x = 1

(*$
  let x = 1 in
  (* fooooooo *)
  let y = 2 in
  (* foooooooo *)
  z
$*)

(*$*)

let foo = foo

(*$QR foo Q.small_int (fun i-> foo i (+) [1;2;3] = List.fold_left (+) i
  [1;2;3] ) *)
let foo = foo

(* Cinaps comment should not wrap if they don't parse. The first one would
   crash and the second become a mess *)

(*$(**)"
  "*)

(*$
  print_newline () ;
  <SYNTAX ERROR>
  List.iter
    (fun s -> Printf.printf "let ( %s ) = Pervasives.( %s )\n" s s)
    ["+"; "-"; "*"; "/"]
*)

(*$*)

(*$
  (*
     x
  *)
*)

(*$*)

(*$
  let _ =
    [ x (*
        *)
    ; y
    ]
  ;;
*)

(*$*)