module Docstrings: sig .. end
Documentation comments
Warning: this module is unstable and part of compiler-libs.
let init: unit => unit;
(Re)Initialise all docstring state
let warn_bad_docstrings: unit => unit;
Emit warnings for unattached and ambiguous docstrings
type docstring;
Documentation comments
let docstring: (string, Location.t) => docstring;
Create a docstring
let register: docstring => unit;
Register a docstring
let docstring_body: docstring => string;
Get the text of a docstring
let docstring_loc: docstring => Location.t;
Get the location of a docstring
These functions are used by the lexer to associate docstrings to the locations of tokens.
let set_pre_docstrings: (Lexing.position, list(docstring)) => unit;
Docstrings immediately preceding a token
let set_post_docstrings: (Lexing.position, list(docstring)) => unit;
Docstrings immediately following a token
let set_floating_docstrings: (Lexing.position, list(docstring)) => unit;
Docstrings not immediately adjacent to a token
let set_pre_extra_docstrings: (Lexing.position, list(docstring)) => unit;
Docstrings immediately following the token which precedes this one
let set_post_extra_docstrings: (Lexing.position, list(docstring)) => unit;
Docstrings immediately preceding the token which follows this one
The Docstrings.docs
type represents documentation attached to an item.
type docs = {
|
docs_pre : docstring option; |
|
docs_post : docstring option; |
}
let empty_docs: docs;
let docs_attr: docstring => Parsetree.attribute;
let add_docs_attrs: (docs, Parsetree.attributes) => Parsetree.attributes;
Convert item documentation to attributes and add them to an attribute list
let symbol_docs: unit => docs;
Fetch the item documentation for the current symbol. This also marks this documentation (for ambiguity warnings).
let symbol_docs_lazy: unit => Lazy.t(docs);
let rhs_docs: (int, int) => docs;
Fetch the item documentation for the symbols between two positions. This also marks this documentation (for ambiguity warnings).
let rhs_docs_lazy: (int, int) => Lazy.t(docs);
let mark_symbol_docs: unit => unit;
Mark the item documentation for the current symbol (for ambiguity warnings).
let mark_rhs_docs: (int, int) => unit;
Mark as associated the item documentation for the symbols between two positions (for ambiguity warnings)
The Docstrings.info
type represents documentation attached to a field or
constructor.
type info = option(docstring);
let empty_info: info;
let info_attr: docstring => Parsetree.attribute;
let add_info_attrs: (info, Parsetree.attributes) => Parsetree.attributes;
Convert field info to attributes and add them to an attribute list
let symbol_info: unit => info;
Fetch the field info for the current symbol.
let rhs_info: int => info;
Fetch the field info following the symbol at a given position.
The Docstrings.text
type represents documentation which is not attached to
anything.
type text = list(docstring);
let empty_text: text;
let empty_text_lazy: Lazy.t(text);
let text_attr: docstring => Parsetree.attribute;
let add_text_attrs: (text, Parsetree.attributes) => Parsetree.attributes;
Convert text to attributes and add them to an attribute list
let symbol_text: unit => text;
Fetch the text preceding the current symbol.
let symbol_text_lazy: unit => Lazy.t(text);
let rhs_text: int => text;
Fetch the text preceding the symbol at the given position.
let rhs_text_lazy: int => Lazy.t(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.
let symbol_pre_extra_text: unit => text;
Fetch additional text preceding the current symbol
let symbol_post_extra_text: unit => text;
Fetch additional text following the current symbol
let rhs_pre_extra_text: int => text;
Fetch additional text preceding the symbol at the given position
let rhs_post_extra_text: int => text;
Fetch additional text following the symbol at the given position
let rhs_post_text: int => text;
Fetch text following the symbol at the given position
module WithMenhir: sig .. end