jon.recoil.org

Source file import.ml

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
include struct
  open Ppxlib
  include Ast

  module Ast_pattern = struct
    include Ast_pattern

    let fail = Ppxlib__.Ast_pattern0.fail
    let pexp_hole = pexp_hole
  end

  module Attribute = Attribute
  module Context_free = Context_free
  module Driver = Driver
  module Extension = Extension
  module Loc = Loc

  module Location : sig
    include module type of Location

    val raise_errorf : ?loc:location -> ('a, Format.formatter, unit, _) format4 -> 'a
    [@@alert
      do_not_raise
        "Create an error node instead of raising. See [Location.error_extensionf], or \
         alternately [Location.Error.createf] and [Location.Error.to_extension]."]
  end =
    Location
end

include struct
  open Ppxlib_jane
  module Ast_traverse = Ast_traverse

  type jkind_annotation = Shim.jkind_annotation
  type mode = Shim.Mode.t = Mode of string [@@unboxed]
  type modes = Shim.Modes.t
  type modality = Shim.Modality.t = Modality of string [@@unboxed]
end

module Ast_builder = struct
  include Ppxlib.Ast_builder.Default
  include Ppxlib_jane.Ast_builder.Default
end

include struct
  open Sexplib0
  module Sexp = Sexp
  include Sexp_conv
end

(* Re-export from [Import] to shadow modules from [open Stdppx] *)
module Result = Result_with_helpers
module List = List_with_helpers

(* Convenience functions *)
let map_fst (x, y) ~f = f x, y
let map_snd (x, y) ~f = x, f y

(* Make [Sexp.t] constructors always in scope *)
type _sexp = Sexplib0.Sexp.t =
  | Atom of string
  | List of Sexplib0.Sexp.t list