diff --git a/ppx_trace/_doc-dir/CHANGES.md b/ppx_trace/_doc-dir/CHANGES.md index 2721a13..a563d37 100644 --- a/ppx_trace/_doc-dir/CHANGES.md +++ b/ppx_trace/_doc-dir/CHANGES.md @@ -1,3 +1,7 @@ +# 0.9 + +- add an extensible sum type, so users can implement custom events. For example + an OTEL collector can provide custom events to link two spans to one another. # 0.8 diff --git a/ppxlib/Astlib/Compiler_pprintast/index.html b/ppxlib/Astlib/Compiler_pprintast/index.html new file mode 100644 index 0000000..0f3987d --- /dev/null +++ b/ppxlib/Astlib/Compiler_pprintast/index.html @@ -0,0 +1,14 @@ + +Compiler_pprintast (ppxlib.Astlib.Compiler_pprintast)

Module Astlib.Compiler_pprintast

include module type of struct include Ocaml_common.Pprintast end
type space_formatter = (unit, Stdlib.Format.formatter, unit) format
val longident : Stdlib.Format.formatter -> Longident.t -> unit
val expression : Stdlib.Format.formatter -> Parsetree.expression -> unit
val string_of_expression : Parsetree.expression -> string
val core_type : Stdlib.Format.formatter -> Parsetree.core_type -> unit
val signature : Stdlib.Format.formatter -> Parsetree.signature -> unit
val structure : Stdlib.Format.formatter -> Parsetree.structure -> unit
val string_of_structure : Parsetree.structure -> string
val module_expr : Stdlib.Format.formatter -> Parsetree.module_expr -> unit
val toplevel_phrase : + Stdlib.Format.formatter -> + Parsetree.toplevel_phrase -> + unit
val class_field : Stdlib.Format.formatter -> Parsetree.class_field -> unit
val class_type_field : + Stdlib.Format.formatter -> + Parsetree.class_type_field -> + unit
val class_expr : Stdlib.Format.formatter -> Parsetree.class_expr -> unit
val class_type : Stdlib.Format.formatter -> Parsetree.class_type -> unit
val module_type : Stdlib.Format.formatter -> Parsetree.module_type -> unit
val tyvar : Stdlib.Format.formatter -> string -> unit

Print a type variable name, taking care of the special treatment required for the single quote character in second position.

val structure_item : + Stdlib.Format.formatter -> + Parsetree.structure_item -> + unit
val signature_item : + Stdlib.Format.formatter -> + Parsetree.signature_item -> + unit
\ No newline at end of file diff --git a/ppxlib/Astlib/Keyword/index.html b/ppxlib/Astlib/Keyword/index.html index 121bfd1..998e186 100644 --- a/ppxlib/Astlib/Keyword/index.html +++ b/ppxlib/Astlib/Keyword/index.html @@ -1,2 +1,2 @@ -Keyword (ppxlib.Astlib.Keyword)

Module Astlib.Keyword

val is_keyword : string -> bool

Check if a string is an OCaml keyword.

\ No newline at end of file +Keyword (ppxlib.Astlib.Keyword)

Module Astlib.Keyword

val is_keyword : string -> bool

Check if a string is an OCaml keyword.

val apply_keyword_edition : cli:string option -> unit -> unit

Processes any keywords= sections from the OCAMLPARAM environment variable and CLI option and initialises the compiler's lexer with the correct keyword set.

\ No newline at end of file diff --git a/ppxlib/Astlib/Pprintast/index.html b/ppxlib/Astlib/Pprintast/index.html index 049612e..500fd46 100644 --- a/ppxlib/Astlib/Pprintast/index.html +++ b/ppxlib/Astlib/Pprintast/index.html @@ -8,7 +8,10 @@ unit
val string_of_expression : Ast_414.Parsetree.expression -> string
val top_phrase : Stdlib.Format.formatter -> Ast_414.Parsetree.toplevel_phrase -> - unit
val core_type : Stdlib.Format.formatter -> Ast_414.Parsetree.core_type -> unit
val pattern : Stdlib.Format.formatter -> Ast_414.Parsetree.pattern -> unit
val signature : Stdlib.Format.formatter -> Ast_414.Parsetree.signature -> unit
val structure : Stdlib.Format.formatter -> Ast_414.Parsetree.structure -> unit
val string_of_structure : Ast_414.Parsetree.structure -> string
val class_expr : + unit
val core_type : Stdlib.Format.formatter -> Ast_414.Parsetree.core_type -> unit
val pattern : Stdlib.Format.formatter -> Ast_414.Parsetree.pattern -> unit
val signature : Stdlib.Format.formatter -> Ast_414.Parsetree.signature -> unit
val structure : Stdlib.Format.formatter -> Ast_414.Parsetree.structure -> unit
val string_of_structure : Ast_414.Parsetree.structure -> string
val binding : + Stdlib.Format.formatter -> + Ast_414.Parsetree.value_binding -> + unit
val longident : Stdlib.Format.formatter -> Longident.t -> unit
val payload : Stdlib.Format.formatter -> Ast_414.Parsetree.payload -> unit
val class_expr : Stdlib.Format.formatter -> Ast_414.Parsetree.class_expr -> unit
val class_field : diff --git a/ppxlib/Astlib/index.html b/ppxlib/Astlib/index.html index d6988b9..a2c7e62 100644 --- a/ppxlib/Astlib/index.html +++ b/ppxlib/Astlib/index.html @@ -1,2 +1,2 @@ -Astlib (ppxlib.Astlib)

Module Astlib

module Ast_402 : sig ... end
module Ast_403 : sig ... end
module Ast_404 : sig ... end
module Ast_405 : sig ... end
module Ast_406 : sig ... end
module Ast_407 : sig ... end
module Ast_408 : sig ... end
module Ast_409 : sig ... end
module Ast_410 : sig ... end
module Ast_411 : sig ... end
module Ast_412 : sig ... end
module Ast_413 : sig ... end
module Ast_414 : sig ... end
module Ast_500 : sig ... end
module Ast_501 : sig ... end
module Ast_502 : sig ... end
module Ast_503 : sig ... end
module Migrate_402_403 : sig ... end
module Migrate_403_402 : sig ... end
module Migrate_403_404 : sig ... end
module Migrate_404_403 : sig ... end
module Migrate_404_405 : sig ... end
module Migrate_405_404 : sig ... end
module Migrate_405_406 : sig ... end
module Migrate_406_405 : sig ... end
module Migrate_406_407 : sig ... end
module Migrate_407_406 : sig ... end
module Migrate_407_408 : sig ... end
module Migrate_408_407 : sig ... end
module Migrate_408_409 : sig ... end
module Migrate_409_408 : sig ... end
module Migrate_409_410 : sig ... end
module Migrate_410_409 : sig ... end
module Migrate_410_411 : sig ... end
module Migrate_411_410 : sig ... end
module Migrate_411_412 : sig ... end
module Migrate_412_411 : sig ... end
module Migrate_412_413 : sig ... end
module Migrate_413_412 : sig ... end
module Migrate_413_414 : sig ... end
module Migrate_414_413 : sig ... end
module Migrate_414_500 : sig ... end
module Migrate_500_414 : sig ... end
module Migrate_500_501 : sig ... end
module Migrate_501_500 : sig ... end
module Migrate_501_502 : sig ... end
module Migrate_502_501 : sig ... end
module Migrate_502_503 : sig ... end
module Migrate_503_502 : sig ... end
module Ast_metadata : sig ... end

Meta data related interface for a ppx rewriter

module Config : sig ... end

Magic numbers

module Keyword : sig ... end
module Location : sig ... end

Source code locations (ranges of positions), used in parsetrees

module Longident : sig ... end

Long identifiers, used in parsetrees.

module Parse : sig ... end

Entry points in the parser

module Pprintast : sig ... end
val init_error_reporting_style_using_env_vars : unit -> unit

Adjust the reporting style of error messages to the environment variables OCAML_COLOR and OCAML_ERROR_STYLE.

\ No newline at end of file +Astlib (ppxlib.Astlib)

Module Astlib

module Ast_402 : sig ... end
module Ast_403 : sig ... end
module Ast_404 : sig ... end
module Ast_405 : sig ... end
module Ast_406 : sig ... end
module Ast_407 : sig ... end
module Ast_408 : sig ... end
module Ast_409 : sig ... end
module Ast_410 : sig ... end
module Ast_411 : sig ... end
module Ast_412 : sig ... end
module Ast_413 : sig ... end
module Ast_414 : sig ... end
module Ast_500 : sig ... end
module Ast_501 : sig ... end
module Ast_502 : sig ... end
module Ast_503 : sig ... end
module Migrate_402_403 : sig ... end
module Migrate_403_402 : sig ... end
module Migrate_403_404 : sig ... end
module Migrate_404_403 : sig ... end
module Migrate_404_405 : sig ... end
module Migrate_405_404 : sig ... end
module Migrate_405_406 : sig ... end
module Migrate_406_405 : sig ... end
module Migrate_406_407 : sig ... end
module Migrate_407_406 : sig ... end
module Migrate_407_408 : sig ... end
module Migrate_408_407 : sig ... end
module Migrate_408_409 : sig ... end
module Migrate_409_408 : sig ... end
module Migrate_409_410 : sig ... end
module Migrate_410_409 : sig ... end
module Migrate_410_411 : sig ... end
module Migrate_411_410 : sig ... end
module Migrate_411_412 : sig ... end
module Migrate_412_411 : sig ... end
module Migrate_412_413 : sig ... end
module Migrate_413_412 : sig ... end
module Migrate_413_414 : sig ... end
module Migrate_414_413 : sig ... end
module Migrate_414_500 : sig ... end
module Migrate_500_414 : sig ... end
module Migrate_500_501 : sig ... end
module Migrate_501_500 : sig ... end
module Migrate_501_502 : sig ... end
module Migrate_502_501 : sig ... end
module Migrate_502_503 : sig ... end
module Migrate_503_502 : sig ... end
module Ast_metadata : sig ... end

Meta data related interface for a ppx rewriter

module Config : sig ... end

Magic numbers

module Keyword : sig ... end
module Location : sig ... end

Source code locations (ranges of positions), used in parsetrees

module Longident : sig ... end

Long identifiers, used in parsetrees.

module Parse : sig ... end

Entry points in the parser

module Pprintast : sig ... end
module Compiler_pprintast : sig ... end
val init_error_reporting_style_using_env_vars : unit -> unit

Adjust the reporting style of error messages to the environment variables OCAML_COLOR and OCAML_ERROR_STYLE.

\ No newline at end of file diff --git a/ppxlib/Ppxlib/Ast_builder/Default/index.html b/ppxlib/Ppxlib/Ast_builder/Default/index.html index b51aaf7..5f3cd49 100644 --- a/ppxlib/Ppxlib/Ast_builder/Default/index.html +++ b/ppxlib/Ppxlib/Ast_builder/Default/index.html @@ -1,607 +1,27 @@ -Default (ppxlib.Ppxlib.Ast_builder.Default)

Module Ast_builder.Default

Helpers taking a ~loc argument. This module is meant to be opened or aliased.

module Located : sig ... end
val attribute : - loc:Astlib.Location.t -> +Default (ppxlib.Ppxlib.Ast_builder.Default)

Module Ast_builder.Default

Helpers taking a ~loc argument. This module is meant to be opened or aliased.

module Located : sig ... end

Value description

val value_description : + loc:Location.t -> name:string Astlib.Location.loc -> - payload:Astlib.Ast_500.Parsetree.payload -> - Astlib.Ast_500.Parsetree.attribute
val binding_op : - loc:Astlib.Location.t -> - op:string Astlib.Location.loc -> + type_:Astlib.Ast_500.Parsetree.core_type -> + prim:string list -> + Astlib.Ast_500.Parsetree.value_description

value_description constructs an Ast.value_description

Example OCaml

Values of type value_description represents:

  • val x: T, when pval_prim is []
  • external x: T = "s1" ... "sn" when pval_prim is ["s1";..."sn"]

Value binding

Type extension

val ptyp_var : - loc:Astlib.Location.t -> - string -> - Astlib.Ast_500.Parsetree.core_type
val pdir_string : - loc:Astlib.Location.t -> - string -> - Astlib.Ast_500.Parsetree.directive_argument
val pdir_int : - loc:Astlib.Location.t -> - string -> - char option -> - Astlib.Ast_500.Parsetree.directive_argument

type_extension constructs an Ast.type_extension

Example OCaml

Definition of new extensions constructors for the extensive sum type t (type t += ...).

Type exception

val pexp_unreachable : - loc:Astlib.Location.t -> - Astlib.Ast_500.Parsetree.expression
val include_infos : - loc:Astlib.Location.t -> - 'a -> - 'b Astlib.Ast_500.Parsetree.include_infos
val location : - start:Stdlib.Lexing.position -> - end_:Stdlib.Lexing.position -> - ghost:bool -> - Astlib.Location.t
val open_infos : - loc:Astlib.Location.t -> - expr:'a -> - override:Astlib.Ast_500.Asttypes.override_flag -> - 'b Astlib.Ast_500.Parsetree.open_infos
val ppat_variant : - loc:Astlib.Location.t -> - string -> - Astlib.Ast_500.Parsetree.pattern option -> - Astlib.Ast_500.Parsetree.pattern
val ppat_unpack : - loc:Astlib.Location.t -> - string option Astlib.Location.loc -> - Astlib.Ast_500.Parsetree.pattern
val position : - fname:string -> - lnum:int -> - bol:int -> - cnum:int -> - Stdlib.Lexing.position

type_exception constructs an Ast.type_exception

Example OCaml

Definition of a new exception (exception E).

Type declaration

type_declaration constructs an Ast.type_declaration

Example OCaml

Here are type declarations and their representation, for various ptype_kind and ptype_manifest values:

  • type t when type_kind is Ptype_abstract, and manifest is None,
  • type t = T0 when type_kind is Ptype_abstract, and manifest is Some T0,
  • type t = C of T | ... when type_kind is Ptype_variant, and manifest is None,
  • type t = T0 = C of T | ... when type_kind is Ptype_variant, and manifest is Some T0,
  • type t = {l: T; ...} when type_kind is Ptype_record, and manifest is None,
  • type t = T0 = {l : T; ...} when type_kind is Ptype_record, and manifest is Some T0,
  • type t = .. when type_kind is Ptype_open, and manifest is None.

Toplevel directive

toplevel_directive constructs an Ast.toplevel_directive

Structure item

pstr_attribute constructs an Ast.structure_item_desc.Pstr_attribute

Example OCaml

[@@@id]

pstr_class_type constructs an Ast.structure_item_desc.Pstr_class_type

Example OCaml

class type ct1 = ... and ... and ctn = ...

pstr_class constructs an Ast.structure_item_desc.Pstr_class

Example OCaml

class c1 = ... and ... and cn = ...

pstr_modtype constructs an Ast.structure_item_desc.Pstr_modtype

Example OCaml

module type S = MT

pstr_recmodule constructs an Ast.structure_item_desc.Pstr_recmodule

Example OCaml

module rec X1 = ME1 and ... and Xn = MEn

pstr_module constructs an Ast.structure_item_desc.Pstr_module

Example OCaml

module X = ME

pstr_exception constructs an Ast.structure_item_desc.Pstr_exception

Example OCaml

  • exception C of T
  • exception C = M.X

pstr_typext constructs an Ast.structure_item_desc.Pstr_typext

Example OCaml

type t1 += ...

pstr_type constructs an Ast.structure_item_desc.Pstr_type

Example OCaml

type t1 = ... and ... and tn = ...

pstr_primitive constructs an Ast.structure_item_desc.Pstr_primitive

Example OCaml

  • val x: T
  • external x: T = "s1" ... "sn"

pstr_value constructs an Ast.structure_item_desc.Pstr_value

Example OCaml

Pstr_value(rec, [(P1, E1 ; ... ; (Pn, En))]) represents:

  • let P1 = E1 and ... and Pn = EN when rec is Nonrecursive,
  • let rec P1 = E1 and ... and Pn = EN when rec is Recursive.

Signature item

psig_attribute constructs an Ast.signature_item_desc.Psig_attribute

Example OCaml

[@@@id]

psig_class_type constructs an Ast.signature_item_desc.Psig_class_type

Example OCaml

class type ct1 = ... and ... and ctn = ...

psig_class constructs an Ast.signature_item_desc.Psig_class

Example OCaml

class c1 : ... and ... and cn : ...

psig_modtypesubst constructs an Ast.signature_item_desc.Psig_modtypesubst

Example OCaml

module type S := ...

psig_modtype constructs an Ast.signature_item_desc.Psig_modtype

Example OCaml

module type S = MT and module type S

psig_recmodule constructs an Ast.signature_item_desc.Psig_recmodule

Example OCaml

module rec X1 : MT1 and ... and Xn : MTn

psig_modsubst constructs an Ast.signature_item_desc.Psig_modsubst

Example OCaml

module X := M

psig_module constructs an Ast.signature_item_desc.Psig_module

Example OCaml

module X = M and module X : MT

psig_exception constructs an Ast.signature_item_desc.Psig_exception

Example OCaml

exception C of T

psig_typext constructs an Ast.signature_item_desc.Psig_typext

Example OCaml

type t1 += ...

psig_typesubst constructs an Ast.signature_item_desc.Psig_typesubst

Example OCaml

type t1 := ... and ... and tn := ...

psig_type constructs an Ast.signature_item_desc.Psig_type

Example OCaml

type t1 = ... and ... and tn = ...

psig_value constructs an Ast.signature_item_desc.Psig_value

Example OCaml

  • val x: T
  • external x: T = "s1" ... "sn"

Row field

rinherit constructs an Ast.row_field_desc.Rinherit

Example OCaml

[ | t ]

rtag constructs an Ast.row_field_desc.Rtag

Example OCaml

Rtag(`A, b, l) represents:

  • `A when b is true and l is [],
  • `A of T when b is false and l is [T],
  • `A of T1 & .. & Tn when b is false and l is [T1;...Tn],
  • `A of & T1 & .. & Tn when b is true and l is [T1;...Tn].
  • The bool field is true if the tag contains a constant (empty) constructor.
  • & occurs when several types are used for the same constructor (see 4.2 in the manual)

Position

val position : + fname:string -> + lnum:int -> + bol:int -> + cnum:int -> + Stdlib.Lexing.position

position constructs an Ast.position

Pattern

ppat_extension constructs an Ast.pattern_desc.Ppat_extension

Example OCaml

Pattern [%id]

ppat_exception constructs an Ast.pattern_desc.Ppat_exception

Example OCaml

Pattern exception P

val ppat_unpack : + loc:Location.t -> + string option Astlib.Location.loc -> + Astlib.Ast_500.Parsetree.pattern

ppat_unpack constructs an Ast.pattern_desc.Ppat_unpack

Example OCaml

Ppat_unpack(s) represents:

  • (module P) when s is Some "P"
  • (module _) when s is None

Note: (module P : S) is represented as Ppat_constraint(Ppat_unpack(Some "P"), Ptyp_package S)

ppat_lazy constructs an Ast.pattern_desc.Ppat_lazy

Example OCaml

Pattern lazy P

ppat_type constructs an Ast.pattern_desc.Ppat_type

Example OCaml

Pattern #tconst

ppat_constraint constructs an Ast.pattern_desc.Ppat_constraint

Example OCaml

Pattern (P : T)

ppat_or constructs an Ast.pattern_desc.Ppat_or

Example OCaml

Pattern P1 | P2

ppat_array constructs an Ast.pattern_desc.Ppat_array

Example OCaml

Pattern [| P1; ...; Pn |]

ppat_record constructs an Ast.pattern_desc.Ppat_record

Example OCaml

Ppat_record([(l1, P1) ; ... ; (ln, Pn)], flag) represents:

  • { l1=P1; ...; ln=Pn } when flag is Closed
  • { l1=P1; ...; ln=Pn; _} when flag is Open

Invariant: n > 0

val ppat_variant : + loc:Location.t -> + string -> + Astlib.Ast_500.Parsetree.pattern option -> + Astlib.Ast_500.Parsetree.pattern

ppat_variant constructs an Ast.pattern_desc.Ppat_variant

Example OCaml

Ppat_variant(`A, pat) represents:

  • `A when pat is None,
  • `A P when pat is Some P

ppat_tuple constructs an Ast.pattern_desc.Ppat_tuple

Example OCaml

Patterns (P1, ..., Pn).

Invariant: n >= 2

ppat_interval constructs an Ast.pattern_desc.Ppat_interval

Example OCaml

Patterns such as 'a'..'z'.

Other forms of interval are recognized by the parser but rejected by the type-checker.

ppat_constant constructs an Ast.pattern_desc.Ppat_constant

Example OCaml

Patterns such as 1, 'a', "true", 1.0, 1l, 1L, 1n

ppat_alias constructs an Ast.pattern_desc.Ppat_alias

Example OCaml

An alias pattern such as P as 'a

ppat_var constructs an Ast.pattern_desc.Ppat_var

Example OCaml

A variable pattern such as x

ppat_any constructs an Ast.pattern_desc.Ppat_any

Example OCaml

The pattern _.

Object field

Module type declaration

val module_type_declaration : + loc:Location.t -> + name:string Astlib.Location.loc -> + type_:Astlib.Ast_500.Parsetree.module_type option -> + Astlib.Ast_500.Parsetree.module_type_declaration

module_type_declaration constructs an Ast.module_type_declaration

Example OCaml

Values of type module_type_declaration represents:

  • S = MT,
  • S for abstract module type declaration, when pmtd_type is None.

Module type

pmty_alias constructs an Ast.module_type_desc.Pmty_alias

Example OCaml

(module M)

pmty_extension constructs an Ast.module_type_desc.Pmty_extension

Example OCaml

[%id]

pmty_typeof constructs an Ast.module_type_desc.Pmty_typeof

Example OCaml

module type of ME

pmty_functor constructs an Ast.module_type_desc.Pmty_functor

Example OCaml

functor(X : MT1) -> MT2

pmty_signature constructs an Ast.module_type_desc.Pmty_signature

Example OCaml

sig ... end

pmty_ident constructs an Ast.module_type_desc.Pmty_ident

Example OCaml

Pmty_ident(S) represents S

Module substitution

module_substitution constructs an Ast.module_substitution

Example OCaml

Values of type module_substitution represents S := M

Module expr

pmod_extension constructs an Ast.module_expr_desc.Pmod_extension

Example OCaml

[%id]

pmod_unpack constructs an Ast.module_expr_desc.Pmod_unpack

Example OCaml

(val E)

pmod_functor constructs an Ast.module_expr_desc.Pmod_functor

Example OCaml

functor(X : MT1) -> ME

pmod_structure constructs an Ast.module_expr_desc.Pmod_structure

Example OCaml

struct ... end

Module declaration

val module_declaration : + loc:Location.t -> + name:string option Astlib.Location.loc -> + type_:Astlib.Ast_500.Parsetree.module_type -> + Astlib.Ast_500.Parsetree.module_declaration

module_declaration constructs an Ast.module_declaration

Example OCaml

Values of type module_declaration represents S : MT

Module binding

module_binding constructs an Ast.module_binding

Example OCaml

Values of type module_binding represents module X = ME

Location

val location : + start:Stdlib.Lexing.position -> + end_:Stdlib.Lexing.position -> + ghost:bool -> + Astlib.Location.t

location constructs an Ast.location

Letop

Label declaration

label_declaration constructs an Ast.label_declaration

Example OCaml

Note: T can be a Ptyp_poly.

Extension constructor

extension_constructor constructs an Ast.extension_constructor

Expression

val pexp_unreachable : loc:Location.t -> Astlib.Ast_500.Parsetree.expression

pexp_unreachable constructs an Ast.expression_desc.Pexp_unreachable

Example OCaml

.

pexp_extension constructs an Ast.expression_desc.Pexp_extension

Example OCaml

[%id]

pexp_letop constructs an Ast.expression_desc.Pexp_letop

Example OCaml

  • let* P = E0 in E1
  • let* P0 = E00 and* P1 = E01 in E1

pexp_pack constructs an Ast.expression_desc.Pexp_pack

Example OCaml

(module ME).

(module ME : S) is represented as Pexp_constraint(Pexp_pack ME, Ptyp_package S)

pexp_newtype constructs an Ast.expression_desc.Pexp_newtype

Example OCaml

fun (type t) -> E

pexp_object constructs an Ast.expression_desc.Pexp_object

Example OCaml

object ... end

pexp_poly constructs an Ast.expression_desc.Pexp_poly

Example OCaml

Used for method bodies.

Can only be used as the expression under Cfk_concrete for methods (not values).

pexp_lazy constructs an Ast.expression_desc.Pexp_lazy

Example OCaml

lazy E

pexp_assert constructs an Ast.expression_desc.Pexp_assert

Example OCaml

assert E.

Note: assert false is treated in a special way by the type-checker.

pexp_letexception constructs an Ast.expression_desc.Pexp_letexception

Example OCaml

let exception C in E

pexp_letmodule constructs an Ast.expression_desc.Pexp_letmodule

Example OCaml

let module M = ME in E

pexp_override constructs an Ast.expression_desc.Pexp_override

Example OCaml

{< x1 = E1; ...; xn = En >}

pexp_setinstvar constructs an Ast.expression_desc.Pexp_setinstvar

Example OCaml

x <- 2

pexp_new constructs an Ast.expression_desc.Pexp_new

Example OCaml

new M.c

pexp_send constructs an Ast.expression_desc.Pexp_send

Example OCaml

E # m

pexp_coerce constructs an Ast.expression_desc.Pexp_coerce

Example OCaml

Pexp_coerce(E, from, T) represents

  • (E :> T) when from is None,
  • (E : T0 :> T) when from is Some T0.

pexp_for constructs an Ast.expression_desc.Pexp_for

Example OCaml

Pexp_for(i, E1, E2, direction, E3) represents:

  • for i = E1 to E2 do E3 done when direction is Upto
  • for i = E1 downto E2 do E3 done when direction is Downto

pexp_while constructs an Ast.expression_desc.Pexp_while

Example OCaml

while E1 do E2 done

pexp_array constructs an Ast.expression_desc.Pexp_array

Example OCaml

[| E1; ...; En |]

pexp_record constructs an Ast.expression_desc.Pexp_record

Example OCaml

Pexp_record([(l1,P1) ; ... ; (ln,Pn)], exp0) represents

  • { l1=P1; ...; ln=Pn } when exp0 is None
  • { E0 with l1=P1; ...; ln=Pn } when exp0 is Some E0

Invariant: n > 0

val pexp_variant : + loc:Location.t -> + string -> + Astlib.Ast_500.Parsetree.expression option -> + Astlib.Ast_500.Parsetree.expression

pexp_variant constructs an Ast.expression_desc.Pexp_variant

Example OCaml

Pexp_variant(`A, exp) represents

  • `A when exp is None
  • `A E when exp is Some E

pexp_construct constructs an Ast.expression_desc.Pexp_construct

Example OCaml

Pexp_construct(C, exp) represents:

  • C when exp is None,
  • C E when exp is Some E,
  • C (E1, ..., En) when exp is Some (Pexp_tuple[E1;...;En])

pexp_tuple constructs an Ast.expression_desc.Pexp_tuple

Example OCaml

Expressions (E1, ..., En)

Invariant: n >= 2

pexp_try constructs an Ast.expression_desc.Pexp_try

Example OCaml

try E0 with P1 -> E1 | ... | Pn -> En

pexp_match constructs an Ast.expression_desc.Pexp_match

Example OCaml

match E0 with P1 -> E1 | ... | Pn -> En

pexp_apply constructs an Ast.expression_desc.Pexp_apply

Example OCaml

Pexp_apply(E0, [(l1, E1) ; ... ; (ln, En)]) represents E0 ~l1:E1 ... ~ln:En

li can be Nolabel (non labeled argument), Labelled (labelled arguments) or Optional (optional argument).

Invariant: n > 0

pexp_fun constructs an Ast.expression_desc.Pexp_fun

Example OCaml

Pexp_fun(lbl, exp0, P, E1) represents:

  • fun P -> E1 when lbl is Nolabel and exp0 is None
  • fun ~l:P -> E1 when lbl is Labelled l and exp0 is None
  • fun ?l:P -> E1 when lbl is Optional l and exp0 is None
  • fun ?l:(P = E0) -> E1 when lbl is Optional l and exp0 is Some E0

Notes:

  • If E0 is provided, only Optional is allowed.
  • fun P1 P2 .. Pn -> E1 is represented as nested Pexp_fun.
  • let f P = E is represented using Pexp_fun.

pexp_function constructs an Ast.expression_desc.Pexp_function

Example OCaml

function P1 -> E1 | ... | Pn -> En

pexp_let constructs an Ast.expression_desc.Pexp_let

Example OCaml

Pexp_let(flag, [(P1,E1) ; ... ; (Pn,En)], E) represents:

  • let P1 = E1 and ... and Pn = EN in E when flag is Nonrecursive,
  • let rec P1 = E1 and ... and Pn = EN in E when flag is Recursive.

pexp_constant constructs an Ast.expression_desc.Pexp_constant

Example OCaml

Expressions constant such as 1, 'a', "true", 1.0, 1l, 1L, 1n

pexp_ident constructs an Ast.expression_desc.Pexp_ident

Example OCaml

Identifiers such as x and M.x

Directive argument

val pdir_bool : + loc:Location.t -> + bool -> + Astlib.Ast_500.Parsetree.directive_argument
val pdir_int : + loc:Location.t -> + string -> + char option -> + Astlib.Ast_500.Parsetree.directive_argument
val pdir_string : + loc:Location.t -> + string -> + Astlib.Ast_500.Parsetree.directive_argument

pdir_string constructs an Ast.directive_argument_desc.Pdir_string

Core type

ptyp_extension constructs an Ast.core_type_desc.Ptyp_extension

Example OCaml

[%id].

ptyp_poly constructs an Ast.core_type_desc.Ptyp_poly

Example OCaml

'a1 ... 'an. T

Can only appear in the following context:

let x : 'a1 ... 'an. T = e ...

ptyp_variant constructs an Ast.core_type_desc.Ptyp_variant

Example OCaml

Ptyp_variant([`A;`B], flag, labels) represents:

  • [ `A|`B ] when flag is Closed, and labels is None,
  • [> `A|`B ] when flag is Open, and labels is None,
  • [< `A|`B ] when flag is Closed, and labels is Some [],
  • [< `A|`B > `X `Y ] when flag is Closed, and labels is Some ["X";"Y"].

ptyp_alias constructs an Ast.core_type_desc.Ptyp_alias

Example OCaml

T as 'a.

ptyp_class constructs an Ast.core_type_desc.Ptyp_class

Example OCaml

Ptyp_class(tconstr, l) represents:

  • #tconstr when l=[],
  • T #tconstr when l=[T],
  • (T1, ..., Tn) #tconstr when l=[T1 ; ... ; Tn].

ptyp_object constructs an Ast.core_type_desc.Ptyp_object

Example OCaml

Ptyp_object([ l1:T1; ...; ln:Tn ], flag) represents:

  • < l1:T1; ...; ln:Tn > when flag is Closed,
  • < l1:T1; ...; ln:Tn; .. > when flag is Open.

ptyp_constr constructs an Ast.core_type_desc.Ptyp_constr

Example OCaml

Ptyp_constr(lident, l) represents:

  • tconstr when l=[],
  • T tconstr when l=[T],
  • (T1, ..., Tn) tconstr when l=[T1 ; ... ; Tn].

ptyp_tuple constructs an Ast.core_type_desc.Ptyp_tuple

Example OCaml

Ptyp_tuple([T1 ; ... ; Tn]) represents a product type T1 * ... * Tn.

Invariant: n >= 2.

ptyp_arrow constructs an Ast.core_type_desc.Ptyp_arrow

Example OCaml

Ptyp_arrow(lbl, T1, T2) represents:

val ptyp_var : loc:Location.t -> string -> Astlib.Ast_500.Parsetree.core_type

ptyp_var constructs an Ast.core_type_desc.Ptyp_var

Example OCaml

A type variable such as 'a

ptyp_any constructs an Ast.core_type_desc.Ptyp_any

Example OCaml

_

Constructor declaration

Class type field

pctf_extension constructs an Ast.class_type_field_desc.Pctf_extension

Example OCaml

[%%id]

pctf_attribute constructs an Ast.class_type_field_desc.Pctf_attribute

Example OCaml

[@@@id]

pctf_inherit constructs an Ast.class_type_field_desc.Pctf_inherit

Example OCaml

inherit CT

Class type

pcty_extension constructs an Ast.class_type_desc.Pcty_extension

Example OCaml

%id

pcty_arrow constructs an Ast.class_type_desc.Pcty_arrow

Example OCaml

Pcty_arrow(lbl, T, CT) represents:

pcty_signature constructs an Ast.class_type_desc.Pcty_signature

Example OCaml

object ... end

pcty_constr constructs an Ast.class_type_desc.Pcty_constr

Example OCaml

  • c
  • ['a1, ..., 'an] c

Class structure

class_structure constructs an Ast.class_structure

Example OCaml

Values of type class_structure represents:

Class signature

class_signature constructs an Ast.class_signature

Example OCaml

Values of type class_signature represents:

Class field

pcf_extension constructs an Ast.class_field_desc.Pcf_extension

Example OCaml

[%%id]

pcf_attribute constructs an Ast.class_field_desc.Pcf_attribute

Example OCaml

[@@@id]

pcf_initializer constructs an Ast.class_field_desc.Pcf_initializer

Example OCaml

initializer E

pcf_constraint constructs an Ast.class_field_desc.Pcf_constraint

Example OCaml

constraint T1 = T2

pcf_method constructs an Ast.class_field_desc.Pcf_method

Example OCaml

pcf_val constructs an Ast.class_field_desc.Pcf_val

Example OCaml

Pcf_val(x,flag, kind) represents:

pcf_inherit constructs an Ast.class_field_desc.Pcf_inherit

Example OCaml

Pcf_inherit(flag, CE, s) represents:

  • inherit CE when flag is Fresh and s is None,
  • inherit CE as x when flag is Fresh and s is Some x,
  • inherit! CE when flag is Override and s is None,
  • inherit! CE as x when flag is Override and s is Some x

Class expr

pcl_extension constructs an Ast.class_expr_desc.Pcl_extension

Example OCaml

[%id]

pcl_let constructs an Ast.class_expr_desc.Pcl_let

Example OCaml

Pcl_let(rec, [(P1, E1); ... ; (Pn, En)], CE) represents:

  • let P1 = E1 and ... and Pn = EN in CE when rec is Nonrecursive,
  • let rec P1 = E1 and ... and Pn = EN in CE when rec is Recursive.

pcl_apply constructs an Ast.class_expr_desc.Pcl_apply

Example OCaml

Pcl_apply(CE, [(l1,E1) ; ... ; (ln,En)]) represents CE ~l1:E1 ... ~ln:En. li can be empty (non labeled argument) or start with ? (optional argument).

Invariant: n > 0

pcl_fun constructs an Ast.class_expr_desc.Pcl_fun

Example OCaml

Pcl_fun(lbl, exp0, P, CE) represents:

  • fun P -> CE when lbl is Nolabel and exp0 is None,
  • fun ~l:P -> CE when lbl is Labelled l and exp0 is None,
  • fun ?l:P -> CE when lbl is Optional l and exp0 is None,
  • fun ?l:(P = E0) -> CE when lbl is Optional l and exp0 is Some E0.

pcl_structure constructs an Ast.class_expr_desc.Pcl_structure

Example OCaml

object ... end

pcl_constr constructs an Ast.class_expr_desc.Pcl_constr

Example OCaml

c and ['a1, ..., 'an] c

Case

case constructs an Ast.case

Example OCaml

Values of type case represents (P -> E) or (P when E0 -> E)

Binding op

Attribute

attribute constructs an Ast.attribute

Example OCaml

Attributes such as [@id ARG] and [@@id ARG].

Metadata containers passed around within the AST. The compiler ignores unknown attributes.

'a open infos

val open_infos : + loc:Location.t -> + expr:'a -> + override:Astlib.Ast_500.Asttypes.override_flag -> + 'a Astlib.Ast_500.Parsetree.open_infos

open_infos constructs an Ast.'aopen_infos

Example OCaml

Values of type 'a open_infos represents:

'a include infos

val include_infos : + loc:Location.t -> + 'a -> + 'a Astlib.Ast_500.Parsetree.include_infos

include_infos constructs an Ast.'ainclude_infos

'a class infos

val value_description : - loc:Astlib.Location.t -> name:string Astlib.Location.loc -> - type_:Astlib.Ast_500.Parsetree.core_type -> - prim:string list -> - Astlib.Ast_500.Parsetree.value_description
module Latest : sig ... end

This module contains updated versions of node constructors that were kept stable when the node changed. For every function in this module, there's an equally-named function outside this module. The function outside this module will stay stable, whereas the function inside this module will adapt potential upcoming new compiler features. Only use a function in this module, if the equally-named one outside this module is missing a feature you need.

val ppat_construct : + expr:'a -> + 'a Astlib.Ast_500.Parsetree.class_infos

class_infos constructs an Ast.'aclass_infos

Example OCaml

Values of type class_expr class_infos represents:

  • class c = ...
  • class ['a1,...,'an] c = ...
  • class virtual c = ...

They are also used for "class type" declaration.

module Latest : sig ... end

This module contains updated versions of node constructors that were kept stable when the node changed. For every function in this module, there's an equally-named function outside this module. The function outside this module will stay stable, whereas the function inside this module will adapt potential upcoming new compiler features. Only use a function in this module, if the equally-named one outside this module is missing a feature you need.

val ppat_construct : loc:Astlib.Location.t -> Astlib.Longident.t Astlib.Location.loc -> Astlib.Ast_500.Parsetree.pattern option -> diff --git a/ppxlib/Ppxlib/Ast_builder/Make/index.html b/ppxlib/Ppxlib/Ast_builder/Make/index.html index 37b7ec0..ad22dd7 100644 --- a/ppxlib/Ppxlib/Ast_builder/Make/index.html +++ b/ppxlib/Ppxlib/Ast_builder/Make/index.html @@ -1,440 +1,22 @@ -Make (ppxlib.Ppxlib.Ast_builder.Make)

Module Ast_builder.Make

Build Ast helpers with the location argument factorized.

Parameters

module Loc : Loc

Signature

module Located : sig ... end
include sig ... end
val loc : Location.t
val attribute : +Make (ppxlib.Ppxlib.Ast_builder.Make)

Module Ast_builder.Make

Build Ast helpers with the location argument factorized.

Parameters

module Loc : Loc

Signature

module Located : sig ... end
val loc : Location.t

Value description

val binding_op : - op:string Astlib.Location.loc -> + type_:Astlib.Ast_500.Parsetree.core_type -> + prim:string list -> + Astlib.Ast_500.Parsetree.value_description

value_description constructs an Ast.value_description

Example OCaml

Values of type value_description represents:

  • val x: T, when pval_prim is []
  • external x: T = "s1" ... "sn" when pval_prim is ["s1";..."sn"]

Value binding

Type extension

val ptyp_var : string -> Astlib.Ast_500.Parsetree.core_type
val pdir_int : - string -> - char option -> - Astlib.Ast_500.Parsetree.directive_argument

type_extension constructs an Ast.type_extension

Example OCaml

Definition of new extensions constructors for the extensive sum type t (type t += ...).

Type exception

val include_infos : 'a -> 'a Astlib.Ast_500.Parsetree.include_infos
val location : - start:Stdlib.Lexing.position -> - end_:Stdlib.Lexing.position -> - ghost:bool -> - Astlib.Location.t
val module_type_declaration : - name:string Astlib.Location.loc -> - type_:Astlib.Ast_500.Parsetree.module_type option -> - Astlib.Ast_500.Parsetree.module_type_declaration
val open_infos : - expr:'a -> - override:Astlib.Ast_500.Asttypes.override_flag -> - 'a Astlib.Ast_500.Parsetree.open_infos
val ppat_variant : - string -> - Astlib.Ast_500.Parsetree.pattern option -> - Astlib.Ast_500.Parsetree.pattern
val ppat_unpack : - string option Astlib.Location.loc -> - Astlib.Ast_500.Parsetree.pattern
val position : - fname:string -> - lnum:int -> - bol:int -> - cnum:int -> - Stdlib.Lexing.position

type_exception constructs an Ast.type_exception

Example OCaml

Definition of a new exception (exception E).

Type declaration

type_declaration constructs an Ast.type_declaration

Example OCaml

Here are type declarations and their representation, for various ptype_kind and ptype_manifest values:

  • type t when type_kind is Ptype_abstract, and manifest is None,
  • type t = T0 when type_kind is Ptype_abstract, and manifest is Some T0,
  • type t = C of T | ... when type_kind is Ptype_variant, and manifest is None,
  • type t = T0 = C of T | ... when type_kind is Ptype_variant, and manifest is Some T0,
  • type t = {l: T; ...} when type_kind is Ptype_record, and manifest is None,
  • type t = T0 = {l : T; ...} when type_kind is Ptype_record, and manifest is Some T0,
  • type t = .. when type_kind is Ptype_open, and manifest is None.

Toplevel directive

toplevel_directive constructs an Ast.toplevel_directive

Structure item

pstr_attribute constructs an Ast.structure_item_desc.Pstr_attribute

Example OCaml

[@@@id]

pstr_class_type constructs an Ast.structure_item_desc.Pstr_class_type

Example OCaml

class type ct1 = ... and ... and ctn = ...

pstr_class constructs an Ast.structure_item_desc.Pstr_class

Example OCaml

class c1 = ... and ... and cn = ...

pstr_modtype constructs an Ast.structure_item_desc.Pstr_modtype

Example OCaml

module type S = MT

pstr_recmodule constructs an Ast.structure_item_desc.Pstr_recmodule

Example OCaml

module rec X1 = ME1 and ... and Xn = MEn

pstr_module constructs an Ast.structure_item_desc.Pstr_module

Example OCaml

module X = ME

pstr_exception constructs an Ast.structure_item_desc.Pstr_exception

Example OCaml

  • exception C of T
  • exception C = M.X

pstr_typext constructs an Ast.structure_item_desc.Pstr_typext

Example OCaml

type t1 += ...

pstr_type constructs an Ast.structure_item_desc.Pstr_type

Example OCaml

type t1 = ... and ... and tn = ...

pstr_primitive constructs an Ast.structure_item_desc.Pstr_primitive

Example OCaml

  • val x: T
  • external x: T = "s1" ... "sn"

pstr_value constructs an Ast.structure_item_desc.Pstr_value

Example OCaml

Pstr_value(rec, [(P1, E1 ; ... ; (Pn, En))]) represents:

  • let P1 = E1 and ... and Pn = EN when rec is Nonrecursive,
  • let rec P1 = E1 and ... and Pn = EN when rec is Recursive.

Signature item

psig_attribute constructs an Ast.signature_item_desc.Psig_attribute

Example OCaml

[@@@id]

psig_class_type constructs an Ast.signature_item_desc.Psig_class_type

Example OCaml

class type ct1 = ... and ... and ctn = ...

psig_class constructs an Ast.signature_item_desc.Psig_class

Example OCaml

class c1 : ... and ... and cn : ...

psig_modtypesubst constructs an Ast.signature_item_desc.Psig_modtypesubst

Example OCaml

module type S := ...

psig_modtype constructs an Ast.signature_item_desc.Psig_modtype

Example OCaml

module type S = MT and module type S

psig_recmodule constructs an Ast.signature_item_desc.Psig_recmodule

Example OCaml

module rec X1 : MT1 and ... and Xn : MTn

psig_modsubst constructs an Ast.signature_item_desc.Psig_modsubst

Example OCaml

module X := M

psig_module constructs an Ast.signature_item_desc.Psig_module

Example OCaml

module X = M and module X : MT

psig_exception constructs an Ast.signature_item_desc.Psig_exception

Example OCaml

exception C of T

psig_typext constructs an Ast.signature_item_desc.Psig_typext

Example OCaml

type t1 += ...

psig_typesubst constructs an Ast.signature_item_desc.Psig_typesubst

Example OCaml

type t1 := ... and ... and tn := ...

psig_type constructs an Ast.signature_item_desc.Psig_type

Example OCaml

type t1 = ... and ... and tn = ...

psig_value constructs an Ast.signature_item_desc.Psig_value

Example OCaml

  • val x: T
  • external x: T = "s1" ... "sn"

Row field

rinherit constructs an Ast.row_field_desc.Rinherit

Example OCaml

[ | t ]

rtag constructs an Ast.row_field_desc.Rtag

Example OCaml

Rtag(`A, b, l) represents:

  • `A when b is true and l is [],
  • `A of T when b is false and l is [T],
  • `A of T1 & .. & Tn when b is false and l is [T1;...Tn],
  • `A of & T1 & .. & Tn when b is true and l is [T1;...Tn].
  • The bool field is true if the tag contains a constant (empty) constructor.
  • & occurs when several types are used for the same constructor (see 4.2 in the manual)

Position

val position : + fname:string -> + lnum:int -> + bol:int -> + cnum:int -> + Stdlib.Lexing.position

position constructs an Ast.position

Pattern

ppat_extension constructs an Ast.pattern_desc.Ppat_extension

Example OCaml

Pattern [%id]

ppat_exception constructs an Ast.pattern_desc.Ppat_exception

Example OCaml

Pattern exception P

val ppat_unpack : + string option Astlib.Location.loc -> + Astlib.Ast_500.Parsetree.pattern

ppat_unpack constructs an Ast.pattern_desc.Ppat_unpack

Example OCaml

Ppat_unpack(s) represents:

  • (module P) when s is Some "P"
  • (module _) when s is None

Note: (module P : S) is represented as Ppat_constraint(Ppat_unpack(Some "P"), Ptyp_package S)

ppat_lazy constructs an Ast.pattern_desc.Ppat_lazy

Example OCaml

Pattern lazy P

ppat_type constructs an Ast.pattern_desc.Ppat_type

Example OCaml

Pattern #tconst

ppat_constraint constructs an Ast.pattern_desc.Ppat_constraint

Example OCaml

Pattern (P : T)

ppat_array constructs an Ast.pattern_desc.Ppat_array

Example OCaml

Pattern [| P1; ...; Pn |]

ppat_record constructs an Ast.pattern_desc.Ppat_record

Example OCaml

Ppat_record([(l1, P1) ; ... ; (ln, Pn)], flag) represents:

  • { l1=P1; ...; ln=Pn } when flag is Closed
  • { l1=P1; ...; ln=Pn; _} when flag is Open

Invariant: n > 0

val ppat_variant : + string -> + Astlib.Ast_500.Parsetree.pattern option -> + Astlib.Ast_500.Parsetree.pattern

ppat_variant constructs an Ast.pattern_desc.Ppat_variant

Example OCaml

Ppat_variant(`A, pat) represents:

  • `A when pat is None,
  • `A P when pat is Some P

ppat_tuple constructs an Ast.pattern_desc.Ppat_tuple

Example OCaml

Patterns (P1, ..., Pn).

Invariant: n >= 2

ppat_interval constructs an Ast.pattern_desc.Ppat_interval

Example OCaml

Patterns such as 'a'..'z'.

Other forms of interval are recognized by the parser but rejected by the type-checker.

ppat_constant constructs an Ast.pattern_desc.Ppat_constant

Example OCaml

Patterns such as 1, 'a', "true", 1.0, 1l, 1L, 1n

ppat_alias constructs an Ast.pattern_desc.Ppat_alias

Example OCaml

An alias pattern such as P as 'a

ppat_var constructs an Ast.pattern_desc.Ppat_var

Example OCaml

A variable pattern such as x

ppat_any constructs an Ast.pattern_desc.Ppat_any

Example OCaml

The pattern _.

Object field

Module type declaration

val module_type_declaration : + name:string Astlib.Location.loc -> + type_:Astlib.Ast_500.Parsetree.module_type option -> + Astlib.Ast_500.Parsetree.module_type_declaration

module_type_declaration constructs an Ast.module_type_declaration

Example OCaml

Values of type module_type_declaration represents:

  • S = MT,
  • S for abstract module type declaration, when pmtd_type is None.

Module type

pmty_alias constructs an Ast.module_type_desc.Pmty_alias

Example OCaml

(module M)

pmty_extension constructs an Ast.module_type_desc.Pmty_extension

Example OCaml

[%id]

pmty_typeof constructs an Ast.module_type_desc.Pmty_typeof

Example OCaml

module type of ME

pmty_signature constructs an Ast.module_type_desc.Pmty_signature

Example OCaml

sig ... end

pmty_ident constructs an Ast.module_type_desc.Pmty_ident

Example OCaml

Pmty_ident(S) represents S

Module substitution

module_substitution constructs an Ast.module_substitution

Example OCaml

Values of type module_substitution represents S := M

Module expr

pmod_extension constructs an Ast.module_expr_desc.Pmod_extension

Example OCaml

[%id]

pmod_unpack constructs an Ast.module_expr_desc.Pmod_unpack

Example OCaml

(val E)

pmod_structure constructs an Ast.module_expr_desc.Pmod_structure

Example OCaml

struct ... end

Module declaration

module_declaration constructs an Ast.module_declaration

Example OCaml

Values of type module_declaration represents S : MT

Module binding

module_binding constructs an Ast.module_binding

Example OCaml

Values of type module_binding represents module X = ME

Location

val location : + start:Stdlib.Lexing.position -> + end_:Stdlib.Lexing.position -> + ghost:bool -> + Astlib.Location.t

location constructs an Ast.location

Letop

Label declaration

label_declaration constructs an Ast.label_declaration

Example OCaml

Note: T can be a Ptyp_poly.

Extension constructor

extension_constructor constructs an Ast.extension_constructor

Expression

pexp_unreachable constructs an Ast.expression_desc.Pexp_unreachable

Example OCaml

.

pexp_extension constructs an Ast.expression_desc.Pexp_extension

Example OCaml

[%id]

pexp_letop constructs an Ast.expression_desc.Pexp_letop

Example OCaml

  • let* P = E0 in E1
  • let* P0 = E00 and* P1 = E01 in E1

pexp_pack constructs an Ast.expression_desc.Pexp_pack

Example OCaml

(module ME).

(module ME : S) is represented as Pexp_constraint(Pexp_pack ME, Ptyp_package S)

pexp_newtype constructs an Ast.expression_desc.Pexp_newtype

Example OCaml

fun (type t) -> E

pexp_object constructs an Ast.expression_desc.Pexp_object

Example OCaml

object ... end

pexp_poly constructs an Ast.expression_desc.Pexp_poly

Example OCaml

Used for method bodies.

Can only be used as the expression under Cfk_concrete for methods (not values).

pexp_lazy constructs an Ast.expression_desc.Pexp_lazy

Example OCaml

lazy E

pexp_assert constructs an Ast.expression_desc.Pexp_assert

Example OCaml

assert E.

Note: assert false is treated in a special way by the type-checker.

pexp_letexception constructs an Ast.expression_desc.Pexp_letexception

Example OCaml

let exception C in E

pexp_letmodule constructs an Ast.expression_desc.Pexp_letmodule

Example OCaml

let module M = ME in E

pexp_override constructs an Ast.expression_desc.Pexp_override

Example OCaml

{< x1 = E1; ...; xn = En >}

pexp_setinstvar constructs an Ast.expression_desc.Pexp_setinstvar

Example OCaml

x <- 2

pexp_new constructs an Ast.expression_desc.Pexp_new

Example OCaml

new M.c

pexp_send constructs an Ast.expression_desc.Pexp_send

Example OCaml

E # m

pexp_coerce constructs an Ast.expression_desc.Pexp_coerce

Example OCaml

Pexp_coerce(E, from, T) represents

  • (E :> T) when from is None,
  • (E : T0 :> T) when from is Some T0.

pexp_for constructs an Ast.expression_desc.Pexp_for

Example OCaml

Pexp_for(i, E1, E2, direction, E3) represents:

  • for i = E1 to E2 do E3 done when direction is Upto
  • for i = E1 downto E2 do E3 done when direction is Downto

pexp_array constructs an Ast.expression_desc.Pexp_array

Example OCaml

[| E1; ...; En |]

pexp_record constructs an Ast.expression_desc.Pexp_record

Example OCaml

Pexp_record([(l1,P1) ; ... ; (ln,Pn)], exp0) represents

  • { l1=P1; ...; ln=Pn } when exp0 is None
  • { E0 with l1=P1; ...; ln=Pn } when exp0 is Some E0

Invariant: n > 0

pexp_variant constructs an Ast.expression_desc.Pexp_variant

Example OCaml

Pexp_variant(`A, exp) represents

  • `A when exp is None
  • `A E when exp is Some E

pexp_construct constructs an Ast.expression_desc.Pexp_construct

Example OCaml

Pexp_construct(C, exp) represents:

  • C when exp is None,
  • C E when exp is Some E,
  • C (E1, ..., En) when exp is Some (Pexp_tuple[E1;...;En])

pexp_tuple constructs an Ast.expression_desc.Pexp_tuple

Example OCaml

Expressions (E1, ..., En)

Invariant: n >= 2

pexp_try constructs an Ast.expression_desc.Pexp_try

Example OCaml

try E0 with P1 -> E1 | ... | Pn -> En

pexp_match constructs an Ast.expression_desc.Pexp_match

Example OCaml

match E0 with P1 -> E1 | ... | Pn -> En

pexp_apply constructs an Ast.expression_desc.Pexp_apply

Example OCaml

Pexp_apply(E0, [(l1, E1) ; ... ; (ln, En)]) represents E0 ~l1:E1 ... ~ln:En

li can be Nolabel (non labeled argument), Labelled (labelled arguments) or Optional (optional argument).

Invariant: n > 0

pexp_fun constructs an Ast.expression_desc.Pexp_fun

Example OCaml

Pexp_fun(lbl, exp0, P, E1) represents:

  • fun P -> E1 when lbl is Nolabel and exp0 is None
  • fun ~l:P -> E1 when lbl is Labelled l and exp0 is None
  • fun ?l:P -> E1 when lbl is Optional l and exp0 is None
  • fun ?l:(P = E0) -> E1 when lbl is Optional l and exp0 is Some E0

Notes:

  • If E0 is provided, only Optional is allowed.
  • fun P1 P2 .. Pn -> E1 is represented as nested Pexp_fun.
  • let f P = E is represented using Pexp_fun.

pexp_function constructs an Ast.expression_desc.Pexp_function

Example OCaml

function P1 -> E1 | ... | Pn -> En

pexp_let constructs an Ast.expression_desc.Pexp_let

Example OCaml

Pexp_let(flag, [(P1,E1) ; ... ; (Pn,En)], E) represents:

  • let P1 = E1 and ... and Pn = EN in E when flag is Nonrecursive,
  • let rec P1 = E1 and ... and Pn = EN in E when flag is Recursive.

pexp_constant constructs an Ast.expression_desc.Pexp_constant

Example OCaml

Expressions constant such as 1, 'a', "true", 1.0, 1l, 1L, 1n

pexp_ident constructs an Ast.expression_desc.Pexp_ident

Example OCaml

Identifiers such as x and M.x

Directive argument

val pdir_int : + string -> + char option -> + Astlib.Ast_500.Parsetree.directive_argument

Core type

ptyp_extension constructs an Ast.core_type_desc.Ptyp_extension

Example OCaml

[%id].

ptyp_poly constructs an Ast.core_type_desc.Ptyp_poly

Example OCaml

'a1 ... 'an. T

Can only appear in the following context:

let x : 'a1 ... 'an. T = e ...

ptyp_variant constructs an Ast.core_type_desc.Ptyp_variant

Example OCaml

Ptyp_variant([`A;`B], flag, labels) represents:

  • [ `A|`B ] when flag is Closed, and labels is None,
  • [> `A|`B ] when flag is Open, and labels is None,
  • [< `A|`B ] when flag is Closed, and labels is Some [],
  • [< `A|`B > `X `Y ] when flag is Closed, and labels is Some ["X";"Y"].

ptyp_alias constructs an Ast.core_type_desc.Ptyp_alias

Example OCaml

T as 'a.

ptyp_class constructs an Ast.core_type_desc.Ptyp_class

Example OCaml

Ptyp_class(tconstr, l) represents:

  • #tconstr when l=[],
  • T #tconstr when l=[T],
  • (T1, ..., Tn) #tconstr when l=[T1 ; ... ; Tn].

ptyp_object constructs an Ast.core_type_desc.Ptyp_object

Example OCaml

Ptyp_object([ l1:T1; ...; ln:Tn ], flag) represents:

  • < l1:T1; ...; ln:Tn > when flag is Closed,
  • < l1:T1; ...; ln:Tn; .. > when flag is Open.

ptyp_constr constructs an Ast.core_type_desc.Ptyp_constr

Example OCaml

Ptyp_constr(lident, l) represents:

  • tconstr when l=[],
  • T tconstr when l=[T],
  • (T1, ..., Tn) tconstr when l=[T1 ; ... ; Tn].

ptyp_tuple constructs an Ast.core_type_desc.Ptyp_tuple

Example OCaml

Ptyp_tuple([T1 ; ... ; Tn]) represents a product type T1 * ... * Tn.

Invariant: n >= 2.

ptyp_arrow constructs an Ast.core_type_desc.Ptyp_arrow

Example OCaml

Ptyp_arrow(lbl, T1, T2) represents:

val ptyp_var : string -> Astlib.Ast_500.Parsetree.core_type

ptyp_var constructs an Ast.core_type_desc.Ptyp_var

Example OCaml

A type variable such as 'a

ptyp_any constructs an Ast.core_type_desc.Ptyp_any

Example OCaml

_

Constructor declaration

Class type field

pctf_extension constructs an Ast.class_type_field_desc.Pctf_extension

Example OCaml

[%%id]

pctf_attribute constructs an Ast.class_type_field_desc.Pctf_attribute

Example OCaml

[@@@id]

pctf_inherit constructs an Ast.class_type_field_desc.Pctf_inherit

Example OCaml

inherit CT

Class type

pcty_extension constructs an Ast.class_type_desc.Pcty_extension

Example OCaml

%id

pcty_arrow constructs an Ast.class_type_desc.Pcty_arrow

Example OCaml

Pcty_arrow(lbl, T, CT) represents:

pcty_signature constructs an Ast.class_type_desc.Pcty_signature

Example OCaml

object ... end

pcty_constr constructs an Ast.class_type_desc.Pcty_constr

Example OCaml

  • c
  • ['a1, ..., 'an] c

Class structure

class_structure constructs an Ast.class_structure

Example OCaml

Values of type class_structure represents:

Class signature

class_signature constructs an Ast.class_signature

Example OCaml

Values of type class_signature represents:

Class field

pcf_extension constructs an Ast.class_field_desc.Pcf_extension

Example OCaml

[%%id]

pcf_attribute constructs an Ast.class_field_desc.Pcf_attribute

Example OCaml

[@@@id]

pcf_initializer constructs an Ast.class_field_desc.Pcf_initializer

Example OCaml

initializer E

pcf_constraint constructs an Ast.class_field_desc.Pcf_constraint

Example OCaml

constraint T1 = T2

pcf_method constructs an Ast.class_field_desc.Pcf_method

Example OCaml

pcf_val constructs an Ast.class_field_desc.Pcf_val

Example OCaml

Pcf_val(x,flag, kind) represents:

pcf_inherit constructs an Ast.class_field_desc.Pcf_inherit

Example OCaml

Pcf_inherit(flag, CE, s) represents:

  • inherit CE when flag is Fresh and s is None,
  • inherit CE as x when flag is Fresh and s is Some x,
  • inherit! CE when flag is Override and s is None,
  • inherit! CE as x when flag is Override and s is Some x

Class expr

pcl_extension constructs an Ast.class_expr_desc.Pcl_extension

Example OCaml

[%id]

pcl_let constructs an Ast.class_expr_desc.Pcl_let

Example OCaml

Pcl_let(rec, [(P1, E1); ... ; (Pn, En)], CE) represents:

  • let P1 = E1 and ... and Pn = EN in CE when rec is Nonrecursive,
  • let rec P1 = E1 and ... and Pn = EN in CE when rec is Recursive.

pcl_apply constructs an Ast.class_expr_desc.Pcl_apply

Example OCaml

Pcl_apply(CE, [(l1,E1) ; ... ; (ln,En)]) represents CE ~l1:E1 ... ~ln:En. li can be empty (non labeled argument) or start with ? (optional argument).

Invariant: n > 0

pcl_fun constructs an Ast.class_expr_desc.Pcl_fun

Example OCaml

Pcl_fun(lbl, exp0, P, CE) represents:

  • fun P -> CE when lbl is Nolabel and exp0 is None,
  • fun ~l:P -> CE when lbl is Labelled l and exp0 is None,
  • fun ?l:P -> CE when lbl is Optional l and exp0 is None,
  • fun ?l:(P = E0) -> CE when lbl is Optional l and exp0 is Some E0.

pcl_structure constructs an Ast.class_expr_desc.Pcl_structure

Example OCaml

object ... end

pcl_constr constructs an Ast.class_expr_desc.Pcl_constr

Example OCaml

c and ['a1, ..., 'an] c

Case

case constructs an Ast.case

Example OCaml

Values of type case represents (P -> E) or (P when E0 -> E)

Binding op

Attribute

attribute constructs an Ast.attribute

Example OCaml

Attributes such as [@id ARG] and [@@id ARG].

Metadata containers passed around within the AST. The compiler ignores unknown attributes.

'a open infos

val open_infos : + expr:'a -> + override:Astlib.Ast_500.Asttypes.override_flag -> + 'a Astlib.Ast_500.Parsetree.open_infos

open_infos constructs an Ast.'aopen_infos

Example OCaml

Values of type 'a open_infos represents:

'a include infos

val include_infos : 'a -> 'a Astlib.Ast_500.Parsetree.include_infos

include_infos constructs an Ast.'ainclude_infos

'a class infos

val value_description : name:string Astlib.Location.loc -> - type_:Astlib.Ast_500.Parsetree.core_type -> - prim:string list -> - Astlib.Ast_500.Parsetree.value_description
val estring : string -> Astlib.Ast_500.Parsetree.expression
val enativeint : nativeint -> Astlib.Ast_500.Parsetree.expression
val pstring : string -> Astlib.Ast_500.Parsetree.pattern
val pfloat : string -> Astlib.Ast_500.Parsetree.pattern
val pint32 : int32 -> Astlib.Ast_500.Parsetree.pattern
val pint64 : int64 -> Astlib.Ast_500.Parsetree.pattern
val pnativeint : nativeint -> Astlib.Ast_500.Parsetree.pattern

evar id produces a Pexp_ident _ expression, it parses its input so you can pass any dot-separated identifier, for instance: evar ~loc "Foo.bar".

val eapply : + expr:'a -> + 'a Astlib.Ast_500.Parsetree.class_infos

class_infos constructs an Ast.'aclass_infos

Example OCaml

Values of type class_expr class_infos represents:

  • class c = ...
  • class ['a1,...,'an] c = ...
  • class virtual c = ...

They are also used for "class type" declaration.

val estring : string -> Astlib.Ast_500.Parsetree.expression
val enativeint : nativeint -> Astlib.Ast_500.Parsetree.expression
val pstring : string -> Astlib.Ast_500.Parsetree.pattern
val pfloat : string -> Astlib.Ast_500.Parsetree.pattern
val pint32 : int32 -> Astlib.Ast_500.Parsetree.pattern
val pint64 : int64 -> Astlib.Ast_500.Parsetree.pattern
val pnativeint : nativeint -> Astlib.Ast_500.Parsetree.pattern

evar id produces a Pexp_ident _ expression, it parses its input so you can pass any dot-separated identifier, for instance: evar ~loc "Foo.bar".

val eabstract : diff --git a/ppxlib/Ppxlib/Ast_builder/module-type-S/index.html b/ppxlib/Ppxlib/Ast_builder/module-type-S/index.html index aa643b6..8416f69 100644 --- a/ppxlib/Ppxlib/Ast_builder/module-type-S/index.html +++ b/ppxlib/Ppxlib/Ast_builder/module-type-S/index.html @@ -1,440 +1,22 @@ -S (ppxlib.Ppxlib.Ast_builder.S)

Module type Ast_builder.S

module Located : sig ... end
include sig ... end
val loc : Location.t
val attribute : +S (ppxlib.Ppxlib.Ast_builder.S)

Module type Ast_builder.S

module Located : sig ... end
val loc : Location.t

Value description

val binding_op : - op:string Astlib.Location.loc -> + type_:Astlib.Ast_500.Parsetree.core_type -> + prim:string list -> + Astlib.Ast_500.Parsetree.value_description

value_description constructs an Ast.value_description

Example OCaml

Values of type value_description represents:

  • val x: T, when pval_prim is []
  • external x: T = "s1" ... "sn" when pval_prim is ["s1";..."sn"]

Value binding

Type extension

val ptyp_var : string -> Astlib.Ast_500.Parsetree.core_type
val pdir_int : - string -> - char option -> - Astlib.Ast_500.Parsetree.directive_argument

type_extension constructs an Ast.type_extension

Example OCaml

Definition of new extensions constructors for the extensive sum type t (type t += ...).

Type exception

val include_infos : 'a -> 'a Astlib.Ast_500.Parsetree.include_infos
val location : - start:Stdlib.Lexing.position -> - end_:Stdlib.Lexing.position -> - ghost:bool -> - Astlib.Location.t
val module_type_declaration : - name:string Astlib.Location.loc -> - type_:Astlib.Ast_500.Parsetree.module_type option -> - Astlib.Ast_500.Parsetree.module_type_declaration
val open_infos : - expr:'a -> - override:Astlib.Ast_500.Asttypes.override_flag -> - 'a Astlib.Ast_500.Parsetree.open_infos
val ppat_variant : - string -> - Astlib.Ast_500.Parsetree.pattern option -> - Astlib.Ast_500.Parsetree.pattern
val ppat_unpack : - string option Astlib.Location.loc -> - Astlib.Ast_500.Parsetree.pattern
val position : - fname:string -> - lnum:int -> - bol:int -> - cnum:int -> - Stdlib.Lexing.position

type_exception constructs an Ast.type_exception

Example OCaml

Definition of a new exception (exception E).

Type declaration

type_declaration constructs an Ast.type_declaration

Example OCaml

Here are type declarations and their representation, for various ptype_kind and ptype_manifest values:

  • type t when type_kind is Ptype_abstract, and manifest is None,
  • type t = T0 when type_kind is Ptype_abstract, and manifest is Some T0,
  • type t = C of T | ... when type_kind is Ptype_variant, and manifest is None,
  • type t = T0 = C of T | ... when type_kind is Ptype_variant, and manifest is Some T0,
  • type t = {l: T; ...} when type_kind is Ptype_record, and manifest is None,
  • type t = T0 = {l : T; ...} when type_kind is Ptype_record, and manifest is Some T0,
  • type t = .. when type_kind is Ptype_open, and manifest is None.

Toplevel directive

toplevel_directive constructs an Ast.toplevel_directive

Structure item

pstr_attribute constructs an Ast.structure_item_desc.Pstr_attribute

Example OCaml

[@@@id]

pstr_class_type constructs an Ast.structure_item_desc.Pstr_class_type

Example OCaml

class type ct1 = ... and ... and ctn = ...

pstr_class constructs an Ast.structure_item_desc.Pstr_class

Example OCaml

class c1 = ... and ... and cn = ...

pstr_modtype constructs an Ast.structure_item_desc.Pstr_modtype

Example OCaml

module type S = MT

pstr_recmodule constructs an Ast.structure_item_desc.Pstr_recmodule

Example OCaml

module rec X1 = ME1 and ... and Xn = MEn

pstr_module constructs an Ast.structure_item_desc.Pstr_module

Example OCaml

module X = ME

pstr_exception constructs an Ast.structure_item_desc.Pstr_exception

Example OCaml

  • exception C of T
  • exception C = M.X

pstr_typext constructs an Ast.structure_item_desc.Pstr_typext

Example OCaml

type t1 += ...

pstr_type constructs an Ast.structure_item_desc.Pstr_type

Example OCaml

type t1 = ... and ... and tn = ...

pstr_primitive constructs an Ast.structure_item_desc.Pstr_primitive

Example OCaml

  • val x: T
  • external x: T = "s1" ... "sn"

pstr_value constructs an Ast.structure_item_desc.Pstr_value

Example OCaml

Pstr_value(rec, [(P1, E1 ; ... ; (Pn, En))]) represents:

  • let P1 = E1 and ... and Pn = EN when rec is Nonrecursive,
  • let rec P1 = E1 and ... and Pn = EN when rec is Recursive.

Signature item

psig_attribute constructs an Ast.signature_item_desc.Psig_attribute

Example OCaml

[@@@id]

psig_class_type constructs an Ast.signature_item_desc.Psig_class_type

Example OCaml

class type ct1 = ... and ... and ctn = ...

psig_class constructs an Ast.signature_item_desc.Psig_class

Example OCaml

class c1 : ... and ... and cn : ...

psig_modtypesubst constructs an Ast.signature_item_desc.Psig_modtypesubst

Example OCaml

module type S := ...

psig_modtype constructs an Ast.signature_item_desc.Psig_modtype

Example OCaml

module type S = MT and module type S

psig_recmodule constructs an Ast.signature_item_desc.Psig_recmodule

Example OCaml

module rec X1 : MT1 and ... and Xn : MTn

psig_modsubst constructs an Ast.signature_item_desc.Psig_modsubst

Example OCaml

module X := M

psig_module constructs an Ast.signature_item_desc.Psig_module

Example OCaml

module X = M and module X : MT

psig_exception constructs an Ast.signature_item_desc.Psig_exception

Example OCaml

exception C of T

psig_typext constructs an Ast.signature_item_desc.Psig_typext

Example OCaml

type t1 += ...

psig_typesubst constructs an Ast.signature_item_desc.Psig_typesubst

Example OCaml

type t1 := ... and ... and tn := ...

psig_type constructs an Ast.signature_item_desc.Psig_type

Example OCaml

type t1 = ... and ... and tn = ...

psig_value constructs an Ast.signature_item_desc.Psig_value

Example OCaml

  • val x: T
  • external x: T = "s1" ... "sn"

Row field

rinherit constructs an Ast.row_field_desc.Rinherit

Example OCaml

[ | t ]

rtag constructs an Ast.row_field_desc.Rtag

Example OCaml

Rtag(`A, b, l) represents:

  • `A when b is true and l is [],
  • `A of T when b is false and l is [T],
  • `A of T1 & .. & Tn when b is false and l is [T1;...Tn],
  • `A of & T1 & .. & Tn when b is true and l is [T1;...Tn].
  • The bool field is true if the tag contains a constant (empty) constructor.
  • & occurs when several types are used for the same constructor (see 4.2 in the manual)

Position

val position : + fname:string -> + lnum:int -> + bol:int -> + cnum:int -> + Stdlib.Lexing.position

position constructs an Ast.position

Pattern

ppat_extension constructs an Ast.pattern_desc.Ppat_extension

Example OCaml

Pattern [%id]

ppat_exception constructs an Ast.pattern_desc.Ppat_exception

Example OCaml

Pattern exception P

val ppat_unpack : + string option Astlib.Location.loc -> + Astlib.Ast_500.Parsetree.pattern

ppat_unpack constructs an Ast.pattern_desc.Ppat_unpack

Example OCaml

Ppat_unpack(s) represents:

  • (module P) when s is Some "P"
  • (module _) when s is None

Note: (module P : S) is represented as Ppat_constraint(Ppat_unpack(Some "P"), Ptyp_package S)

ppat_lazy constructs an Ast.pattern_desc.Ppat_lazy

Example OCaml

Pattern lazy P

ppat_type constructs an Ast.pattern_desc.Ppat_type

Example OCaml

Pattern #tconst

ppat_constraint constructs an Ast.pattern_desc.Ppat_constraint

Example OCaml

Pattern (P : T)

ppat_array constructs an Ast.pattern_desc.Ppat_array

Example OCaml

Pattern [| P1; ...; Pn |]

ppat_record constructs an Ast.pattern_desc.Ppat_record

Example OCaml

Ppat_record([(l1, P1) ; ... ; (ln, Pn)], flag) represents:

  • { l1=P1; ...; ln=Pn } when flag is Closed
  • { l1=P1; ...; ln=Pn; _} when flag is Open

Invariant: n > 0

val ppat_variant : + string -> + Astlib.Ast_500.Parsetree.pattern option -> + Astlib.Ast_500.Parsetree.pattern

ppat_variant constructs an Ast.pattern_desc.Ppat_variant

Example OCaml

Ppat_variant(`A, pat) represents:

  • `A when pat is None,
  • `A P when pat is Some P

ppat_tuple constructs an Ast.pattern_desc.Ppat_tuple

Example OCaml

Patterns (P1, ..., Pn).

Invariant: n >= 2

ppat_interval constructs an Ast.pattern_desc.Ppat_interval

Example OCaml

Patterns such as 'a'..'z'.

Other forms of interval are recognized by the parser but rejected by the type-checker.

ppat_constant constructs an Ast.pattern_desc.Ppat_constant

Example OCaml

Patterns such as 1, 'a', "true", 1.0, 1l, 1L, 1n

ppat_alias constructs an Ast.pattern_desc.Ppat_alias

Example OCaml

An alias pattern such as P as 'a

ppat_var constructs an Ast.pattern_desc.Ppat_var

Example OCaml

A variable pattern such as x

ppat_any constructs an Ast.pattern_desc.Ppat_any

Example OCaml

The pattern _.

Object field

Module type declaration

val module_type_declaration : + name:string Astlib.Location.loc -> + type_:Astlib.Ast_500.Parsetree.module_type option -> + Astlib.Ast_500.Parsetree.module_type_declaration

module_type_declaration constructs an Ast.module_type_declaration

Example OCaml

Values of type module_type_declaration represents:

  • S = MT,
  • S for abstract module type declaration, when pmtd_type is None.

Module type

pmty_alias constructs an Ast.module_type_desc.Pmty_alias

Example OCaml

(module M)

pmty_extension constructs an Ast.module_type_desc.Pmty_extension

Example OCaml

[%id]

pmty_typeof constructs an Ast.module_type_desc.Pmty_typeof

Example OCaml

module type of ME

pmty_signature constructs an Ast.module_type_desc.Pmty_signature

Example OCaml

sig ... end

pmty_ident constructs an Ast.module_type_desc.Pmty_ident

Example OCaml

Pmty_ident(S) represents S

Module substitution

module_substitution constructs an Ast.module_substitution

Example OCaml

Values of type module_substitution represents S := M

Module expr

pmod_extension constructs an Ast.module_expr_desc.Pmod_extension

Example OCaml

[%id]

pmod_unpack constructs an Ast.module_expr_desc.Pmod_unpack

Example OCaml

(val E)

pmod_structure constructs an Ast.module_expr_desc.Pmod_structure

Example OCaml

struct ... end

Module declaration

module_declaration constructs an Ast.module_declaration

Example OCaml

Values of type module_declaration represents S : MT

Module binding

module_binding constructs an Ast.module_binding

Example OCaml

Values of type module_binding represents module X = ME

Location

val location : + start:Stdlib.Lexing.position -> + end_:Stdlib.Lexing.position -> + ghost:bool -> + Astlib.Location.t

location constructs an Ast.location

Letop

Label declaration

label_declaration constructs an Ast.label_declaration

Example OCaml

Note: T can be a Ptyp_poly.

Extension constructor

extension_constructor constructs an Ast.extension_constructor

Expression

pexp_unreachable constructs an Ast.expression_desc.Pexp_unreachable

Example OCaml

.

pexp_extension constructs an Ast.expression_desc.Pexp_extension

Example OCaml

[%id]

pexp_letop constructs an Ast.expression_desc.Pexp_letop

Example OCaml

  • let* P = E0 in E1
  • let* P0 = E00 and* P1 = E01 in E1

pexp_pack constructs an Ast.expression_desc.Pexp_pack

Example OCaml

(module ME).

(module ME : S) is represented as Pexp_constraint(Pexp_pack ME, Ptyp_package S)

pexp_newtype constructs an Ast.expression_desc.Pexp_newtype

Example OCaml

fun (type t) -> E

pexp_object constructs an Ast.expression_desc.Pexp_object

Example OCaml

object ... end

pexp_poly constructs an Ast.expression_desc.Pexp_poly

Example OCaml

Used for method bodies.

Can only be used as the expression under Cfk_concrete for methods (not values).

pexp_lazy constructs an Ast.expression_desc.Pexp_lazy

Example OCaml

lazy E

pexp_assert constructs an Ast.expression_desc.Pexp_assert

Example OCaml

assert E.

Note: assert false is treated in a special way by the type-checker.

pexp_letexception constructs an Ast.expression_desc.Pexp_letexception

Example OCaml

let exception C in E

pexp_letmodule constructs an Ast.expression_desc.Pexp_letmodule

Example OCaml

let module M = ME in E

pexp_override constructs an Ast.expression_desc.Pexp_override

Example OCaml

{< x1 = E1; ...; xn = En >}

pexp_setinstvar constructs an Ast.expression_desc.Pexp_setinstvar

Example OCaml

x <- 2

pexp_new constructs an Ast.expression_desc.Pexp_new

Example OCaml

new M.c

pexp_send constructs an Ast.expression_desc.Pexp_send

Example OCaml

E # m

pexp_coerce constructs an Ast.expression_desc.Pexp_coerce

Example OCaml

Pexp_coerce(E, from, T) represents

  • (E :> T) when from is None,
  • (E : T0 :> T) when from is Some T0.

pexp_for constructs an Ast.expression_desc.Pexp_for

Example OCaml

Pexp_for(i, E1, E2, direction, E3) represents:

  • for i = E1 to E2 do E3 done when direction is Upto
  • for i = E1 downto E2 do E3 done when direction is Downto

pexp_array constructs an Ast.expression_desc.Pexp_array

Example OCaml

[| E1; ...; En |]

pexp_record constructs an Ast.expression_desc.Pexp_record

Example OCaml

Pexp_record([(l1,P1) ; ... ; (ln,Pn)], exp0) represents

  • { l1=P1; ...; ln=Pn } when exp0 is None
  • { E0 with l1=P1; ...; ln=Pn } when exp0 is Some E0

Invariant: n > 0

pexp_variant constructs an Ast.expression_desc.Pexp_variant

Example OCaml

Pexp_variant(`A, exp) represents

  • `A when exp is None
  • `A E when exp is Some E

pexp_construct constructs an Ast.expression_desc.Pexp_construct

Example OCaml

Pexp_construct(C, exp) represents:

  • C when exp is None,
  • C E when exp is Some E,
  • C (E1, ..., En) when exp is Some (Pexp_tuple[E1;...;En])

pexp_tuple constructs an Ast.expression_desc.Pexp_tuple

Example OCaml

Expressions (E1, ..., En)

Invariant: n >= 2

pexp_try constructs an Ast.expression_desc.Pexp_try

Example OCaml

try E0 with P1 -> E1 | ... | Pn -> En

pexp_match constructs an Ast.expression_desc.Pexp_match

Example OCaml

match E0 with P1 -> E1 | ... | Pn -> En

pexp_apply constructs an Ast.expression_desc.Pexp_apply

Example OCaml

Pexp_apply(E0, [(l1, E1) ; ... ; (ln, En)]) represents E0 ~l1:E1 ... ~ln:En

li can be Nolabel (non labeled argument), Labelled (labelled arguments) or Optional (optional argument).

Invariant: n > 0

pexp_fun constructs an Ast.expression_desc.Pexp_fun

Example OCaml

Pexp_fun(lbl, exp0, P, E1) represents:

  • fun P -> E1 when lbl is Nolabel and exp0 is None
  • fun ~l:P -> E1 when lbl is Labelled l and exp0 is None
  • fun ?l:P -> E1 when lbl is Optional l and exp0 is None
  • fun ?l:(P = E0) -> E1 when lbl is Optional l and exp0 is Some E0

Notes:

  • If E0 is provided, only Optional is allowed.
  • fun P1 P2 .. Pn -> E1 is represented as nested Pexp_fun.
  • let f P = E is represented using Pexp_fun.

pexp_function constructs an Ast.expression_desc.Pexp_function

Example OCaml

function P1 -> E1 | ... | Pn -> En

pexp_let constructs an Ast.expression_desc.Pexp_let

Example OCaml

Pexp_let(flag, [(P1,E1) ; ... ; (Pn,En)], E) represents:

  • let P1 = E1 and ... and Pn = EN in E when flag is Nonrecursive,
  • let rec P1 = E1 and ... and Pn = EN in E when flag is Recursive.

pexp_constant constructs an Ast.expression_desc.Pexp_constant

Example OCaml

Expressions constant such as 1, 'a', "true", 1.0, 1l, 1L, 1n

pexp_ident constructs an Ast.expression_desc.Pexp_ident

Example OCaml

Identifiers such as x and M.x

Directive argument

val pdir_int : + string -> + char option -> + Astlib.Ast_500.Parsetree.directive_argument

Core type

ptyp_extension constructs an Ast.core_type_desc.Ptyp_extension

Example OCaml

[%id].

ptyp_poly constructs an Ast.core_type_desc.Ptyp_poly

Example OCaml

'a1 ... 'an. T

Can only appear in the following context:

let x : 'a1 ... 'an. T = e ...

ptyp_variant constructs an Ast.core_type_desc.Ptyp_variant

Example OCaml

Ptyp_variant([`A;`B], flag, labels) represents:

  • [ `A|`B ] when flag is Closed, and labels is None,
  • [> `A|`B ] when flag is Open, and labels is None,
  • [< `A|`B ] when flag is Closed, and labels is Some [],
  • [< `A|`B > `X `Y ] when flag is Closed, and labels is Some ["X";"Y"].

ptyp_alias constructs an Ast.core_type_desc.Ptyp_alias

Example OCaml

T as 'a.

ptyp_class constructs an Ast.core_type_desc.Ptyp_class

Example OCaml

Ptyp_class(tconstr, l) represents:

  • #tconstr when l=[],
  • T #tconstr when l=[T],
  • (T1, ..., Tn) #tconstr when l=[T1 ; ... ; Tn].

ptyp_object constructs an Ast.core_type_desc.Ptyp_object

Example OCaml

Ptyp_object([ l1:T1; ...; ln:Tn ], flag) represents:

  • < l1:T1; ...; ln:Tn > when flag is Closed,
  • < l1:T1; ...; ln:Tn; .. > when flag is Open.

ptyp_constr constructs an Ast.core_type_desc.Ptyp_constr

Example OCaml

Ptyp_constr(lident, l) represents:

  • tconstr when l=[],
  • T tconstr when l=[T],
  • (T1, ..., Tn) tconstr when l=[T1 ; ... ; Tn].

ptyp_tuple constructs an Ast.core_type_desc.Ptyp_tuple

Example OCaml

Ptyp_tuple([T1 ; ... ; Tn]) represents a product type T1 * ... * Tn.

Invariant: n >= 2.

ptyp_arrow constructs an Ast.core_type_desc.Ptyp_arrow

Example OCaml

Ptyp_arrow(lbl, T1, T2) represents:

val ptyp_var : string -> Astlib.Ast_500.Parsetree.core_type

ptyp_var constructs an Ast.core_type_desc.Ptyp_var

Example OCaml

A type variable such as 'a

ptyp_any constructs an Ast.core_type_desc.Ptyp_any

Example OCaml

_

Constructor declaration

Class type field

pctf_extension constructs an Ast.class_type_field_desc.Pctf_extension

Example OCaml

[%%id]

pctf_attribute constructs an Ast.class_type_field_desc.Pctf_attribute

Example OCaml

[@@@id]

pctf_inherit constructs an Ast.class_type_field_desc.Pctf_inherit

Example OCaml

inherit CT

Class type

pcty_extension constructs an Ast.class_type_desc.Pcty_extension

Example OCaml

%id

pcty_arrow constructs an Ast.class_type_desc.Pcty_arrow

Example OCaml

Pcty_arrow(lbl, T, CT) represents:

pcty_signature constructs an Ast.class_type_desc.Pcty_signature

Example OCaml

object ... end

pcty_constr constructs an Ast.class_type_desc.Pcty_constr

Example OCaml

  • c
  • ['a1, ..., 'an] c

Class structure

class_structure constructs an Ast.class_structure

Example OCaml

Values of type class_structure represents:

Class signature

class_signature constructs an Ast.class_signature

Example OCaml

Values of type class_signature represents:

Class field

pcf_extension constructs an Ast.class_field_desc.Pcf_extension

Example OCaml

[%%id]

pcf_attribute constructs an Ast.class_field_desc.Pcf_attribute

Example OCaml

[@@@id]

pcf_initializer constructs an Ast.class_field_desc.Pcf_initializer

Example OCaml

initializer E

pcf_constraint constructs an Ast.class_field_desc.Pcf_constraint

Example OCaml

constraint T1 = T2

pcf_method constructs an Ast.class_field_desc.Pcf_method

Example OCaml

pcf_val constructs an Ast.class_field_desc.Pcf_val

Example OCaml

Pcf_val(x,flag, kind) represents:

pcf_inherit constructs an Ast.class_field_desc.Pcf_inherit

Example OCaml

Pcf_inherit(flag, CE, s) represents:

  • inherit CE when flag is Fresh and s is None,
  • inherit CE as x when flag is Fresh and s is Some x,
  • inherit! CE when flag is Override and s is None,
  • inherit! CE as x when flag is Override and s is Some x

Class expr

pcl_extension constructs an Ast.class_expr_desc.Pcl_extension

Example OCaml

[%id]

pcl_let constructs an Ast.class_expr_desc.Pcl_let

Example OCaml

Pcl_let(rec, [(P1, E1); ... ; (Pn, En)], CE) represents:

  • let P1 = E1 and ... and Pn = EN in CE when rec is Nonrecursive,
  • let rec P1 = E1 and ... and Pn = EN in CE when rec is Recursive.

pcl_apply constructs an Ast.class_expr_desc.Pcl_apply

Example OCaml

Pcl_apply(CE, [(l1,E1) ; ... ; (ln,En)]) represents CE ~l1:E1 ... ~ln:En. li can be empty (non labeled argument) or start with ? (optional argument).

Invariant: n > 0

pcl_fun constructs an Ast.class_expr_desc.Pcl_fun

Example OCaml

Pcl_fun(lbl, exp0, P, CE) represents:

  • fun P -> CE when lbl is Nolabel and exp0 is None,
  • fun ~l:P -> CE when lbl is Labelled l and exp0 is None,
  • fun ?l:P -> CE when lbl is Optional l and exp0 is None,
  • fun ?l:(P = E0) -> CE when lbl is Optional l and exp0 is Some E0.

pcl_structure constructs an Ast.class_expr_desc.Pcl_structure

Example OCaml

object ... end

pcl_constr constructs an Ast.class_expr_desc.Pcl_constr

Example OCaml

c and ['a1, ..., 'an] c

Case

case constructs an Ast.case

Example OCaml

Values of type case represents (P -> E) or (P when E0 -> E)

Binding op

Attribute

attribute constructs an Ast.attribute

Example OCaml

Attributes such as [@id ARG] and [@@id ARG].

Metadata containers passed around within the AST. The compiler ignores unknown attributes.

'a open infos

val open_infos : + expr:'a -> + override:Astlib.Ast_500.Asttypes.override_flag -> + 'a Astlib.Ast_500.Parsetree.open_infos

open_infos constructs an Ast.'aopen_infos

Example OCaml

Values of type 'a open_infos represents:

'a include infos

val include_infos : 'a -> 'a Astlib.Ast_500.Parsetree.include_infos

include_infos constructs an Ast.'ainclude_infos

'a class infos

val value_description : name:string Astlib.Location.loc -> - type_:Astlib.Ast_500.Parsetree.core_type -> - prim:string list -> - Astlib.Ast_500.Parsetree.value_description
val estring : string -> Astlib.Ast_500.Parsetree.expression
val enativeint : nativeint -> Astlib.Ast_500.Parsetree.expression
val pstring : string -> Astlib.Ast_500.Parsetree.pattern
val pfloat : string -> Astlib.Ast_500.Parsetree.pattern
val pint32 : int32 -> Astlib.Ast_500.Parsetree.pattern
val pint64 : int64 -> Astlib.Ast_500.Parsetree.pattern
val pnativeint : nativeint -> Astlib.Ast_500.Parsetree.pattern

evar id produces a Pexp_ident _ expression, it parses its input so you can pass any dot-separated identifier, for instance: evar ~loc "Foo.bar".

val eapply : + expr:'a -> + 'a Astlib.Ast_500.Parsetree.class_infos

class_infos constructs an Ast.'aclass_infos

Example OCaml

Values of type class_expr class_infos represents:

  • class c = ...
  • class ['a1,...,'an] c = ...
  • class virtual c = ...

They are also used for "class type" declaration.

val estring : string -> Astlib.Ast_500.Parsetree.expression
val enativeint : nativeint -> Astlib.Ast_500.Parsetree.expression
val pstring : string -> Astlib.Ast_500.Parsetree.pattern
val pfloat : string -> Astlib.Ast_500.Parsetree.pattern
val pint32 : int32 -> Astlib.Ast_500.Parsetree.pattern
val pint64 : int64 -> Astlib.Ast_500.Parsetree.pattern
val pnativeint : nativeint -> Astlib.Ast_500.Parsetree.pattern

evar id produces a Pexp_ident _ expression, it parses its input so you can pass any dot-separated identifier, for instance: evar ~loc "Foo.bar".

val eabstract : diff --git a/ppxlib/Ppxlib/Attribute/Context/index.html b/ppxlib/Ppxlib/Attribute/Context/index.html index e2eb633..63798e9 100644 --- a/ppxlib/Ppxlib/Attribute/Context/index.html +++ b/ppxlib/Ppxlib/Attribute/Context/index.html @@ -1,9 +1,12 @@ -Context (ppxlib.Ppxlib.Attribute.Context)

Module Attribute.Context

type 'a t =
  1. | Label_declaration : Astlib.Ast_500.Parsetree.label_declaration t
  2. | Constructor_declaration : Astlib.Ast_500.Parsetree.constructor_declaration t
  3. | Type_declaration : Astlib.Ast_500.Parsetree.type_declaration t
  4. | Type_exception : Astlib.Ast_500.Parsetree.type_exception t
  5. | Type_extension : Astlib.Ast_500.Parsetree.type_extension t
  6. | Extension_constructor : Astlib.Ast_500.Parsetree.extension_constructor t
  7. | Pattern : Astlib.Ast_500.Parsetree.pattern t
  8. | Core_type : Astlib.Ast_500.Parsetree.core_type t
  9. | Expression : Astlib.Ast_500.Parsetree.expression t
  10. | Value_description : Astlib.Ast_500.Parsetree.value_description t
  11. | Class_type : Astlib.Ast_500.Parsetree.class_type t
  12. | Class_type_field : Astlib.Ast_500.Parsetree.class_type_field t
  13. | Class_infos : _ Astlib.Ast_500.Parsetree.class_infos t
  14. | Class_expr : Astlib.Ast_500.Parsetree.class_expr t
  15. | Class_field : Astlib.Ast_500.Parsetree.class_field t
  16. | Module_type : Astlib.Ast_500.Parsetree.module_type t
  17. | Module_declaration : Astlib.Ast_500.Parsetree.module_declaration t
  18. | Module_type_declaration : Astlib.Ast_500.Parsetree.module_type_declaration t
  19. | Module_substitution : Astlib.Ast_500.Parsetree.module_substitution t
  20. | Open_description : Astlib.Longident.t Astlib.Location.loc +Context (ppxlib.Ppxlib.Attribute.Context)

    Module Attribute.Context

    type 'a t =
    1. | Label_declaration : Astlib.Ast_500.Parsetree.label_declaration t
    2. | Constructor_declaration : Astlib.Ast_500.Parsetree.constructor_declaration t
    3. | Type_declaration : Astlib.Ast_500.Parsetree.type_declaration t
    4. | Type_exception : Astlib.Ast_500.Parsetree.type_exception t
    5. | Type_extension : Astlib.Ast_500.Parsetree.type_extension t
    6. | Extension_constructor : Astlib.Ast_500.Parsetree.extension_constructor t
    7. | Pattern : Astlib.Ast_500.Parsetree.pattern t
    8. | Core_type : Astlib.Ast_500.Parsetree.core_type t
    9. | Expression : Astlib.Ast_500.Parsetree.expression t
    10. | Value_description : Astlib.Ast_500.Parsetree.value_description t
    11. | Class_type : Astlib.Ast_500.Parsetree.class_type t
    12. | Class_type_field : Astlib.Ast_500.Parsetree.class_type_field t
    13. | Class_infos : _ Astlib.Ast_500.Parsetree.class_infos t
    14. | Class_expr : Astlib.Ast_500.Parsetree.class_expr t
    15. | Class_field : Astlib.Ast_500.Parsetree.class_field t
    16. | Class_type_decl : Astlib.Ast_500.Parsetree.class_type + Astlib.Ast_500.Parsetree.class_infos + t
    17. | Module_type : Astlib.Ast_500.Parsetree.module_type t
    18. | Module_declaration : Astlib.Ast_500.Parsetree.module_declaration t
    19. | Module_type_declaration : Astlib.Ast_500.Parsetree.module_type_declaration t
    20. | Module_substitution : Astlib.Ast_500.Parsetree.module_substitution t
    21. | Open_description : Astlib.Longident.t Astlib.Location.loc Astlib.Ast_500.Parsetree.open_infos t
    22. | Open_declaration : Astlib.Ast_500.Parsetree.module_expr Astlib.Ast_500.Parsetree.open_infos t
    23. | Include_infos : _ Astlib.Ast_500.Parsetree.include_infos t
    24. | Module_expr : Astlib.Ast_500.Parsetree.module_expr t
    25. | Value_binding : Astlib.Ast_500.Parsetree.value_binding t
    26. | Module_binding : Astlib.Ast_500.Parsetree.module_binding t
    27. | Pstr_eval : Astlib.Ast_500.Parsetree.structure_item t
    28. | Pstr_extension : Astlib.Ast_500.Parsetree.structure_item t
    29. | Psig_extension : Astlib.Ast_500.Parsetree.signature_item t
    30. | Rtag : Astlib.Ast_500.Parsetree.row_field t
    31. | Object_type_field : Astlib.Ast_500.Parsetree.object_field t
    val constructor_declaration : - Astlib.Ast_500.Parsetree.constructor_declaration t
    val module_type_declaration : + Astlib.Ast_500.Parsetree.constructor_declaration t
    \ No newline at end of file diff --git a/ppxlib/Ppxlib/Context_free/Rule/index.html b/ppxlib/Ppxlib/Context_free/Rule/index.html index 0250431..09ead63 100644 --- a/ppxlib/Ppxlib/Context_free/Rule/index.html +++ b/ppxlib/Ppxlib/Context_free/Rule/index.html @@ -85,4 +85,20 @@ (Astlib.Ast_500.Parsetree.signature_item, Astlib.Ast_500.Parsetree.type_exception, _) - attr_inline
\ No newline at end of file + attr_inline
\ No newline at end of file diff --git a/ppxlib/Ppxlib/Deriving/index.html b/ppxlib/Ppxlib/Deriving/index.html index dda4859..7c2154f 100644 --- a/ppxlib/Ppxlib/Deriving/index.html +++ b/ppxlib/Ppxlib/Deriving/index.html @@ -5,6 +5,11 @@ Astlib.Ast_500.Asttypes.rec_flag * Astlib.Ast_500.Parsetree.type_declaration list)
Generator.t -> + ?str_class_type_decl: + (Astlib.Ast_500.Parsetree.structure_item list, + Astlib.Ast_500.Parsetree.class_type Astlib.Ast_500.Parsetree.class_infos + list) + Generator.t -> ?str_type_ext: (Astlib.Ast_500.Parsetree.structure_item list, Astlib.Ast_500.Parsetree.type_extension) @@ -22,6 +27,11 @@ Astlib.Ast_500.Asttypes.rec_flag * Astlib.Ast_500.Parsetree.type_declaration list) Generator.t -> + ?sig_class_type_decl: + (Astlib.Ast_500.Parsetree.signature_item list, + Astlib.Ast_500.Parsetree.class_type Astlib.Ast_500.Parsetree.class_infos + list) + Generator.t -> ?sig_type_ext: (Astlib.Ast_500.Parsetree.signature_item list, Astlib.Ast_500.Parsetree.type_extension) @@ -43,10 +53,12 @@ t

Register a new deriving generator.

The various arguments are for the various items on which derivers can be attached in structure and signatures.

We distinguish exception from type_extension as exception E is not exactly the same as type exn += E. Indeed if the type exn is redefined, then type exn += E will add E to the new exn type while exception E will add E to the predefined exn type.

extension register an expander for extension with the name of the deriver. This is here mostly to support the ppx_deriving backend.

val add_alias : string -> ?str_type_decl:t list -> + ?str_class_type_decl:t list -> ?str_type_ext:t list -> ?str_exception:t list -> ?str_module_type_decl:t list -> ?sig_type_decl:t list -> + ?sig_class_type_decl:t list -> ?sig_type_ext:t list -> ?sig_exception:t list -> ?sig_module_type_decl:t list -> diff --git a/ppxlib/Ppxlib/Pp_ast/Config/index.html b/ppxlib/Ppxlib/Pp_ast/Config/index.html new file mode 100644 index 0000000..a7a60df --- /dev/null +++ b/ppxlib/Ppxlib/Pp_ast/Config/index.html @@ -0,0 +1,7 @@ + +Config (ppxlib.Ppxlib.Pp_ast.Config)

Module Pp_ast.Config

type t

Type for AST pretty-printing config

val make : + ?show_attrs:bool -> + ?show_locs:bool -> + ?loc_mode:[ `Short | `Full ] -> + unit -> + t

Create a custom pretty-printing config. Default values are the ones that are used when no configuration is passed to the pretty-printers defined in Pp_ast.

  • parameter ?show_attrs

    controls whether attributes are shown or hidden. Defaults to false.

  • parameter ?show_loc

    controls whether locations are shown or hidden. Defaults to false.

  • parameter ?loc_mode

    controls how locations are shown if they are shown at all. Defaults to `Short.

    • When set to `Short, locations are displayed as "l1c6..l2c2" for multiline locations and as "l1c6..12" for single line locations. Ghost locations are suffixed with a "(g)".
    • When set to `Full, locations are displayed as any other record would be.
\ No newline at end of file diff --git a/ppxlib/Ppxlib/Pp_ast/Default/index.html b/ppxlib/Ppxlib/Pp_ast/Default/index.html new file mode 100644 index 0000000..41a1f82 --- /dev/null +++ b/ppxlib/Ppxlib/Pp_ast/Default/index.html @@ -0,0 +1,2 @@ + +Default (ppxlib.Ppxlib.Pp_ast.Default)

Module Pp_ast.Default

\ No newline at end of file diff --git a/ppxlib/Ppxlib/Pp_ast/Make/argument-1-Conf/index.html b/ppxlib/Ppxlib/Pp_ast/Make/argument-1-Conf/index.html new file mode 100644 index 0000000..333f2fa --- /dev/null +++ b/ppxlib/Ppxlib/Pp_ast/Make/argument-1-Conf/index.html @@ -0,0 +1,2 @@ + +Conf (ppxlib.Ppxlib.Pp_ast.Make.Conf)

Parameter Make.Conf

val config : Config.t
\ No newline at end of file diff --git a/ppxlib/Ppxlib/Pp_ast/Make/index.html b/ppxlib/Ppxlib/Pp_ast/Make/index.html new file mode 100644 index 0000000..9ed35ca --- /dev/null +++ b/ppxlib/Ppxlib/Pp_ast/Make/index.html @@ -0,0 +1,2 @@ + +Make (ppxlib.Ppxlib.Pp_ast.Make)

Module Pp_ast.Make

\ No newline at end of file diff --git a/ppxlib/Ppxlib/Pp_ast/index.html b/ppxlib/Ppxlib/Pp_ast/index.html new file mode 100644 index 0000000..e6ec3ee --- /dev/null +++ b/ppxlib/Ppxlib/Pp_ast/index.html @@ -0,0 +1,7 @@ + +Pp_ast (ppxlib.Ppxlib.Pp_ast)

Module Ppxlib.Pp_ast

This module implements pretty printers for the OCaml AST's version used by ppxlib.

Those pretty printers show the AST as its OCaml representation and do not pretty print the corresponding source code. For printing ASTs as source code use the Ppxlib.Pprintast module instead.

For example, calling Pp_ast.expression Format.std_formatter [%expr x + 2] will print:

   Pexp_apply
+     ( Pexp_ident (Lident "+")
+     , [ ( Nolabel, Pexp_ident (Lident "x"))
+       ; ( Nolabel, Pexp_constant (Pconst_integer ( "2", None)))
+       ]
+     )

To keep the output easily readable, records with _desc fields such as Ppxlib.Ast.expression or Ppxlib.Ast.pattern are not printed as such and only the value of the corresponding _desc field is printed instead. This prevents AST nodes metadata, such as locations or attributes, from polluting the output, keeping it relatively concise and clean. The same goes for Location.loc values which are printed as the value of their txt field.

Location.t and Ppxlib.Ast.attributes are not displayed by default even outside of the records mentioned above.

The Config module below allows to override part or all of this behaviour. When configured to display locations or attributes, the entire record will be displayed, not only its _desc field.

module Config : sig ... end
type 'a pp = Stdlib.Format.formatter -> 'a -> unit
type 'a configurable = ?config:Config.t -> 'a pp
type 'a configured = 'a pp
module type S = sig ... end
module type Conf = sig ... end
module type Configured = S with type 'a printer = 'a configured
module type Configurable = S with type 'a printer = 'a configurable
module Make (Conf : Conf) : Configured
val make : Config.t -> (module Configured)
\ No newline at end of file diff --git a/ppxlib/Ppxlib/Pp_ast/module-type-Conf/index.html b/ppxlib/Ppxlib/Pp_ast/module-type-Conf/index.html new file mode 100644 index 0000000..e84ef0d --- /dev/null +++ b/ppxlib/Ppxlib/Pp_ast/module-type-Conf/index.html @@ -0,0 +1,2 @@ + +Conf (ppxlib.Ppxlib.Pp_ast.Conf)

Module type Pp_ast.Conf

val config : Config.t
\ No newline at end of file diff --git a/ppxlib/Ppxlib/Pp_ast/module-type-Configurable/index.html b/ppxlib/Ppxlib/Pp_ast/module-type-Configurable/index.html new file mode 100644 index 0000000..f43aebe --- /dev/null +++ b/ppxlib/Ppxlib/Pp_ast/module-type-Configurable/index.html @@ -0,0 +1,2 @@ + +Configurable (ppxlib.Ppxlib.Pp_ast.Configurable)

Module type Pp_ast.Configurable

\ No newline at end of file diff --git a/ppxlib/Ppxlib/Pp_ast/module-type-Configured/index.html b/ppxlib/Ppxlib/Pp_ast/module-type-Configured/index.html new file mode 100644 index 0000000..0d16795 --- /dev/null +++ b/ppxlib/Ppxlib/Pp_ast/module-type-Configured/index.html @@ -0,0 +1,2 @@ + +Configured (ppxlib.Ppxlib.Pp_ast.Configured)

Module type Pp_ast.Configured

\ No newline at end of file diff --git a/ppxlib/Ppxlib/Pp_ast/module-type-S/index.html b/ppxlib/Ppxlib/Pp_ast/module-type-S/index.html new file mode 100644 index 0000000..86254ae --- /dev/null +++ b/ppxlib/Ppxlib/Pp_ast/module-type-S/index.html @@ -0,0 +1,2 @@ + +S (ppxlib.Ppxlib.Pp_ast.S)

Module type Pp_ast.S

\ No newline at end of file diff --git a/ppxlib/Ppxlib/index.html b/ppxlib/Ppxlib/index.html index 5b24506..5f4c0e5 100644 --- a/ppxlib/Ppxlib/index.html +++ b/ppxlib/Ppxlib/index.html @@ -1,5 +1,5 @@ -Ppxlib (ppxlib.Ppxlib)

Module Ppxlib

Standard library for ppx rewriters

ppxlib is meant to be opened globally in your PPX source files.

Opening it comes with two advantages. First, it will shadow the compiler-libs modules. The compiler-libs modules are unstable and aren't meant to be used, so shadowing them is a good protection mechanism. In case you don't want to open Ppxlib, you can open Ocaml_shadow to get the same protection. Second, it will bring several modules in scope, that are useful to have when writing a rewriter:

  • The main ppxlib modules, such as modules to help manipulate the AST (Ast_builder, Ast_pattern), and a few functions.
  • Modules from other libraries, such as Ast_helper or Pprintast,
  • The whole AST types (by including the Ast module).

The core ppxlib entries

Manipulating the AST

module Ast_builder : sig ... end

Ast_builder is a module to generate OCaml AST fragments. It provides a shorter syntax than directly using the Parsetree constructors, as well as a better stability than the constructors.

module Ast_pattern : sig ... end

This module implements first class AST patterns. It allows to destruct and extract values from AST fragments. This gives the same functionality as a pattern-match, but with simpler syntax and more stability than directly pattern-matching on the Parsetree constructors.

module Ast_traverse : sig ... end

This module provides AST traversal classes, such as maps, iterations, folds, etc. on the Parsetree types.

Context-free rewriting

module Context_free : sig ... end

Context free rewriting, to define local rewriting rules that will all be applied at once by the driver.

module Deriving : sig ... end

Deriving code from type declarations.

module Extension : sig ... end

Declare extenders to rewrite extension nodes.

module Expansion_context : sig ... end

The context given to rewriting rules when expanding.

module Code_path : sig ... end

This module contains type and functions for representing and manipulating path to AST nodes.

Other helpers

module Expansion_helpers : sig ... end

Various helpers for expansion, such as quoting expressions in their context, or mangling names.

module Merlin_helpers : sig ... end

Some helpers to annotate the AST so merlin can decide which branches to look at and which branches to ignore.

module Spellcheck : sig ... end

Helpers to provide hints to PPX users for typos or spellchecks.

module Keyword : sig ... end

Small module to check if a string is an OCaml keyword.

module Driver : sig ... end

Interaction with the driver, such as getting/seeting cookies, adding arguments.

module Caller_id : sig ... end

Small helper to find out who is the caller of a function

module Ast_io : sig ... end

A small module to help read bin-annots generated files.

Checks

module Attribute : sig ... end

This module provides hygiene for attributes. The goal is to report misuses of attributes to the user as soon as possible so that no mistyped attribute get silently ignored.

module Reserved_namespaces : sig ... end

Small module to reserve namespaces in attribute names.

Common helper functions

val lident : string -> Longident.t
val core_type_of_type_declaration : +Ppxlib (ppxlib.Ppxlib)

Module Ppxlib

Standard library for ppx rewriters

ppxlib is meant to be opened globally in your PPX source files.

Opening it comes with two advantages. First, it will shadow the compiler-libs modules. The compiler-libs modules are unstable and aren't meant to be used, so shadowing them is a good protection mechanism. In case you don't want to open Ppxlib, you can open Ocaml_shadow to get the same protection. Second, it will bring several modules in scope, that are useful to have when writing a rewriter:

  • The main ppxlib modules, such as modules to help manipulate the AST (Ast_builder, Ast_pattern), and a few functions.
  • Modules from other libraries, such as Ast_helper or Pprintast,
  • The whole AST types (by including the Ast module).

The core ppxlib entries

Manipulating the AST

module Ast_builder : sig ... end

Ast_builder is a module to generate OCaml AST fragments. It provides a shorter syntax than directly using the Parsetree constructors, as well as a better stability than the constructors.

module Ast_pattern : sig ... end

This module implements first class AST patterns. It allows to destruct and extract values from AST fragments. This gives the same functionality as a pattern-match, but with simpler syntax and more stability than directly pattern-matching on the Parsetree constructors.

module Ast_traverse : sig ... end

This module provides AST traversal classes, such as maps, iterations, folds, etc. on the Parsetree types.

Context-free rewriting

module Context_free : sig ... end

Context free rewriting, to define local rewriting rules that will all be applied at once by the driver.

module Deriving : sig ... end

Deriving code from type declarations.

module Extension : sig ... end

Declare extenders to rewrite extension nodes.

module Expansion_context : sig ... end

The context given to rewriting rules when expanding.

module Code_path : sig ... end

This module contains type and functions for representing and manipulating path to AST nodes.

Other helpers

module Expansion_helpers : sig ... end

Various helpers for expansion, such as quoting expressions in their context, or mangling names.

module Merlin_helpers : sig ... end

Some helpers to annotate the AST so merlin can decide which branches to look at and which branches to ignore.

module Spellcheck : sig ... end

Helpers to provide hints to PPX users for typos or spellchecks.

module Keyword : sig ... end

Small module to check if a string is an OCaml keyword.

module Pp_ast : sig ... end

This module implements pretty printers for the OCaml AST's version used by ppxlib.

module Driver : sig ... end

Interaction with the driver, such as getting/seeting cookies, adding arguments.

module Caller_id : sig ... end

Small helper to find out who is the caller of a function

module Ast_io : sig ... end

A small module to help read bin-annots generated files.

Checks

module Attribute : sig ... end

This module provides hygiene for attributes. The goal is to report misuses of attributes to the user as soon as possible so that no mistyped attribute get silently ignored.

module Reserved_namespaces : sig ... end

Small module to reserve namespaces in attribute names.

Common helper functions

val lident : string -> Longident.t
val name_type_params_in_td_res : Astlib.Ast_500.Parsetree.type_declaration -> diff --git a/ppxlib/Ppxlib__Pp_ast/index.html b/ppxlib/Ppxlib__Pp_ast/index.html new file mode 100644 index 0000000..c0d935b --- /dev/null +++ b/ppxlib/Ppxlib__Pp_ast/index.html @@ -0,0 +1,2 @@ + +Ppxlib__Pp_ast (ppxlib.Ppxlib__Pp_ast)

Module Ppxlib__Pp_ast

\ No newline at end of file diff --git a/ppxlib/Ppxlib_traverse/Backends/class-reconstructors/index.html b/ppxlib/Ppxlib_traverse/Backends/class-reconstructors/index.html index 9a89274..3cc46bc 100644 --- a/ppxlib/Ppxlib_traverse/Backends/class-reconstructors/index.html +++ b/ppxlib/Ppxlib_traverse/Backends/class-reconstructors/index.html @@ -1,12 +1,13 @@ reconstructors (ppxlib.Ppxlib_traverse.Backends.reconstructors)

Class Backends.reconstructors

method record : reconstructors -> - loc:Ppxlib__.Import.location -> - (Ppxlib__.Import.longident_loc * Ppxlib__.Import.expression) list -> + loc:Ppxlib__.Location.t -> + (Ppxlib__.Import.longident Ppxlib__.Import.loc * Ppxlib__.Import.expression) + list -> Ppxlib__.Import.expression
method construct : 'a -> - loc:Ppxlib__.Import.location -> - Ppxlib__.Import.longident_loc -> + loc:Ppxlib__.Location.t -> + Ppxlib__.Import.longident Ppxlib__.Import.loc -> Ppxlib__.Import.expression list -> Ppxlib__.Import.expression
method tuple : 'a -> - loc:Ppxlib__.Import.location -> + loc:Ppxlib__.Location.t -> Ppxlib__.Import.expression list -> Ppxlib__.Import.expression
\ No newline at end of file diff --git a/ppxlib/Ppxlib_traverse/index.html b/ppxlib/Ppxlib_traverse/index.html index 8c477b4..16ada9a 100644 --- a/ppxlib/Ppxlib_traverse/index.html +++ b/ppxlib/Ppxlib_traverse/index.html @@ -10,7 +10,7 @@ string Ppxlib.loc list -> Astlib.Ast_500.Parsetree.core_type list
val methods_of_class_exn : Ppxlib.structure_item -> Ppxlib.class_field list
module Backends : sig ... end
type what = Backends.what
val constrained_mapper : @@ -27,13 +27,13 @@ Ppxlib.core_type list -> (string Ppxlib.loc * Ppxlib.expression) list
val gen_record : what:what -> - loc:Astlib.Location.t -> + loc:Ppxlib.Location.t -> Ppxlib.label_declaration list -> Ppxlib.expression
val is_constant_constructor : Ppxlib.constructor_declaration -> bool
val erase_type_variables : Ppxlib.Ast_traverse.map
val gen_variant : what:what -> diff --git a/ppxlib/_doc-dir/CHANGES.md b/ppxlib/_doc-dir/CHANGES.md index 41933b9..a87c3f4 100644 --- a/ppxlib/_doc-dir/CHANGES.md +++ b/ppxlib/_doc-dir/CHANGES.md @@ -1,3 +1,42 @@ +0.34.0 (2025-01-06) +------------------- + +### 5.3 support + +5.3 support is being added gradually over the course of its development. +This section should be updated with each relevant PR. + +Note to maintainers: until 5.3 support is officially released, this section +should be excluded from the release, see [RELEASING.md](RELEASING.md) for +details. + +- Add initial OCaml 5.3 support (#487, @NathanReb, @hhugo, @nojb) + +- Initialise OCaml 5.3's lexer with the `keywords` setting from `OCAMLPARAM` or + the new `-keywords` driver's CLI option to allow the standalone ppx driver to + process old packages using `effect` as an identifier + (#535, @dra27, @NathanReb) + +### Other changes + +- Add `Pprintast.binding`, `longident` and `payload` (#542, @mattiasdrp) + +- Fix `deriving_inline` round-trip check so that it works with 5.01 <-> 5.02 + migrations (#519, @NathanReb) + +- Add ppxlib's AST pretty-printing utilities in `Ppxlib.Pp_ast` and + a `ppxlib-pp-ast` executable in a new separate `ppxlib-tools` package + (#517, #525, #537, @NathanReb) + +- Change `-dparsetree` from a sexp output to a pretty printed AST, closer + to what the compiler's `-dparsetree` is. + (#530, @NathanReb) + +- Add Parsetree documentation comments to `Ast_builder` functions (#518, @patricoferris) + +- Support class type declarations in derivers with the new, optional arguments + `{str,sig}_class_type_decl` in `Deriving.add` (#538, @patricoferris) + 0.33.0 (2024-07-22) ------------------- diff --git a/ppxlib/_doc-dir/odoc-pages/writing-ppxs.mld b/ppxlib/_doc-dir/odoc-pages/writing-ppxs.mld index c8dba83..ff67a65 100644 --- a/ppxlib/_doc-dir/odoc-pages/writing-ppxs.mld +++ b/ppxlib/_doc-dir/odoc-pages/writing-ppxs.mld @@ -448,8 +448,6 @@ Global transformations are the most general kind of transformation. As such, the factorised, resulting in slower compilation time. - If you don't make sure that you really follow all {{!"good-practices"}good practices}, you might end up messing up the global developer experience. -- If you don't make sure that you really follow all {{!"good-practices"}good practices}, you might end up messing up the global developer experience. - For all these reasons, a global transformation should be avoided whenever a context-free transformation could do the job, which by experience seems to be most of the time. The API for defining a global transformation is easy. A global transformation consists simply of the function and can be directly be registered with {{!Ppxlib.Driver.register_transformation}[Driver.register_transformation]}. diff --git a/ppxlib/writing-ppxs.html b/ppxlib/writing-ppxs.html index 436834f..6960ccf 100644 --- a/ppxlib/writing-ppxs.html +++ b/ppxlib/writing-ppxs.html @@ -57,7 +57,7 @@ val rule : Context_free.Rule.t = <abstr> # Driver.register_transformation ~rules:[ rule ] "special_function_demo" ;; - : unit = ()

With such a rewriter registered:

# Printf.printf "n_args is applied with %d arguments\n" (n_args ignored "arguments");;
 n_args is applied with 2 arguments
-- : unit = ()

Global transformation

Global transformations are the most general kind of transformation. As such, they allow doing virtually any modifications, but this comes with several drawbacks. There are very few PPXs that really need this powerful but dangerous feature. In fact, even if, at first sight, it seems like your transformation isn't context-free, it's likely that you can find a more suitable abstraction with which it becomes context-free. Whenever that's the case, go for context-free! The mentioned drawbacks are:

  • It is harder for the user to know exactly what parts of the AST will be changed. Your transformation becomes a scary black box.
  • It is harder for ppxlib to combine several global transformations, as there is no guarantee that the effect of one will work well with the effect of another.
  • The job done by two global transformations (e.g., an AST traverse) cannot be factorised, resulting in slower compilation time.
  • If you don't make sure that you really follow all good practices, you might end up messing up the global developer experience.
  • If you don't make sure that you really follow all good practices, you might end up messing up the global developer experience.

For all these reasons, a global transformation should be avoided whenever a context-free transformation could do the job, which by experience seems to be most of the time. The API for defining a global transformation is easy. A global transformation consists simply of the function and can be directly be registered with Driver.register_transformation.

# let f str = List.filter (fun _ -> Random.bool ()) str;; (* Randomly omit structure items *)
+- : unit = ()

Global transformation

Global transformations are the most general kind of transformation. As such, they allow doing virtually any modifications, but this comes with several drawbacks. There are very few PPXs that really need this powerful but dangerous feature. In fact, even if, at first sight, it seems like your transformation isn't context-free, it's likely that you can find a more suitable abstraction with which it becomes context-free. Whenever that's the case, go for context-free! The mentioned drawbacks are:

  • It is harder for the user to know exactly what parts of the AST will be changed. Your transformation becomes a scary black box.
  • It is harder for ppxlib to combine several global transformations, as there is no guarantee that the effect of one will work well with the effect of another.
  • The job done by two global transformations (e.g., an AST traverse) cannot be factorised, resulting in slower compilation time.
  • If you don't make sure that you really follow all good practices, you might end up messing up the global developer experience.

For all these reasons, a global transformation should be avoided whenever a context-free transformation could do the job, which by experience seems to be most of the time. The API for defining a global transformation is easy. A global transformation consists simply of the function and can be directly be registered with Driver.register_transformation.

# let f str = List.filter (fun _ -> Random.bool ()) str;; (* Randomly omit structure items *)
 val f : 'a list -> 'a list = <fun>
 # Driver.register_transformation ~impl:f "absent_minded_transformation"
 - : unit = ()

Inlining Transformations

When using a PPX, the transformation happens at compile time, and the produced code could be directly inlined into the original code. This allows dropping the dependency on ppxlib and the PPX used to generate the code.

This mechanism is implemented for derivers implemented in ppxlib and is convenient to use, especially in conjunction with Dune. When applying a deriver, using [@@deriving_inline deriver_name] will apply the inline mode of deriver_name instead of the normal mode.

Inline derivers will generate a .corrected version of the file that Dune can use to promote your file. For more information on how to use this feature to remove a dependency on ppxlib and a specific PPX from your project, refer to this guide.

Integration with Dune

If your PPX is written as a Dune project, you'll need to specify the kind field in your dune file with one of the following two values:

  • ppx_rewriter, or
  • ppx_deriver.

If your transformation is anything but a deriver (e.g. an extension node rewriter), use ppx_rewriter. If your transformation is a deriver, then the TLDR workflow is: use ppx_deriver and furthermore add ppx_deriving to your dependencies, i.e. to the libraries field of your dune file. In fact, the situation is quite a bit more complex, though: apart from applying the registered transformations, the Ppxlib driver also does several checks. One of those consists in checking the following: whenever the source code contains [@@deriving foo (...)], then the Ppxlib driver expects a driver named foo to be registered. That's helpful to catch typos and missing dependencies on derivers and is certainly more hygienic than silently ignoring the annotation. However, for that check to work, the registered derivers must be grouped together into one process, i.e. a driver. UTop cannot use a static driver such as the Ppxlib one because dependencies are added dynamically to a UTop session. So the solution is the following: if you use ppx_deriver in your kind field, dune will add the right data to your PPXs META file to ensure that UTop will use the ppx_deriving driver, which links the derivers dynamically. As a result, ppx_derivng appears as a dependency in the META file. Therefore, whenever a user uses ocamlfind (e.g. by using UTop), they will hit an "ppx_derivng not found" error, unless you define ppx_deriving in your dependencies. So, long story short: if you strongly care about avoiding ppx_deriving as a dependency, use ppx_rewriter in your kind field and be aware of the fact that users won't be able to try your deriver in UTop; otherwise do the TLDR workflow.

Here is a minimal Dune stanza for a rewriter:

(library
diff --git a/trace-fuchsia/_doc-dir/CHANGES.md b/trace-fuchsia/_doc-dir/CHANGES.md
index 2721a13..a563d37 100644
--- a/trace-fuchsia/_doc-dir/CHANGES.md
+++ b/trace-fuchsia/_doc-dir/CHANGES.md
@@ -1,3 +1,7 @@
+# 0.9
+
+- add an extensible sum type, so users can implement custom events. For example
+    an OTEL collector can provide custom events to link two spans to one another.
 
 # 0.8
 
diff --git a/trace-tef/_doc-dir/CHANGES.md b/trace-tef/_doc-dir/CHANGES.md
index 2721a13..a563d37 100644
--- a/trace-tef/_doc-dir/CHANGES.md
+++ b/trace-tef/_doc-dir/CHANGES.md
@@ -1,3 +1,7 @@
+# 0.9
+
+- add an extensible sum type, so users can implement custom events. For example
+    an OTEL collector can provide custom events to link two spans to one another.
 
 # 0.8
 
diff --git a/trace/Trace/index.html b/trace/Trace/index.html
index 5967f63..036b742 100644
--- a/trace/Trace/index.html
+++ b/trace/Trace/index.html
@@ -54,4 +54,4 @@
   ?data:(unit -> (string * user_data) list) ->
   string ->
   float ->
-  unit

Emit a counter of type float. See counter_int for more details.

  • parameter level

    optional level for this span. since 0.7. Default is set via set_default_level.

  • parameter data

    metadata for this metric (since 0.4)

Collector

type collector = (module Collector.S)

An event collector.

See Collector for more details.

val setup_collector : collector -> unit

setup_collector c installs c as the current collector.

  • raises Invalid_argument

    if there already is an established collector.

val get_current_level : unit -> Level.t

Get current level. This is only meaningful if a collector was set up with setup_collector.

  • since 0.7
val set_current_level : Level.t -> unit

Set the current level of tracing. This only has a visible effect if a collector was installed with setup_collector.

  • since 0.7
val shutdown : unit -> unit

shutdown () shutdowns the current collector, if one was installed, and waits for it to terminate before returning.

Extensions

type extension_event = ..

Extension event

  • since NEXT_RELEASE
val extension_event : extension_event -> unit

Trigger an extension event, whose meaning depends on the library that defines it. Some collectors will simply ignore it. This does nothing if no collector is setup.

  • since NEXT_RELEASE
\ No newline at end of file + unit

Emit a counter of type float. See counter_int for more details.

  • parameter level

    optional level for this span. since 0.7. Default is set via set_default_level.

  • parameter data

    metadata for this metric (since 0.4)

Collector

type collector = (module Collector.S)

An event collector.

See Collector for more details.

val setup_collector : collector -> unit

setup_collector c installs c as the current collector.

  • raises Invalid_argument

    if there already is an established collector.

val get_current_level : unit -> Level.t

Get current level. This is only meaningful if a collector was set up with setup_collector.

  • since 0.7
val set_current_level : Level.t -> unit

Set the current level of tracing. This only has a visible effect if a collector was installed with setup_collector.

  • since 0.7
val shutdown : unit -> unit

shutdown () shutdowns the current collector, if one was installed, and waits for it to terminate before returning.

Extensions

type extension_event = ..

Extension event

  • since 0.8
val extension_event : extension_event -> unit

Trigger an extension event, whose meaning depends on the library that defines it. Some collectors will simply ignore it. This does nothing if no collector is setup.

  • since 0.8
\ No newline at end of file diff --git a/trace/Trace_core/Collector/module-type-S/index.html b/trace/Trace_core/Collector/module-type-S/index.html index fe0c26c..22e28d5 100644 --- a/trace/Trace_core/Collector/module-type-S/index.html +++ b/trace/Trace_core/Collector/module-type-S/index.html @@ -92,4 +92,4 @@ list -> string -> float -> - unit

Float counter.

val extension_event : Trace_core__.Types.extension_event -> unit

Handle an extension event. A collector MUST simple ignore events it doesn't know, and return () silently.

  • since NEXT_RELEASE
val shutdown : unit -> unit

Shutdown collector, possibly waiting for it to finish sending data.

\ No newline at end of file + unit

Float counter.

val extension_event : Trace_core__.Types.extension_event -> unit

Handle an extension event. A collector MUST simple ignore events it doesn't know, and return () silently.

  • since 0.8
val shutdown : unit -> unit

Shutdown collector, possibly waiting for it to finish sending data.

\ No newline at end of file diff --git a/trace/Trace_core/index.html b/trace/Trace_core/index.html index ba41ffa..1ba36f3 100644 --- a/trace/Trace_core/index.html +++ b/trace/Trace_core/index.html @@ -54,4 +54,4 @@ ?data:(unit -> (string * user_data) list) -> string -> float -> - unit

Emit a counter of type float. See counter_int for more details.

  • parameter level

    optional level for this span. since 0.7. Default is set via set_default_level.

  • parameter data

    metadata for this metric (since 0.4)

Collector

type collector = (module Collector.S)

An event collector.

See Collector for more details.

val setup_collector : collector -> unit

setup_collector c installs c as the current collector.

  • raises Invalid_argument

    if there already is an established collector.

val get_current_level : unit -> Level.t

Get current level. This is only meaningful if a collector was set up with setup_collector.

  • since 0.7
val set_current_level : Level.t -> unit

Set the current level of tracing. This only has a visible effect if a collector was installed with setup_collector.

  • since 0.7
val shutdown : unit -> unit

shutdown () shutdowns the current collector, if one was installed, and waits for it to terminate before returning.

Extensions

type extension_event = ..

Extension event

  • since NEXT_RELEASE
val extension_event : extension_event -> unit

Trigger an extension event, whose meaning depends on the library that defines it. Some collectors will simply ignore it. This does nothing if no collector is setup.

  • since NEXT_RELEASE
\ No newline at end of file + unit

Emit a counter of type float. See counter_int for more details.

Collector

type collector = (module Collector.S)

An event collector.

See Collector for more details.

val setup_collector : collector -> unit

setup_collector c installs c as the current collector.

val get_current_level : unit -> Level.t

Get current level. This is only meaningful if a collector was set up with setup_collector.

val set_current_level : Level.t -> unit

Set the current level of tracing. This only has a visible effect if a collector was installed with setup_collector.

val shutdown : unit -> unit

shutdown () shutdowns the current collector, if one was installed, and waits for it to terminate before returning.

Extensions

type extension_event = ..

Extension event

val extension_event : extension_event -> unit

Trigger an extension event, whose meaning depends on the library that defines it. Some collectors will simply ignore it. This does nothing if no collector is setup.

\ No newline at end of file diff --git a/trace/Trace_subscriber/Callbacks/module-type-S/index.html b/trace/Trace_subscriber/Callbacks/module-type-S/index.html index 9868ca6..fd1c842 100644 --- a/trace/Trace_subscriber/Callbacks/module-type-S/index.html +++ b/trace/Trace_subscriber/Callbacks/module-type-S/index.html @@ -54,4 +54,4 @@ time_ns:float -> tid:int -> Trace_core.extension_event -> - unit

Extension event

\ No newline at end of file + unit

Extension event

\ No newline at end of file diff --git a/trace/_doc-dir/CHANGES.md b/trace/_doc-dir/CHANGES.md index 2721a13..a563d37 100644 --- a/trace/_doc-dir/CHANGES.md +++ b/trace/_doc-dir/CHANGES.md @@ -1,3 +1,7 @@ +# 0.9 + +- add an extensible sum type, so users can implement custom events. For example + an OTEL collector can provide custom events to link two spans to one another. # 0.8