ocaml-containers/dev/containers/CCParse/U/index.html
2021-09-26 00:58:26 +00:00

2 lines
No EOL
5.9 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>U (containers.CCParse.U)</title><link rel="stylesheet" href="../../../odoc.css"/><meta charset="utf-8"/><meta name="generator" content="odoc 1.5.3"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> <a href="../../index.html">containers</a> &#x00BB; <a href="../index.html">CCParse</a> &#x00BB; U</nav><h1>Module <code>CCParse.U</code></h1><h3 id="utils"><a href="#utils" class="anchor"></a>Utils</h3><p>This is useful to parse OCaml-like values in a simple way. All the parsers are whitespace-insensitive (they skip whitespace).</p></header><dl><dt class="spec value" id="val-list"><a href="#val-list" class="anchor"></a><code><span class="keyword">val</span> list : <span>?&#8288;start:string</span> <span>&#45;&gt;</span> <span>?&#8288;stop:string</span> <span>&#45;&gt;</span> <span>?&#8288;sep:string</span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span><span class="type-var">'a</span> list</span> <a href="../index.html#type-t">t</a></span></code></dt><dd><p><code>list p</code> parses a list of <code>p</code>, with the OCaml conventions for start token &quot;[&quot;, stop token &quot;]&quot; and separator &quot;;&quot;. Whitespace between items are skipped.</p></dd></dl><dl><dt class="spec value" id="val-int"><a href="#val-int" class="anchor"></a><code><span class="keyword">val</span> int : <span>int <a href="../index.html#type-t">t</a></span></code></dt><dd><p>Parse an int in decimal representation.</p></dd></dl><dl><dt class="spec value" id="val-in_paren"><a href="#val-in_paren" class="anchor"></a><code><span class="keyword">val</span> in_paren : <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span></code></dt><dd><p><code>in_paren p</code> parses an opening &quot;(&quot;,<code>p</code> , and then &quot;)&quot;.</p><dl><dt>since</dt><dd>NEXT_RELEASE</dd></dl></dd></dl><dl><dt class="spec value" id="val-in_parens_opt"><a href="#val-in_parens_opt" class="anchor"></a><code><span class="keyword">val</span> in_parens_opt : <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span></code></dt><dd><p><code>in_parens_opt p</code> parses <code>p</code> in an arbitrary number of nested parenthesis (possibly 0).</p><dl><dt>since</dt><dd>NEXT_RELEASE</dd></dl></dd></dl><dl><dt class="spec value" id="val-option"><a href="#val-option" class="anchor"></a><code><span class="keyword">val</span> option : <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span><span class="type-var">'a</span> option</span> <a href="../index.html#type-t">t</a></span></code></dt><dd><p><code>option p</code> parses &quot;Some &lt;x&gt;&quot; into <code>Some x</code> if <code>p</code> parses &quot;&lt;x&gt;&quot; into <code>x</code>, and parses &quot;None&quot; into <code>None</code>.</p><dl><dt>since</dt><dd>NEXT_RELEASE</dd></dl></dd></dl><dl><dt class="spec value" id="val-hexa_int"><a href="#val-hexa_int" class="anchor"></a><code><span class="keyword">val</span> hexa_int : <span>int <a href="../index.html#type-t">t</a></span></code></dt><dd><p>Parse an int int hexadecimal format. Accepts an optional <code>0x</code> prefix, and ignores capitalization.</p><dl><dt>since</dt><dd>NEXT_RELEASE</dd></dl></dd></dl><dl><dt class="spec value" id="val-word"><a href="#val-word" class="anchor"></a><code><span class="keyword">val</span> word : <span>string <a href="../index.html#type-t">t</a></span></code></dt><dd><p>Non empty string of alpha num, start with alpha.</p></dd></dl><dl><dt class="spec value" id="val-bool"><a href="#val-bool" class="anchor"></a><code><span class="keyword">val</span> bool : <span>bool <a href="../index.html#type-t">t</a></span></code></dt><dd><p>Accepts &quot;true&quot; or &quot;false&quot;</p><dl><dt>since</dt><dd>NEXT_RELEASE</dd></dl></dd></dl><dl><dt class="spec value" id="val-pair"><a href="#val-pair" class="anchor"></a><code><span class="keyword">val</span> pair : <span>?&#8288;start:string</span> <span>&#45;&gt;</span> <span>?&#8288;stop:string</span> <span>&#45;&gt;</span> <span>?&#8288;sep:string</span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'b</span> <a href="../index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span>(<span class="type-var">'a</span> * <span class="type-var">'b</span>)</span> <a href="../index.html#type-t">t</a></span></code></dt><dd><p>Parse a pair using OCaml syntactic conventions. The default is &quot;(a, b)&quot;.</p></dd></dl><dl><dt class="spec value" id="val-triple"><a href="#val-triple" class="anchor"></a><code><span class="keyword">val</span> triple : <span>?&#8288;start:string</span> <span>&#45;&gt;</span> <span>?&#8288;stop:string</span> <span>&#45;&gt;</span> <span>?&#8288;sep:string</span> <span>&#45;&gt;</span> <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'b</span> <a href="../index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span class="type-var">'c</span> <a href="../index.html#type-t">t</a></span> <span>&#45;&gt;</span> <span><span>(<span class="type-var">'a</span> * <span class="type-var">'b</span> * <span class="type-var">'c</span>)</span> <a href="../index.html#type-t">t</a></span></code></dt><dd><p>Parse a triple using OCaml syntactic conventions. The default is &quot;(a, b, c)&quot;.</p></dd></dl></div></body></html>