ppxlib
-
library ppxlib
-
module Ppxlib
-
module Ast_io
-
module Ast_pattern
-
module Packed
-
-
module Caller_id
-
module Code_path
-
module Context_free
-
module Rule
-
module Constant_kind
-
-
-
module Driver
-
module Cookies
-
module Create_file_property
-
module Instrument
-
module V2
-
-
module Lint_error
-
module V2
-
-
module Expansion_context
-
module File_path
-
module Keyword
-
module Loc
-
module Merlin_helpers
-
module Quoter
-
module Reserved_namespaces
-
module Spellcheck
-
-
library ppxlib.ast
-
module Ppxlib_ast
-
module Ast_helper
-
module Attr
-
module Cf
-
module Ci
-
module Cl
-
module Const
-
module Csig
-
module Cstr
-
module Ctf
-
module Cty
-
module Exp
-
module Incl
-
module Mb
-
module Md
-
module Mod
-
module Ms
-
module Mtd
-
module Mty
-
module Of
-
module Opn
-
module Pat
-
module Rf
-
module Sig
-
module Str
-
module Te
-
module Typ
-
module Type
-
module Val
-
module Vb
-
-
module Compiler_version
-
module Extra_warnings
-
module Find_version
-
module Js
-
module Location_error
-
module type OCaml_version
-
module Selected_ast
-
-
library ppxlib.astlib
-
module Astlib
-
module Ast_metadata
-
module Config
-
module Keyword
-
module Longident
-
module Migrate_402_403
-
module Migrate_403_402
-
module Migrate_403_404
-
module Migrate_404_403
-
module Migrate_404_405
-
module Migrate_405_404
-
module Migrate_405_406
-
module Migrate_406_405
-
module Migrate_406_407
-
module Migrate_407_406
-
module Migrate_407_408
-
module Migrate_408_407
-
module Migrate_408_409
-
module Migrate_409_408
-
module Migrate_409_410
-
module Migrate_410_409
-
module Migrate_410_411
-
module Migrate_411_410
-
module Migrate_411_412
-
module Migrate_412_411
-
module Migrate_412_413
-
module Migrate_413_412
-
module Migrate_413_414
-
module Migrate_414_413
-
module Parse
-
module Pprintast
-
-
library ppxlib.metaquot
-
module Ppxlib_metaquot
-
-
library ppxlib.metaquot_lifters
-
library ppxlib.print_diff
-
module Ppxlib_print_diff
-
-
library ppxlib.runner
-
module Ppxlib_runner
-
module Ppx_driver_runner
-
-
-
library ppxlib.runner_as_ppx
-
module Ppxlib_runner_as_ppx
-
module Ppx_driver_runner_as_ppx
-
-
-
library ppxlib.stdppx
-
module Stdppx
-
module Bool
-
module Bytes
-
module Char
-
module type Comparisons
-
module Exn
-
module Exn_converter
-
module For_unit_tests_only
-
-
module Float
-
module Fn
-
module Hashtbl
-
module type HashedType
-
module MakeSeeded
-
argument 1-H
-
-
module type S
-
module type SeededHashedType
-
module type SeededS
-
-
module In_channel
-
module Int
-
module List
-
module Option
-
module Out_channel
-
module Poly
-
-
-
library ppxlib.traverse
-
module Ppxlib_traverse
-
module Backends
-
-
-
library ppxlib.traverse_builtins
-
module Ppxlib_traverse_builtins
-
module T
-
-
This module is similar to the Ast_helper
module distributed with OCaml but uses different conventions.
Locations
Ast_helper
uses a global variable for the default locations, we found that to it makes it quite easy to mess up locations. Instead this modules forces you to provide a location argument.
For building fragment using the same location everywhere, a functor is provided.
Naming
The names match the Parsetree
names closely, which makes it easy to build AST fragments by just knowing the Parsetree
.
For types of the form a wrapper record with a _desc
field, helpers are generated for each constructor constructing the record directly. For instance for the type Parsetree.expression
:
type expression =
{ pexp_desc : expression_desc
; pexp_loc : Location.t
; pexp_attributes : attributes
}
and expression_desc =
| Pexp_ident of Longident.t loc
| Pexp_constant of constant
| Pexp_let of rec_flag * value_binding list * expression
...
The following helpers are created:
val pexp_ident : loc:Location.t -> Longident.t Located.t -> expression
val pexp_constant : loc:Location.t -> constant -> expression
val pexp_let : loc:Location.t -> rec_flag -> value_binding list -> expression
...
For other record types, such as type_declaration, we have the following helper:
type type_declaration =
{ ptype_name : string Located.t
; ptype_params : (core_type * variance) list
; ptype_cstrs : (core_type * core_type * Location.t) list
; ptype_kind : type_kind
; ptype_private : private_flag
; ptype_manifest : core_type option
; ptype_attributes : attributes
; ptype_loc : Location.t
}
val type_declaration
: loc : Location.t
-> name : string Located.t
-> params : (core_type * variance) list
-> cstrs : (core_type * core_type * Location.t) list
-> kind : type_kind
-> private : private_flag
-> manifest : core_type option
-> type_declaration
Attributes are always set to the empty list. If you want to set them you have to override the field with the { e with pexp_attributes = ... }
notation.
module Default : sig ... end
Helpers taking a ~loc
argument. This module is meant to be opened or aliased.
module type Loc = sig ... end
module type S = sig ... end
val make : Location.t -> (module S)
Functional version of Make
.