ocaml-containers/3.8/containers/CCParse/U/index.html
2022-06-10 23:51:21 -04:00

15 lines
No EOL
7.3 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 2.1.0"/><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">containers</a> &#x00BB; <a href="../index.html">CCParse</a> &#x00BB; U</nav><header class="odoc-preamble"><h1>Module <code><span>CCParse.U</span></code></h1></header><nav class="odoc-toc"><ul><li><a href="#utils">Utils</a></li></ul></nav><div class="odoc-content"><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><div class="odoc-spec"><div class="spec value" id="val-list" class="anchored"><a href="#val-list" class="anchor"></a><code><span><span class="keyword">val</span> list : <span>?start:string <span class="arrow">&#45;&gt;</span></span> <span>?stop:string <span class="arrow">&#45;&gt;</span></span> <span>?sep:string <span class="arrow">&#45;&gt;</span></span> <span><span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span><span class="type-var">'a</span> list</span> <a href="../index.html#type-t">t</a></span></span></code></div><div class="spec-doc"><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></div></div><div class="odoc-spec"><div class="spec value" id="val-int" class="anchored"><a href="#val-int" class="anchor"></a><code><span><span class="keyword">val</span> int : <span>int <a href="../index.html#type-t">t</a></span></span></code></div><div class="spec-doc"><p>Parse an int in decimal representation.</p></div></div><div class="odoc-spec"><div class="spec value" id="val-in_paren" class="anchored"><a href="#val-in_paren" class="anchor"></a><code><span><span class="keyword">val</span> in_paren : <span><span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span></span></code></div><div class="spec-doc"><p><code>in_paren p</code> parses an opening &quot;(&quot;,<code>p</code> , and then &quot;)&quot;.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 3.6</li></ul></div></div><div class="odoc-spec"><div class="spec value" id="val-in_parens_opt" class="anchored"><a href="#val-in_parens_opt" class="anchor"></a><code><span><span class="keyword">val</span> in_parens_opt : <span><span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span></span></code></div><div class="spec-doc"><p><code>in_parens_opt p</code> parses <code>p</code> in an arbitrary number of nested parenthesis (possibly 0).</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 3.6</li></ul></div></div><div class="odoc-spec"><div class="spec value" id="val-option" class="anchored"><a href="#val-option" class="anchor"></a><code><span><span class="keyword">val</span> option : <span><span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span> <span><span><span class="type-var">'a</span> option</span> <a href="../index.html#type-t">t</a></span></span></code></div><div class="spec-doc"><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><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 3.6</li></ul></div></div><div class="odoc-spec"><div class="spec value" id="val-hexa_int" class="anchored"><a href="#val-hexa_int" class="anchor"></a><code><span><span class="keyword">val</span> hexa_int : <span>int <a href="../index.html#type-t">t</a></span></span></code></div><div class="spec-doc"><p>Parse an int int hexadecimal format. Accepts an optional <code>0x</code> prefix, and ignores capitalization.</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 3.6</li></ul></div></div><div class="odoc-spec"><div class="spec value" id="val-word" class="anchored"><a href="#val-word" class="anchor"></a><code><span><span class="keyword">val</span> word : <span>string <a href="../index.html#type-t">t</a></span></span></code></div><div class="spec-doc"><p>Non empty string of alpha num, start with alpha.</p></div></div><div class="odoc-spec"><div class="spec value" id="val-bool" class="anchored"><a href="#val-bool" class="anchor"></a><code><span><span class="keyword">val</span> bool : <span>bool <a href="../index.html#type-t">t</a></span></span></code></div><div class="spec-doc"><p>Accepts &quot;true&quot; or &quot;false&quot;</p><ul class="at-tags"><li class="since"><span class="at-tag">since</span> 3.6</li></ul></div></div><div class="odoc-spec"><div class="spec value" id="val-pair" class="anchored"><a href="#val-pair" class="anchor"></a><code><span><span class="keyword">val</span> pair :
<span>?start:string <span class="arrow">&#45;&gt;</span></span>
<span>?stop:string <span class="arrow">&#45;&gt;</span></span>
<span>?sep:string <span class="arrow">&#45;&gt;</span></span>
<span><span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span>
<span><span><span class="type-var">'b</span> <a href="../index.html#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></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></span></code></div><div class="spec-doc"><p>Parse a pair using OCaml syntactic conventions. The default is &quot;(a, b)&quot;.</p></div></div><div class="odoc-spec"><div class="spec value" id="val-triple" class="anchored"><a href="#val-triple" class="anchor"></a><code><span><span class="keyword">val</span> triple :
<span>?start:string <span class="arrow">&#45;&gt;</span></span>
<span>?stop:string <span class="arrow">&#45;&gt;</span></span>
<span>?sep:string <span class="arrow">&#45;&gt;</span></span>
<span><span><span class="type-var">'a</span> <a href="../index.html#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span>
<span><span><span class="type-var">'b</span> <a href="../index.html#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></span>
<span><span><span class="type-var">'c</span> <a href="../index.html#type-t">t</a></span> <span class="arrow">&#45;&gt;</span></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></span></code></div><div class="spec-doc"><p>Parse a triple using OCaml syntactic conventions. The default is &quot;(a, b, c)&quot;.</p></div></div></div></body></html>