mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-17 08:06:43 -05:00
5 lines
No EOL
20 KiB
HTML
5 lines
No EOL
20 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Docstrings (ocaml.Docstrings)</title><link rel="stylesheet" href="../../_odoc-theme/odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 2.2.1"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body class="odoc"><nav class="odoc-nav"><a href="../index.html">Up</a> – <a href="../index.html">ocaml</a> » Docstrings</nav><header class="odoc-preamble"><h1>Module <code><span>Docstrings</span></code></h1><p>Documentation comments</p><p><b>Warning:</b> this module is unstable and part of <span class="xref-unresolved">compiler-libs</span>.</p></header><nav class="odoc-toc"><ul><li><a href="#docstrings">Docstrings</a></li><li><a href="#set-functions">Set functions</a></li><li><a href="#items">Items</a></li><li><a href="#fields-and-constructors">Fields and constructors</a></li><li><a href="#unattached-comments">Unattached comments</a></li><li><a href="#extra-text">Extra text</a></li></ul></nav><div class="odoc-content"><div class="odoc-spec"><div class="spec value anchored" id="val-init"><a href="#val-init" class="anchor"></a><code><span><span class="keyword">val</span> init : <span>unit <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p>(Re)Initialise all docstring state</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-warn_bad_docstrings"><a href="#val-warn_bad_docstrings" class="anchor"></a><code><span><span class="keyword">val</span> warn_bad_docstrings : <span>unit <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p>Emit warnings for unattached and ambiguous docstrings</p></div></div><h3 id="docstrings"><a href="#docstrings" class="anchor"></a>Docstrings</h3><div class="odoc-spec"><div class="spec type anchored" id="type-docstring"><a href="#type-docstring" class="anchor"></a><code><span><span class="keyword">type</span> docstring</span></code></div><div class="spec-doc"><p>Documentation comments</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-docstring"><a href="#val-docstring" class="anchor"></a><code><span><span class="keyword">val</span> docstring : <span>string <span class="arrow">-></span></span> <span><a href="../Location/index.html#type-t">Location.t</a> <span class="arrow">-></span></span> <a href="#type-docstring">docstring</a></span></code></div><div class="spec-doc"><p>Create a docstring</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-register"><a href="#val-register" class="anchor"></a><code><span><span class="keyword">val</span> register : <span><a href="#type-docstring">docstring</a> <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p>Register a docstring</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-docstring_body"><a href="#val-docstring_body" class="anchor"></a><code><span><span class="keyword">val</span> docstring_body : <span><a href="#type-docstring">docstring</a> <span class="arrow">-></span></span> string</span></code></div><div class="spec-doc"><p>Get the text of a docstring</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-docstring_loc"><a href="#val-docstring_loc" class="anchor"></a><code><span><span class="keyword">val</span> docstring_loc : <span><a href="#type-docstring">docstring</a> <span class="arrow">-></span></span> <a href="../Location/index.html#type-t">Location.t</a></span></code></div><div class="spec-doc"><p>Get the location of a docstring</p></div></div><h3 id="set-functions"><a href="#set-functions" class="anchor"></a>Set functions</h3><p>These functions are used by the lexer to associate docstrings to the locations of tokens.</p><div class="odoc-spec"><div class="spec value anchored" id="val-set_pre_docstrings"><a href="#val-set_pre_docstrings" class="anchor"></a><code><span><span class="keyword">val</span> set_pre_docstrings : <span><a href="../Stdlib/Lexing/index.html#type-position">Stdlib.Lexing.position</a> <span class="arrow">-></span></span> <span><span><a href="#type-docstring">docstring</a> list</span> <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p>Docstrings immediately preceding a token</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-set_post_docstrings"><a href="#val-set_post_docstrings" class="anchor"></a><code><span><span class="keyword">val</span> set_post_docstrings : <span><a href="../Stdlib/Lexing/index.html#type-position">Stdlib.Lexing.position</a> <span class="arrow">-></span></span> <span><span><a href="#type-docstring">docstring</a> list</span> <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p>Docstrings immediately following a token</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-set_floating_docstrings"><a href="#val-set_floating_docstrings" class="anchor"></a><code><span><span class="keyword">val</span> set_floating_docstrings : <span><a href="../Stdlib/Lexing/index.html#type-position">Stdlib.Lexing.position</a> <span class="arrow">-></span></span> <span><span><a href="#type-docstring">docstring</a> list</span> <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p>Docstrings not immediately adjacent to a token</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-set_pre_extra_docstrings"><a href="#val-set_pre_extra_docstrings" class="anchor"></a><code><span><span class="keyword">val</span> set_pre_extra_docstrings : <span><a href="../Stdlib/Lexing/index.html#type-position">Stdlib.Lexing.position</a> <span class="arrow">-></span></span> <span><span><a href="#type-docstring">docstring</a> list</span> <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p>Docstrings immediately following the token which precedes this one</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-set_post_extra_docstrings"><a href="#val-set_post_extra_docstrings" class="anchor"></a><code><span><span class="keyword">val</span> set_post_extra_docstrings :
|
||
<span><a href="../Stdlib/Lexing/index.html#type-position">Stdlib.Lexing.position</a> <span class="arrow">-></span></span>
|
||
<span><span><a href="#type-docstring">docstring</a> list</span> <span class="arrow">-></span></span>
|
||
unit</span></code></div><div class="spec-doc"><p>Docstrings immediately preceding the token which follows this one</p></div></div><h3 id="items"><a href="#items" class="anchor"></a>Items</h3><p>The <a href="#type-docs"><code>docs</code></a> type represents documentation attached to an item.</p><div class="odoc-spec"><div class="spec type anchored" id="type-docs"><a href="#type-docs" class="anchor"></a><code><span><span class="keyword">type</span> docs</span><span> = </span><span>{</span></code><ol><li id="type-docs.docs_pre" class="def record field anchored"><a href="#type-docs.docs_pre" class="anchor"></a><code><span>docs_pre : <span><a href="#type-docstring">docstring</a> option</span>;</span></code></li><li id="type-docs.docs_post" class="def record field anchored"><a href="#type-docs.docs_post" class="anchor"></a><code><span>docs_post : <span><a href="#type-docstring">docstring</a> option</span>;</span></code></li></ol><code><span>}</span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-empty_docs"><a href="#val-empty_docs" class="anchor"></a><code><span><span class="keyword">val</span> empty_docs : <a href="#type-docs">docs</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-docs_attr"><a href="#val-docs_attr" class="anchor"></a><code><span><span class="keyword">val</span> docs_attr : <span><a href="#type-docstring">docstring</a> <span class="arrow">-></span></span> <a href="../Parsetree/index.html#type-attribute">Parsetree.attribute</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_docs_attrs"><a href="#val-add_docs_attrs" class="anchor"></a><code><span><span class="keyword">val</span> add_docs_attrs : <span><a href="#type-docs">docs</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-attributes">Parsetree.attributes</a> <span class="arrow">-></span></span> <a href="../Parsetree/index.html#type-attributes">Parsetree.attributes</a></span></code></div><div class="spec-doc"><p>Convert item documentation to attributes and add them to an attribute list</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-symbol_docs"><a href="#val-symbol_docs" class="anchor"></a><code><span><span class="keyword">val</span> symbol_docs : <span>unit <span class="arrow">-></span></span> <a href="#type-docs">docs</a></span></code></div><div class="spec-doc"><p>Fetch the item documentation for the current symbol. This also marks this documentation (for ambiguity warnings).</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-symbol_docs_lazy"><a href="#val-symbol_docs_lazy" class="anchor"></a><code><span><span class="keyword">val</span> symbol_docs_lazy : <span>unit <span class="arrow">-></span></span> <span><a href="#type-docs">docs</a> <a href="../Stdlib/Lazy/index.html#type-t">Stdlib.Lazy.t</a></span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-rhs_docs"><a href="#val-rhs_docs" class="anchor"></a><code><span><span class="keyword">val</span> rhs_docs : <span>int <span class="arrow">-></span></span> <span>int <span class="arrow">-></span></span> <a href="#type-docs">docs</a></span></code></div><div class="spec-doc"><p>Fetch the item documentation for the symbols between two positions. This also marks this documentation (for ambiguity warnings).</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-rhs_docs_lazy"><a href="#val-rhs_docs_lazy" class="anchor"></a><code><span><span class="keyword">val</span> rhs_docs_lazy : <span>int <span class="arrow">-></span></span> <span>int <span class="arrow">-></span></span> <span><a href="#type-docs">docs</a> <a href="../Stdlib/Lazy/index.html#type-t">Stdlib.Lazy.t</a></span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-mark_symbol_docs"><a href="#val-mark_symbol_docs" class="anchor"></a><code><span><span class="keyword">val</span> mark_symbol_docs : <span>unit <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p>Mark the item documentation for the current symbol (for ambiguity warnings).</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-mark_rhs_docs"><a href="#val-mark_rhs_docs" class="anchor"></a><code><span><span class="keyword">val</span> mark_rhs_docs : <span>int <span class="arrow">-></span></span> <span>int <span class="arrow">-></span></span> unit</span></code></div><div class="spec-doc"><p>Mark as associated the item documentation for the symbols between two positions (for ambiguity warnings)</p></div></div><h3 id="fields-and-constructors"><a href="#fields-and-constructors" class="anchor"></a>Fields and constructors</h3><p>The <a href="#type-info"><code>info</code></a> type represents documentation attached to a field or constructor.</p><div class="odoc-spec"><div class="spec type anchored" id="type-info"><a href="#type-info" class="anchor"></a><code><span><span class="keyword">type</span> info</span><span> = <span><a href="#type-docstring">docstring</a> option</span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-empty_info"><a href="#val-empty_info" class="anchor"></a><code><span><span class="keyword">val</span> empty_info : <a href="#type-info">info</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-info_attr"><a href="#val-info_attr" class="anchor"></a><code><span><span class="keyword">val</span> info_attr : <span><a href="#type-docstring">docstring</a> <span class="arrow">-></span></span> <a href="../Parsetree/index.html#type-attribute">Parsetree.attribute</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_info_attrs"><a href="#val-add_info_attrs" class="anchor"></a><code><span><span class="keyword">val</span> add_info_attrs : <span><a href="#type-info">info</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-attributes">Parsetree.attributes</a> <span class="arrow">-></span></span> <a href="../Parsetree/index.html#type-attributes">Parsetree.attributes</a></span></code></div><div class="spec-doc"><p>Convert field info to attributes and add them to an attribute list</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-symbol_info"><a href="#val-symbol_info" class="anchor"></a><code><span><span class="keyword">val</span> symbol_info : <span>unit <span class="arrow">-></span></span> <a href="#type-info">info</a></span></code></div><div class="spec-doc"><p>Fetch the field info for the current symbol.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-rhs_info"><a href="#val-rhs_info" class="anchor"></a><code><span><span class="keyword">val</span> rhs_info : <span>int <span class="arrow">-></span></span> <a href="#type-info">info</a></span></code></div><div class="spec-doc"><p>Fetch the field info following the symbol at a given position.</p></div></div><h3 id="unattached-comments"><a href="#unattached-comments" class="anchor"></a>Unattached comments</h3><p>The <a href="#type-text"><code>text</code></a> type represents documentation which is not attached to anything.</p><div class="odoc-spec"><div class="spec type anchored" id="type-text"><a href="#type-text" class="anchor"></a><code><span><span class="keyword">type</span> text</span><span> = <span><a href="#type-docstring">docstring</a> list</span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-empty_text"><a href="#val-empty_text" class="anchor"></a><code><span><span class="keyword">val</span> empty_text : <a href="#type-text">text</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-empty_text_lazy"><a href="#val-empty_text_lazy" class="anchor"></a><code><span><span class="keyword">val</span> empty_text_lazy : <span><a href="#type-text">text</a> <a href="../Stdlib/Lazy/index.html#type-t">Stdlib.Lazy.t</a></span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-text_attr"><a href="#val-text_attr" class="anchor"></a><code><span><span class="keyword">val</span> text_attr : <span><a href="#type-docstring">docstring</a> <span class="arrow">-></span></span> <a href="../Parsetree/index.html#type-attribute">Parsetree.attribute</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-add_text_attrs"><a href="#val-add_text_attrs" class="anchor"></a><code><span><span class="keyword">val</span> add_text_attrs : <span><a href="#type-text">text</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-attributes">Parsetree.attributes</a> <span class="arrow">-></span></span> <a href="../Parsetree/index.html#type-attributes">Parsetree.attributes</a></span></code></div><div class="spec-doc"><p>Convert text to attributes and add them to an attribute list</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-symbol_text"><a href="#val-symbol_text" class="anchor"></a><code><span><span class="keyword">val</span> symbol_text : <span>unit <span class="arrow">-></span></span> <a href="#type-text">text</a></span></code></div><div class="spec-doc"><p>Fetch the text preceding the current symbol.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-symbol_text_lazy"><a href="#val-symbol_text_lazy" class="anchor"></a><code><span><span class="keyword">val</span> symbol_text_lazy : <span>unit <span class="arrow">-></span></span> <span><a href="#type-text">text</a> <a href="../Stdlib/Lazy/index.html#type-t">Stdlib.Lazy.t</a></span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-rhs_text"><a href="#val-rhs_text" class="anchor"></a><code><span><span class="keyword">val</span> rhs_text : <span>int <span class="arrow">-></span></span> <a href="#type-text">text</a></span></code></div><div class="spec-doc"><p>Fetch the text preceding the symbol at the given position.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-rhs_text_lazy"><a href="#val-rhs_text_lazy" class="anchor"></a><code><span><span class="keyword">val</span> rhs_text_lazy : <span>int <span class="arrow">-></span></span> <span><a href="#type-text">text</a> <a href="../Stdlib/Lazy/index.html#type-t">Stdlib.Lazy.t</a></span></span></code></div></div><h3 id="extra-text"><a href="#extra-text" class="anchor"></a>Extra text</h3><p>There may be additional text attached to the delimiters of a block (e.g. <code>struct</code> and <code>end</code>). This is fetched by the following functions, which are applied to the contents of the block rather than the delimiters.</p><div class="odoc-spec"><div class="spec value anchored" id="val-symbol_pre_extra_text"><a href="#val-symbol_pre_extra_text" class="anchor"></a><code><span><span class="keyword">val</span> symbol_pre_extra_text : <span>unit <span class="arrow">-></span></span> <a href="#type-text">text</a></span></code></div><div class="spec-doc"><p>Fetch additional text preceding the current symbol</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-symbol_post_extra_text"><a href="#val-symbol_post_extra_text" class="anchor"></a><code><span><span class="keyword">val</span> symbol_post_extra_text : <span>unit <span class="arrow">-></span></span> <a href="#type-text">text</a></span></code></div><div class="spec-doc"><p>Fetch additional text following the current symbol</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-rhs_pre_extra_text"><a href="#val-rhs_pre_extra_text" class="anchor"></a><code><span><span class="keyword">val</span> rhs_pre_extra_text : <span>int <span class="arrow">-></span></span> <a href="#type-text">text</a></span></code></div><div class="spec-doc"><p>Fetch additional text preceding the symbol at the given position</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-rhs_post_extra_text"><a href="#val-rhs_post_extra_text" class="anchor"></a><code><span><span class="keyword">val</span> rhs_post_extra_text : <span>int <span class="arrow">-></span></span> <a href="#type-text">text</a></span></code></div><div class="spec-doc"><p>Fetch additional text following the symbol at the given position</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-rhs_post_text"><a href="#val-rhs_post_text" class="anchor"></a><code><span><span class="keyword">val</span> rhs_post_text : <span>int <span class="arrow">-></span></span> <a href="#type-text">text</a></span></code></div><div class="spec-doc"><p>Fetch text following the symbol at the given position</p></div></div><div class="odoc-spec"><div class="spec module anchored" id="module-WithMenhir"><a href="#module-WithMenhir" class="anchor"></a><code><span><span class="keyword">module</span> <a href="WithMenhir/index.html">WithMenhir</a></span><span> : <span class="keyword">sig</span> ... <span class="keyword">end</span></span></code></div></div></div></body></html> |