mirror of https://github.com/status-im/NimYAML.git
150 lines
8.0 KiB
HTML
150 lines
8.0 KiB
HTML
<!DOCTYPE html>
|
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
<title>NimYAML - Module yaml.hints</title>
|
|
|
|
<link href="docutils.css" rel="stylesheet" type="text/css"/>
|
|
<link href="style.css" rel="stylesheet" type="text/css"/>
|
|
|
|
<link href='http://fonts.googleapis.com/css?family=Raleway:400,600,900' rel='stylesheet' type='text/css'/>
|
|
<link href='http://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
|
</head>
|
|
<body>
|
|
<a href="https://github.com/flyx/NimYAML"><img style="position: fixed; top: 0; right: 0; border: 0; z-index: 10;" src="https://camo.githubusercontent.com/652c5b9acfaddf3a9c326fa6bde407b87f7be0f4/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f6f72616e67655f6666373630302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png"></a>
|
|
<header>
|
|
<a class="pagetitle" href="index.html">NimYAML</a>
|
|
<a href="index.html">Home</a>
|
|
<a href="testing.html">Testing Ground</a>
|
|
<span>Docs:</span>
|
|
<a href="api.html">Overview</a>
|
|
<span>
|
|
<a href="#">Serialization</a>
|
|
<ul>
|
|
<li><a href="serialization.html">Overview</a></li>
|
|
<li><a href="schema.html">Schema</a></li>
|
|
</ul>
|
|
</span>
|
|
<span>
|
|
<a href="#">Modules</a>
|
|
<ul class="monospace">
|
|
<li><a href="yaml.html">yaml</a></li>
|
|
<li><a href="yaml.dom.html">yaml.dom</a></li>
|
|
<li><a href="yaml.hints.html">yaml.hints</a></li>
|
|
<li><a href="yaml.parser.html">yaml.parser</a></li>
|
|
<li><a href="yaml.presenter.html">yaml.presenter</a></li>
|
|
<li><a href="yaml.serialization.html">yaml.serialization</a></li>
|
|
<li><a href="yaml.stream.html">yaml.stream</a></li>
|
|
<li><a href="yaml.taglib.html">yaml.taglib</a></li>
|
|
<li><a href="yaml.tojson.html">yaml.tojson</a></li>
|
|
</ul>
|
|
</span>
|
|
</header>
|
|
<article id="documentId">
|
|
<div class="container">
|
|
<h1 class="title">Module yaml.hints</h1>
|
|
<div class="row">
|
|
<div class="three columns">
|
|
<div>
|
|
Search: <input type="text" id="searchInput"
|
|
onkeyup="search()" />
|
|
</div>
|
|
<div>
|
|
Group by:
|
|
<select onchange="groupBy(this.value)">
|
|
<option value="section">Section</option>
|
|
<option value="type">Type</option>
|
|
</select>
|
|
</div>
|
|
<ul class="simple simple-toc" id="toc-list">
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
|
|
<ul class="simple simple-toc-section">
|
|
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#7" id="57">Types</a>
|
|
<ul class="simple simple-toc-section">
|
|
<li><a class="reference" href="#TypeHint"
|
|
title="TypeHint = enum
|
|
yTypeInteger, yTypeFloat, yTypeFloatInf, yTypeFloatNaN, yTypeBoolTrue,
|
|
yTypeBoolFalse, yTypeNull, yTypeUnknown, yTypeTimestamp"><wbr />Type<wbr />Hint</a></li>
|
|
|
|
</ul>
|
|
</li>
|
|
<li>
|
|
<a class="reference reference-toplevel" href="#12" id="62">Procs</a>
|
|
<ul class="simple simple-toc-section">
|
|
<li><a class="reference" href="#guessType,string"
|
|
title="guessType(scalar: string): TypeHint"><wbr />guess<wbr />Type</a></li>
|
|
|
|
</ul>
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
<div class="nine columns" id="content">
|
|
<div id="tocRoot"></div>
|
|
<p class="module-desc"><p>The hints API enables you to guess the type of YAML scalars.</p>
|
|
</p>
|
|
<section id="6">
|
|
<h1><a class="toc-backref" href="#6">Imports</a></h1>
|
|
<dl class="item">
|
|
<a class="reference external" href="macros.html">macros</a>, <a class="reference external" href="../private/internal.html">../private/internal</a>
|
|
</dl></section>
|
|
<section id="7">
|
|
<h1><a class="toc-backref" href="#7">Types</a></h1>
|
|
<dl class="item">
|
|
<dt id="TypeHint"><a name="TypeHint"></a><pre><span class="Identifier">TypeHint</span> <span class="Other">=</span> <span class="Keyword">enum</span>
|
|
<span class="Identifier">yTypeInteger</span><span class="Other">,</span> <span class="Identifier">yTypeFloat</span><span class="Other">,</span> <span class="Identifier">yTypeFloatInf</span><span class="Other">,</span> <span class="Identifier">yTypeFloatNaN</span><span class="Other">,</span> <span class="Identifier">yTypeBoolTrue</span><span class="Other">,</span>
|
|
<span class="Identifier">yTypeBoolFalse</span><span class="Other">,</span> <span class="Identifier">yTypeNull</span><span class="Other">,</span> <span class="Identifier">yTypeUnknown</span><span class="Other">,</span> <span class="Identifier">yTypeTimestamp</span></pre></dt>
|
|
<dd>
|
|
<p>A type hint can be computed from scalar content and tells you what NimYAML thinks the scalar's type is. It is generated by <a class="reference external" href="#guessType,string">guessType</a> The first matching RegEx in the following table will be the type hint of a scalar string.</p>
|
|
<p>You can use it to determine the type of YAML scalars that have a '?' non-specific tag, but using this feature is completely optional.</p>
|
|
<table border="1" class="docutils"><tr><th>Name</th><th>RegEx</th></tr>
|
|
<tr><td><tt class="docutils literal"><span class="pre">yTypeInteger</span></tt></td><td><tt class="docutils literal"><span class="pre">0 | -? [1-9] [0-9]*</span></tt></td></tr>
|
|
<tr><td><tt class="docutils literal"><span class="pre">yTypeFloat</span></tt></td><td><tt class="docutils literal"><span class="pre">-? [1-9] ( \. [0-9]* [1-9] )? ( e [-+] [1-9] [0-9]* )?</span></tt></td></tr>
|
|
<tr><td><tt class="docutils literal"><span class="pre">yTypeFloatInf</span></tt></td><td><tt class="docutils literal"><span class="pre">-? \. (inf | Inf | INF)</span></tt></td></tr>
|
|
<tr><td><tt class="docutils literal"><span class="pre">yTypeFloatNaN</span></tt></td><td><tt class="docutils literal"><span class="pre">-? \. (nan | NaN | NAN)</span></tt></td></tr>
|
|
<tr><td><tt class="docutils literal"><span class="pre">yTypeBoolTrue</span></tt></td><td><tt class="docutils literal"><span class="pre">y|Y|yes|Yes|YES|true|True|TRUE|on|On|ON</span></tt></td></tr>
|
|
<tr><td><tt class="docutils literal"><span class="pre">yTypeBoolFalse</span></tt></td><td><tt class="docutils literal"><span class="pre">n|N|no|No|NO|false|False|FALSE|off|Off|OFF</span></tt></td></tr>
|
|
<tr><td><tt class="docutils literal"><span class="pre">yTypeNull</span></tt></td><td><tt class="docutils literal"><span class="pre">~ | null | Null | NULL</span></tt></td></tr>
|
|
<tr><td><tt class="docutils literal"><span class="pre">yTypeTimestamp</span></tt></td><td>see <a class="reference external" href="http://yaml.org/type/timestamp.html">here</a>.</td></tr>
|
|
<tr><td><tt class="docutils literal"><span class="pre">yTypeUnknown</span></tt></td><td><tt class="docutils literal"><span class="pre">*</span></tt></td></tr>
|
|
</table>
|
|
<a
|
|
href="/yaml/hints.nim#L17"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
</dd>
|
|
|
|
</dl></section>
|
|
<section id="12">
|
|
<h1><a class="toc-backref" href="#12">Procs</a></h1>
|
|
<dl class="item">
|
|
<dt id="guessType"><a name="guessType,string"></a><pre><span class="Keyword">proc</span> <span class="Identifier">guessType</span><span class="Other">(</span><span class="Identifier">scalar</span><span class="Other">:</span> <span class="Identifier">string</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">TypeHint</span> <span class="Other pragmabegin">{.</span><div class="pragma"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></div><span class="Other pragmaend">.}</span></pre></dt>
|
|
<dd>
|
|
Parse scalar string according to the RegEx table documented at <a class="reference external" href="#TypeHind">TypeHint</a>.
|
|
<a
|
|
href="/yaml/hints.nim#L261"
|
|
class="link-seesrc" target="_blank">Source</a>
|
|
</dd>
|
|
|
|
</dl></section>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="twelve-columns footer">
|
|
<span class="nim-sprite"></span>
|
|
<br/>
|
|
<small>Made with Nim. Generated: 2016-11-08 21:32:29 UTC</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</article>
|
|
</body>
|
|
</html>
|