package ocamlformat-lib

  1. Overview
  2. Docs
OCaml Code Formatter

Install

Dune Dependency

Authors

Maintainers

Sources

ocamlformat-0.26.2.tbz
sha256=2e4f596bf7aa367a844fe83ba0f6b0bf14b2a65179ddc082363fe9793d0375c5
sha512=b03d57462e65b11aa9f78dd5c4548251e8d1c5a1c9662f7502bdb10472aeb9df33c1d407350767a5223fbff9c01d53de85bafacd0274b49abc4b43701b159bee

doc/ocamlformat-lib.odoc_parser/Odoc_parser/index.html

Module Odoc_parserSource

Parser for ocamldoc formatted comments.

Sourcetype t

type t is the result of parsing.

Sourceval parse_comment : location:Lexing.position -> text:string -> t

parse_comment ~location ~text parses text as an ocamldoc formatted string. The parser will try to recover from any invalid syntax encountered, and therefore this will always produce a result without raising exceptions with zero or more warnings. The location passed in should represent the start of the content of the documentation comment - so for a line such as

  (** A comment starting in the first column (0) *)

the location should represent the space immediately before the A, so the in the 4th column (e.g. {... pos_bol=0; pos_cnum=3 })

Sourcemodule Ast : sig ... end

Abstract syntax tree representing ocamldoc comments

Sourcemodule Loc : sig ... end

Locations in files.

Sourcemodule Warning : sig ... end

Warnings produced during parsing.

Sourceval warnings : t -> Warning.t list

Extract any warnings from the parser result.

Sourceval ast : t -> Ast.t

Extract the Ast.t from the parser result.

Sourceval position_of_point : t -> Loc.point -> Lexing.position

Helper function to turn the internal representation of positions back into the usual representation in the Lexing module. Note that this relies on the information passed in parse_comment, and hence requires the result of that call in addition to the Loc.point being converted.

OCaml

Innovation. Community. Security.