package ocamlformat-mlx-lib

  1. Overview
  2. Docs
OCaml .mlx Code Formatter

Install

dune-project
 Dependency

Authors

Maintainers

Sources

ocamlformat-mlx-0.29.0.1.tbz
sha256=c4986e5af3e816e8a1fc130e5c26b4ac13fd60efed05a84449ec014640813273
sha512=fae91c260e9d8ddf2c6c8e7f46caf87329777e40e5c80320bbf942ed849789bca477e054010a71213f6451211be9fe3926923cc1aa7f3ac22db875dfbaa59dc2

doc/ocamlformat-mlx-lib.ocaml_common/Ocamlformat_ocaml_common/Longident/index.html

Module Ocamlformat_ocaml_common.LongidentSource

Long identifiers, used in parsetree.

Warning: this module is unstable and part of compiler-libs.

To print a longident, see Pprintast.longident, using Format.asprintf to convert to a string.

Sourcetype t =
  1. | Lident of string
  2. | Ldot of t Location.loc * string Location.loc
  3. | Lapply of t Location.loc * t Location.loc
Sourceval same : t -> t -> bool

same t t' compares the longidents t and t' without taking locations into account.

Sourceval flatten : t -> string list
Sourceval unflatten : string list -> t option

For a non-empty list l, unflatten l is Some lid where lid is the long identifier created by concatenating the elements of l with Ldot. unflatten [] is None.

Sourceval last : t -> string
Sourceval parse : string -> t

This function is broken on identifiers that are not just "Word.Word.word"; for example, it returns incorrect results on infix operators and extended module paths.

If you want to generate long identifiers that are a list of dot-separated identifiers, the function unflatten is safer and faster. unflatten is available since OCaml 4.06.0.

If you want to parse any identifier correctly, use the long-identifiers functions from the Parse module, in particular Parse.longident. They are available since OCaml 4.11, and also provide proper input-location support.

  • deprecated this function may misparse its input, use "Parse.longident" or "Longident.unflatten"