mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-16 15:56:21 -05:00
2 lines
No EOL
10 KiB
HTML
2 lines
No EOL
10 KiB
HTML
<!DOCTYPE html>
|
||
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Parse (ocaml.Parse)</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> » Parse</nav><header class="odoc-preamble"><h1>Module <code><span>Parse</span></code></h1><p>Entry points in the parser</p><p><b>Warning:</b> this module is unstable and part of <span class="xref-unresolved">compiler-libs</span>.</p></header><div class="odoc-content"><div class="odoc-spec"><div class="spec value anchored" id="val-implementation"><a href="#val-implementation" class="anchor"></a><code><span><span class="keyword">val</span> implementation : <span><a href="../Stdlib/Lexing/index.html#type-lexbuf">Stdlib.Lexing.lexbuf</a> <span class="arrow">-></span></span> <a href="../Parsetree/index.html#type-structure">Parsetree.structure</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-interface"><a href="#val-interface" class="anchor"></a><code><span><span class="keyword">val</span> interface : <span><a href="../Stdlib/Lexing/index.html#type-lexbuf">Stdlib.Lexing.lexbuf</a> <span class="arrow">-></span></span> <a href="../Parsetree/index.html#type-signature">Parsetree.signature</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-toplevel_phrase"><a href="#val-toplevel_phrase" class="anchor"></a><code><span><span class="keyword">val</span> toplevel_phrase : <span><a href="../Stdlib/Lexing/index.html#type-lexbuf">Stdlib.Lexing.lexbuf</a> <span class="arrow">-></span></span> <a href="../Parsetree/index.html#type-toplevel_phrase">Parsetree.toplevel_phrase</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-use_file"><a href="#val-use_file" class="anchor"></a><code><span><span class="keyword">val</span> use_file : <span><a href="../Stdlib/Lexing/index.html#type-lexbuf">Stdlib.Lexing.lexbuf</a> <span class="arrow">-></span></span> <span><a href="../Parsetree/index.html#type-toplevel_phrase">Parsetree.toplevel_phrase</a> list</span></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-core_type"><a href="#val-core_type" class="anchor"></a><code><span><span class="keyword">val</span> core_type : <span><a href="../Stdlib/Lexing/index.html#type-lexbuf">Stdlib.Lexing.lexbuf</a> <span class="arrow">-></span></span> <a href="../Parsetree/index.html#type-core_type">Parsetree.core_type</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-expression"><a href="#val-expression" class="anchor"></a><code><span><span class="keyword">val</span> expression : <span><a href="../Stdlib/Lexing/index.html#type-lexbuf">Stdlib.Lexing.lexbuf</a> <span class="arrow">-></span></span> <a href="../Parsetree/index.html#type-expression">Parsetree.expression</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-pattern"><a href="#val-pattern" class="anchor"></a><code><span><span class="keyword">val</span> pattern : <span><a href="../Stdlib/Lexing/index.html#type-lexbuf">Stdlib.Lexing.lexbuf</a> <span class="arrow">-></span></span> <a href="../Parsetree/index.html#type-pattern">Parsetree.pattern</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-module_type"><a href="#val-module_type" class="anchor"></a><code><span><span class="keyword">val</span> module_type : <span><a href="../Stdlib/Lexing/index.html#type-lexbuf">Stdlib.Lexing.lexbuf</a> <span class="arrow">-></span></span> <a href="../Parsetree/index.html#type-module_type">Parsetree.module_type</a></span></code></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-module_expr"><a href="#val-module_expr" class="anchor"></a><code><span><span class="keyword">val</span> module_expr : <span><a href="../Stdlib/Lexing/index.html#type-lexbuf">Stdlib.Lexing.lexbuf</a> <span class="arrow">-></span></span> <a href="../Parsetree/index.html#type-module_expr">Parsetree.module_expr</a></span></code></div></div><p>The functions below can be used to parse Longident safely.</p><div class="odoc-spec"><div class="spec value anchored" id="val-longident"><a href="#val-longident" class="anchor"></a><code><span><span class="keyword">val</span> longident : <span><a href="../Stdlib/Lexing/index.html#type-lexbuf">Stdlib.Lexing.lexbuf</a> <span class="arrow">-></span></span> <a href="../Longident/index.html#type-t">Longident.t</a></span></code></div><div class="spec-doc"><p>The function <code>longident</code> is guaranteed to parse all subclasses of <a href="../Longident/index.html#type-t"><code>Longident.t</code></a> used in OCaml: values, constructors, simple or extended module paths, and types or module types.</p><p>However, this function accepts inputs which are not accepted by the compiler, because they combine functor applications and infix operators. In valid OCaml syntax, only value-level identifiers may end with infix operators <code>Foo.( + )</code>. Moreover, in value-level identifiers the module path <code>Foo</code> must be simple (<code>M.N</code> rather than <code>F(X)</code>): functor applications may only appear in type-level identifiers. As a consequence, a path such as <code>F(X).( + )</code> is not a valid OCaml identifier; but it is accepted by this function.</p></div></div><p>The next functions are specialized to a subclass of <a href="../Longident/index.html#type-t"><code>Longident.t</code></a></p><div class="odoc-spec"><div class="spec value anchored" id="val-val_ident"><a href="#val-val_ident" class="anchor"></a><code><span><span class="keyword">val</span> val_ident : <span><a href="../Stdlib/Lexing/index.html#type-lexbuf">Stdlib.Lexing.lexbuf</a> <span class="arrow">-></span></span> <a href="../Longident/index.html#type-t">Longident.t</a></span></code></div><div class="spec-doc"><p>This function parses a syntactically valid path for a value. For instance, <code>x</code>, <code>M.x</code>, and <code>(+.)</code> are valid. Contrarily, <code>M.A</code>, <code>F(X).x</code>, and <code>true</code> are rejected.</p><p>Longident for OCaml's value cannot contain functor application. The last component of the <a href="../Longident/index.html#type-t"><code>Longident.t</code></a> is not capitalized, but can be an operator <code>A.Path.To.(.%.%.(;..)<-)</code></p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-constr_ident"><a href="#val-constr_ident" class="anchor"></a><code><span><span class="keyword">val</span> constr_ident : <span><a href="../Stdlib/Lexing/index.html#type-lexbuf">Stdlib.Lexing.lexbuf</a> <span class="arrow">-></span></span> <a href="../Longident/index.html#type-t">Longident.t</a></span></code></div><div class="spec-doc"><p>This function parses a syntactically valid path for a variant constructor. For instance, <code>A</code>, <code>M.A</code> and <code>M.(::)</code> are valid, but both <code>M.a</code> and <code>F(X).A</code> are rejected.</p><p>Longident for OCaml's variant constructors cannot contain functor application. The last component of the <a href="../Longident/index.html#type-t"><code>Longident.t</code></a> is capitalized, or it may be one the special constructors: <code>true</code>,<code>false</code>,<code>()</code>,<code>[]</code>,<code>(::)</code>. Among those special constructors, only <code>(::)</code> can be prefixed by a module path (<code>A.B.C.(::)</code>).</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-simple_module_path"><a href="#val-simple_module_path" class="anchor"></a><code><span><span class="keyword">val</span> simple_module_path : <span><a href="../Stdlib/Lexing/index.html#type-lexbuf">Stdlib.Lexing.lexbuf</a> <span class="arrow">-></span></span> <a href="../Longident/index.html#type-t">Longident.t</a></span></code></div><div class="spec-doc"><p>This function parses a syntactically valid path for a module. For instance, <code>A</code>, and <code>M.A</code> are valid, but both <code>M.a</code> and <code>F(X).A</code> are rejected.</p><p>Longident for OCaml's module cannot contain functor application. The last component of the <a href="../Longident/index.html#type-t"><code>Longident.t</code></a> is capitalized.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-extended_module_path"><a href="#val-extended_module_path" class="anchor"></a><code><span><span class="keyword">val</span> extended_module_path : <span><a href="../Stdlib/Lexing/index.html#type-lexbuf">Stdlib.Lexing.lexbuf</a> <span class="arrow">-></span></span> <a href="../Longident/index.html#type-t">Longident.t</a></span></code></div><div class="spec-doc"><p>This function parse syntactically valid path for an extended module. For instance, <code>A.B</code> and <code>F(A).B</code> are valid. Contrarily, <code>(.%())</code> or <code>[]</code> are both rejected.</p><p>The last component of the <a href="../Longident/index.html#type-t"><code>Longident.t</code></a> is capitalized.</p></div></div><div class="odoc-spec"><div class="spec value anchored" id="val-type_ident"><a href="#val-type_ident" class="anchor"></a><code><span><span class="keyword">val</span> type_ident : <span><a href="../Stdlib/Lexing/index.html#type-lexbuf">Stdlib.Lexing.lexbuf</a> <span class="arrow">-></span></span> <a href="../Longident/index.html#type-t">Longident.t</a></span></code></div><div class="spec-doc"><p>This function parse syntactically valid path for a type or a module type. For instance, <code>A</code>, <code>t</code>, <code>M.t</code> and <code>F(X).t</code> are valid. Contrarily, <code>(.%())</code> or <code>[]</code> are both rejected.</p><p>In path for type and module types, only operators and special constructors are rejected.</p></div></div></div></body></html> |