package ocamlformat-mlx-lib

All checked builds pass
  1. Overview
  2. Docs
OCaml .mlx Code Formatter

Install

dune-project
 Dependency

Authors

Maintainers

Sources

ocamlformat-mlx-0.29.0.2.tbz
sha256=194614629528fc6351c343c1c105e454996998a3f24a89f9e90e4b36a97d8122
sha512=04123a9b73db8bc90b7f99c7dcdbe180f18a4cba2aba2b72f6528e428e3f8939086161a5c88c3c304d2d908c9fdb625ffcf5b922c3dc515d8aa5671c86a2ecc0

doc/ocamlformat-mlx-lib.parser_extended/Ocamlformat_parser_extended/Jsx_helper/index.html

Module Ocamlformat_parser_extended.Jsx_helperSource

Sourceval make_jsx_element : raise:(exn -> unit) -> loc:'a -> tag: ([ `Module | `Value ] * (Lexing.position * Lexing.position) * Ocamlformat_ocaml_common.Longident.t) -> end_tag: (([> `Module | `Value ] * (Lexing.position * 'b) * Ocamlformat_ocaml_common.Longident.t) * ('c * Lexing.position)) option -> props: ((Lexing.position * Lexing.position) * [< `Prop of string Asttypes.loc * Parsetree.expression | `Prop_opt of string Asttypes.loc * Parsetree.expression | `Prop_opt_punned of string Asttypes.loc | `Prop_punned of string Asttypes.loc ]) list -> children:Parsetree.expression -> unit -> Parsetree.expression_desc
Sourceval make_jsx_fragment : children:Parsetree.expression -> Parsetree.expression_desc
Sourcetype jsx_children =
  1. | Children of Parsetree.expression list
  2. | Spread of Parsetree.expression

The children of a JSX element: a list of children, or a single spread child (`<Foo> ...expr </Foo>`).

Sourcetype element = {
  1. tag : string;
  2. tag_loc : Ocamlformat_ocaml_common.Location.t;
  3. unit_loc : Ocamlformat_ocaml_common.Location.t;
  4. props : (Asttypes.arg_label * Parsetree.expression) list;
  5. children_loc : Ocamlformat_ocaml_common.Location.t;
  6. children : jsx_children;
  7. loc : Ocamlformat_ocaml_common.Location.t;
    (*

    Location of the @JSX attribute, which spans the whole element.

    *)
  8. extra_attrs : Parsetree.attributes;
    (*

    Attributes other than @JSX carried by the application, printed after the element (e.g. (<Foo />) [@mel.as "and"]).

    *)
}

A @JSX application that can be printed with JSX syntax.

Sourceval classify_element : attrs:Parsetree.attribute list -> Parsetree.expression -> (Asttypes.arg_label * Parsetree.expression) list -> element option

Classify a @JSX application. JSX syntax can only express applications of the exact shape produced by make_jsx_element: an identifier tag applied to one unlabelled () argument, one ~children argument that is a list literal or any other expression (a children spread), and labelled or optional props. Hand-written @JSX applications may have any other shape (see ocaml-mlx/ocamlformat-mlx#12), in which case None is returned and the application must be printed as a regular application.