jon.recoil.org

Module Ocaml_parsing.Docstrings

Documentation comments

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

val init : unit -> unit

(Re)Initialise all docstring state

val warn_bad_docstrings : unit -> unit

Emit warnings for unattached and ambiguous docstrings

Docstrings

type docstring

Documentation comments

Create a docstring

val register : Ocaml_parsing.Docstrings.docstring -> unit

Register a docstring

val docstring_body : Ocaml_parsing.Docstrings.docstring -> string

Get the text of a docstring

Get the location of a docstring

Set functions

These functions are used by the lexer to associate docstrings to the locations of tokens.

val set_pre_docstrings : Stdlib.Lexing.position -> Ocaml_parsing.Docstrings.docstring list -> unit

Docstrings immediately preceding a token

val set_post_docstrings : Stdlib.Lexing.position -> Ocaml_parsing.Docstrings.docstring list -> unit

Docstrings immediately following a token

val set_floating_docstrings : Stdlib.Lexing.position -> Ocaml_parsing.Docstrings.docstring list -> unit

Docstrings not immediately adjacent to a token

val set_pre_extra_docstrings : Stdlib.Lexing.position -> Ocaml_parsing.Docstrings.docstring list -> unit

Docstrings immediately following the token which precedes this one

val set_post_extra_docstrings : Stdlib.Lexing.position -> Ocaml_parsing.Docstrings.docstring list -> unit

Docstrings immediately preceding the token which follows this one

Items

The docs type represents documentation attached to an item.

type docs = {
  1. docs_pre : Ocaml_parsing.Docstrings.docstring option;
  2. docs_post : Ocaml_parsing.Docstrings.docstring option;
}

Convert item documentation to attributes and add them to an attribute list

val symbol_docs : unit -> Ocaml_parsing.Docstrings.docs

Fetch the item documentation for the current symbol. This also marks this documentation (for ambiguity warnings).

val symbol_docs_lazy : unit -> Ocaml_parsing.Docstrings.docs Stdlib.Lazy.t
val rhs_docs : int -> int -> Ocaml_parsing.Docstrings.docs

Fetch the item documentation for the symbols between two positions. This also marks this documentation (for ambiguity warnings).

val rhs_docs_lazy : int -> int -> Ocaml_parsing.Docstrings.docs Stdlib.Lazy.t
val mark_symbol_docs : unit -> unit

Mark the item documentation for the current symbol (for ambiguity warnings).

val mark_rhs_docs : int -> int -> unit

Mark as associated the item documentation for the symbols between two positions (for ambiguity warnings)

Fields and constructors

The info type represents documentation attached to a field or constructor.

Convert field info to attributes and add them to an attribute list

val symbol_info : unit -> Ocaml_parsing.Docstrings.info

Fetch the field info for the current symbol.

val rhs_info : int -> Ocaml_parsing.Docstrings.info

Fetch the field info following the symbol at a given position.

Unattached comments

The text type represents documentation which is not attached to anything.

Convert text to attributes and add them to an attribute list

val symbol_text : unit -> Ocaml_parsing.Docstrings.text

Fetch the text preceding the current symbol.

val symbol_text_lazy : unit -> Ocaml_parsing.Docstrings.text Stdlib.Lazy.t
val rhs_text : int -> Ocaml_parsing.Docstrings.text

Fetch the text preceding the symbol at the given position.

val rhs_text_lazy : int -> Ocaml_parsing.Docstrings.text Stdlib.Lazy.t

Extra text

There may be additional text attached to the delimiters of a block (e.g. struct and end). This is fetched by the following functions, which are applied to the contents of the block rather than the delimiters.

val symbol_pre_extra_text : unit -> Ocaml_parsing.Docstrings.text

Fetch additional text preceding the current symbol

val symbol_post_extra_text : unit -> Ocaml_parsing.Docstrings.text

Fetch additional text following the current symbol

val rhs_pre_extra_text : int -> Ocaml_parsing.Docstrings.text

Fetch additional text preceding the symbol at the given position

val rhs_post_extra_text : int -> Ocaml_parsing.Docstrings.text

Fetch additional text following the symbol at the given position

val rhs_post_text : int -> Ocaml_parsing.Docstrings.text

Fetch text following the symbol at the given position

module WithMenhir : sig ... end