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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470
|
let () =
[%ext expr];
()
let _ = (match%ext x with () -> ()) [@attr y]
let _ =
match%ext x with
| () ->
let y = [%test let x = y] in
let%test x = d in
d
val f : compare:[%compare: 'a] -> sexp_of:[%sexp_of: 'a] -> t
let invariant t =
Invariant.invariant [%here] t [%sexp_of: t] (fun () ->
assert (check_t_invariant t))
;;
[%e?
( xxxxxxxxx,
xxxxxxxxxxxxx,
xxxxxxxxxxxxxxxx,
xxxxxxxxxxxxxx,
xxxxxxxxxxx,
xxxxxxxxxxxxxxxxxxxx )]
;;
[%e?
( xxxxxxxxx,
xxxxxxxxxxxxx,
xxxxxxxxxxxxxxxx,
xxxxxxxxxxxxxx,
xxxxxxxxxxx,
xxxxxxxxxxxxxxxxxxxx ) when a < b]
[%ext
let f = () and g () = () in
e]
(let%ext f = () and g () = () in
e)
[%ext
let rec f = () and g () = () in
e]
(let%ext rec f = () and g () = () in
e)
;;
let _ = ([%ext? (x : x)] : [%ext? (x : x)])
[%%ext 11111111111111111111]
[%%ext 11111111111111111111111 22222222222222222222222 33333333333333333333333]
[%%ext
11111111111111111111;;
22222222222222222222]
[%%ext
11111111111111111111;;
22222222222222222222;;
33333333333333333333]
[%%ext
let foooooooooooooooo = foooo
let fooooooooooooooo = foo]
let _ = [%stri let [%p xxx] = fun (t : [%t tt]) (ut : [%t tt]) -> [%e xxx]]
let _ =
[
x;
x
---> [%expr
[%e x ~loc [%expr x] x];
iter tail];
x;
]
let _ =
[%expr
let x = e in
f y]
[@x]
let _ =
f
(for i = 0 to 1 do
()
done)
(while true do
()
done)
let _ =
f
(for%ext i = 0 to 1 do
()
done)
(while%ext true do
()
done)
let _ = function%ext x -> x
let _ = f (function%ext x -> x)
let _ = f (function%ext x -> x) x
let _ = [%ext function x -> x]
let _ = f [%ext function x -> x]
let _ = f [%ext function x -> x] x
let _ = f ([%ext e] [@attr]) x
let _ =
a;%ext
b;
[%ext
a;
b]
let _ = try%lwt Lwt.return 2 with _ -> assert false
let _ =
(* foooooooooooo *)
try%lwt
(* fooooooooooo *)
Lwt.return 2
with _ -> assert false
let _ =
try%lwt
let a = 3 in
Lwt.return a
with _ -> assert false
let _ =
(* foooooooooooo *)
try%lwt
(* fooooooooooo *)
let a = 3 in
Lwt.return a
with _ -> assert false
let%lwt f = function _ -> ()
type%any_extension t = < a : 'a >
let value = f [%any_extension function 0 -> false | _ -> true]
let value = [%any_extension fun x -> y] x
let value = f [%any_extension try x with x -> false | _ -> true]
let value = f [%any_extension match x with x -> false | _ -> true]
let foo =
[%foooooooooo
fooooooooooooooooooooooooooo foooooooooooooooooooooooooooooooooo
foooooooooooooooooooooooooooooooooo foooooooooooooooooooooooooooo
foooooooooooooooooooooooooooo]
[@@foooooooooo
fooooooooooooooooooooooooooo foooooooooooooooooooooooooooooooooo
foooooooooooooooooooooooooooooooooo foooooooooooooooooooooooooooo
foooooooooooooooooooooooooooo]
[%%foooooooooo:
fooooooooooooooooooooooooooo foooooooooooooooooooooooooooooooooo
foooooooooooooooooooooooooooooooooo
foooooooooooooooooooooooooooo
foooooooooooooooooooooooooooo]
[@@@foooooooooo
fooooooooooooooooooooooooooo foooooooooooooooooooooooooooooooooo
foooooooooooooooooooooooooooooooooo foooooooooooooooooooooooooooo
foooooooooooooooooooooooooooo]
let _ =
[%ext
let+ a = b in
c]
let _ =
begin%ext
"foo";
"bar"
end
let this_function_has_a_long_name plus very many arguments =
"and a kind of long body"
[%%expect {||}];;
[%expect {|
___________________________________________________________
|}];;
[%%expect {|
___________________________________________________________
|}]
let () = (* -1 *) begin%test[@foo "bar"] end (* 0 *)
(* 0.5 *)
(* 1 *)
(* 2 *)
(* 3 *)
open%ext M
[%%ext open M]
open! %ext M
[%%ext open! M]
include%ext M
[%%ext include M]
let x =
let open%ext M in
x
let x =
[%ext
let open M in
x]
let x =
let open! %ext M in
x
let x =
[%ext
let open! M in
x]
exception%ext E
[%%ext exception E]
let _ =
let exception%ext E in
x
let _ =
[%ext
let exception E in
x]
module%ext E = P
[%%ext module E = P]
module%ext rec K = A
and L = A
[%%ext
module rec K = A
and L = A]
let _ =
let module%ext E = P in
x
let _ =
[%ext
let module E = P in
x]
module type%ext E = P
[%%ext module type E = P]
class%ext x = y
[%%ext class x = y]
class%ext x = y
and y = z
[%%ext
class x = y
and y = z]
class type%ext x = y
[%%ext class type x = y]
class type%ext x = y
and y = z
[%%ext
class type x = y
and y = z]
let _ = (* bar *) [%expr (* comment *) foo (* blabla *)]
let _ = assert%lwt false
let _ = [%lwt assert false]
let _ = f (assert%lwt false)
let _ = f [%lwt assert false]
let _ = assert%lwt false [@attr]
let _ = [%lwt assert false] [@attr]
let _ = f (assert%lwt false [@attr])
let _ = f ([%lwt assert false] [@attr])
let _ = lazy%ext e
let _ = [%ext lazy e]
let _ = f (lazy%ext e)
let _ = f [%ext lazy e]
let _ = lazy%ext e [@attr]
let _ = [%ext lazy e] [@attr]
let _ = f (lazy%ext e [@attr])
let _ = f ([%ext lazy e] [@attr])
let _ =
object%ext
method x = y
end
let _ =
[%ext
object
method x = y
end]
let _ =
f
(object%ext
method x = y
end)
let _ =
f
[%ext
object
method x = y
end]
let _ =
object%ext
method x = y
end
[@attr]
let _ =
[%ext
object
method x = y
end]
[@attr]
let _ =
f
(object%ext
method x = y
end
[@attr])
let _ =
f
([%ext
object
method x = y
end]
[@attr])
let _ = if%ext x then y else z
let _ = [%ext if x then y else z]
let _ = f (if%ext x then y else z)
let _ = f [%ext if x then y else z]
let _ = (if%ext x then y else z) [@attr]
let _ = [%ext if x then y else z] [@attr]
let _ = f ((if%ext x then y else z) [@attr])
let _ = f ([%ext if x then y else z] [@attr])
let _ = match%ext x with _ -> x
let _ = [%ext match x with _ -> x]
let _ = f (match%ext x with _ -> x)
let _ = f [%ext match x with _ -> x]
let _ = (match%ext x with _ -> x) [@attr]
let _ = [%ext match x with _ -> x] [@attr]
let _ = f ((match%ext x with _ -> x) [@attr])
let _ = f ([%ext match x with _ -> x] [@attr])
let _ = try%ext x with _ -> x
let _ = [%ext try x with _ -> x]
let _ = f (try%ext x with _ -> x)
let _ = f [%ext try x with _ -> x]
let _ = (try%ext x with _ -> x) [@attr]
let _ = [%ext try x with _ -> x] [@attr]
let _ = f ((try%ext x with _ -> x) [@attr])
let _ = f ([%ext try x with _ -> x] [@attr])
let _ = fun%ext x -> x
let _ = [%ext fun x -> x]
let _ = f (fun%ext x -> x)
let _ = f [%ext fun x -> x]
let _ = (fun%ext x -> x) [@attr]
let _ = [%ext fun x -> x] [@attr]
let _ = f ((fun%ext x -> x) [@attr])
let _ = f ([%ext fun x -> x] [@attr])
let _ = function%ext x -> x
let _ = [%ext function x -> x]
let _ = f (function%ext x -> x)
let _ = f [%ext function x -> x]
let _ = (function%ext x -> x) [@attr]
let _ = [%ext function x -> x] [@attr]
let _ = f ((function%ext x -> x) [@attr])
let _ = f ([%ext function x -> x] [@attr])
let _ = new%ext x
let _ = [%ext new x]
let _ = f (new%ext x)
let _ = f [%ext new x]
let _ = new%ext x [@attr]
let _ = [%ext new x] [@attr]
let _ = f (new%ext x [@attr])
let _ = f ([%ext new x] [@attr])
let _ =
x;%ext
y
let _ =
[%ext
x;
y]
let _ =
f
(x;%ext
y)
let _ =
f
[%ext
x;
y]
let _ =
(x;%ext
y)
[@attr]
let _ =
[%ext
x;
y]
[@attr]
let _ =
f
((x;%ext
y)
[@attr])
let _ =
f
([%ext
x;
y]
[@attr])
let formula_base x =
let open Formula.Infix in
(Expr.typeof x)#==(Lit (Type IntType))#&&(x#<=(Expr.int 4))#&&((Expr.int 0)#<x)
let xxxxxx =
let%map (* _____________________________
__________ *) () =
yyyyyyyy
in
{ zzzzzzzzzzzzz }
type%e nonrec t = t
type%e[@a] nonrec t = t
|