package ocamlformat-lib

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Abstract syntax tree terms

Initialize internal state

module Attr : sig ... end
module Ext : sig ... end
module Token : sig ... end
module Exp : sig ... end
module Pat : sig ... end
module Mod : sig ... end
module Mty : sig ... end
module Cl : sig ... end
module Cty : sig ... end
module Tyd : sig ... end
type toplevel_item = [
  1. | `Item of Extended_ast.structure_item
  2. | `Directive of Extended_ast.toplevel_directive
]
val is_top : t -> Ocamlformat_stdlib.bool
val break_between : Source.t -> cmt_checker -> (t * Conf.t) -> (t * Conf.t) -> Ocamlformat_stdlib.bool
val attributes : t -> Extended_ast.attributes
val location : t -> Migrate_ast.Location.t
val dump : Ocamlformat_stdlib.Format.formatter -> t -> Ocamlformat_stdlib.unit

Debug: Dump the representation of an Ast term.

type 'a xt = private {
  1. ctx : t;
  2. ast : 'a;
}

Term-in-context {ctx; ast} records that ast is (considered to be) an immediate sub-term of ctx.

Construct a core_type-in-context.

Construct a class_type-in-context.

Construct a pattern-in-context.

Construct a expression-in-context.

Construct a class_expr-in-context.

Construct a module_type-in-context.

Construct a module_expr-in-context.

Construct a signature_item-in-context.

Construct a structure_item-in-context.

Holds of "simple" expressions: constants and constructor and function applications of other simple expressions.

type cls =
  1. | Let_match
  2. | Match
  3. | Non_apply
  4. | Sequence
  5. | Then
  6. | ThenElse

'Classes' of expressions which are parenthesized differently.

exposed_right_exp cls exp holds if there is a right-most subexpression of exp which is of class cls and is not parenthesized.

prec_ast ast is the precedence of ast. Meaningful for binary operators, otherwise returns None.

parenze_typ xtyp holds when core_type-in-context xtyp should be parenthesized.

parenze_cty xcty holds when class_type-in-context xcty should be parenthesized.

parenze_cl xcl holds when class-in-context xcl should be parenthesized.

parenze_pat xpat holds when pattern-in-context xpat should be parenthesized.

parenze_exp xexp holds when expression-in-context xexp should be parenthesized.

parenze_nested_exp xexp holds when nested expression-in-context xexp should be parenthesized.

parenze_mty xmty holds when module_type-in-context xmty should be parenthesized.

parenze_mod xmod holds when module_expr-in-context xmod should be parenthesized.

OCaml

Innovation. Community. Security.