jon.recoil.org

Module Ocaml_parsing.Language_extension

Language extensions provided by the Jane Street version of the OCaml compiler.

type maturity = Ocaml_utils.Language_extension_kernel.maturity =
  1. | Stable
  2. | Beta
  3. | Alpha

A setting for extensions that track multiple maturity levels

module Maturity : sig ... end

The type of language extensions. An 'a t is an extension that can either be off or be set to have any value in 'a, so a unit t can be either on or off, while a maturity t can have different maturity settings.

val assert_enabled : loc:Ocaml_parsing.Location.t -> 'a Ocaml_parsing.Language_extension.t -> 'a -> unit

Require that an extension is enabled for at least the provided level, or else throw an exception at the provided location saying otherwise.

val maturity_of_unique_for_drf : Ocaml_parsing.Language_extension.maturity
val maturity_of_unique_for_destruction : Ocaml_parsing.Language_extension.maturity
module Exist : sig ... end

Existentially packed language extension

Equality on language extensions

module Universe : sig ... end

The type of language extension universes. Each universe allows a set of extensions, and every successive universe includes the previous one.

val disable_all : unit -> unit

Disable all extensions

val is_erasable : 'a Ocaml_parsing.Language_extension.t -> bool

Check if a language extension is "erasable", i.e. whether it can be harmlessly translated to attributes and compiled with the upstream compiler.

val to_string : 'a Ocaml_parsing.Language_extension.t -> string

Print and parse language extensions; parsing is case-insensitive

val to_command_line_string : 'a Ocaml_parsing.Language_extension.t -> 'a -> string
val of_string : string -> Ocaml_parsing.Language_extension.Exist.t option
val maturity_to_string : Ocaml_parsing.Language_extension.maturity -> string
val get_command_line_string_if_enabled : 'a Ocaml_parsing.Language_extension.t -> string option

Get the command line string enabling the given extension, if it's enabled; otherwise None

val enable_of_string_exn : string -> unit

Enable and disable according to command-line strings; these raise an exception if the input string is invalid.

val disable_of_string_exn : string -> unit
val set : unit Ocaml_parsing.Language_extension.t -> enabled:bool -> unit

Enable and disable language extensions; these operations are idempotent

val enable : 'a Ocaml_parsing.Language_extension.t -> 'a -> unit
val disable : 'a Ocaml_parsing.Language_extension.t -> unit
val is_enabled : 'a Ocaml_parsing.Language_extension.t -> bool

Check if a language extension is currently enabled (at any maturity level)

val is_at_least : 'a Ocaml_parsing.Language_extension.t -> 'a -> bool

Check if a language extension is enabled at least at the given level

val with_set : unit Ocaml_parsing.Language_extension.t -> enabled:bool -> (unit -> unit) -> unit

Tooling support: Temporarily enable and disable language extensions; these operations are idempotent. Calls to set, enable, disable inside the body of the function argument will also be rolled back when the function finishes, but this behavior may change; nest multiple with_* functions instead.

val with_enabled : 'a Ocaml_parsing.Language_extension.t -> 'a -> (unit -> unit) -> unit
val with_disabled : 'a Ocaml_parsing.Language_extension.t -> (unit -> unit) -> unit
val erasable_extensions_only : unit -> bool

Check if the allowable extensions are restricted to only those that are "erasable". This is true when the universe is set to No_extensions or Upstream_compatible.

val set_universe_and_enable_all : Ocaml_parsing.Language_extension.Universe.t -> unit

Set the extension universe and enable all allowed extensions.

val set_universe_and_enable_all_of_string_exn : string -> unit

Parse a command-line string and call set_universe_and_enable_all. Raises if the argument is invalid.