Skip to content

Commit

Permalink
deploy: 0ff95dd
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mie6 committed Nov 21, 2024
1 parent dac737f commit 18cc702
Show file tree
Hide file tree
Showing 15 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion 5.0/api-guide/combinator.html
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ <h2 id="iterative-combinators" class="section"><a class="anchor-link left" href=
</span><span class="keyword">import</span><span> </span><span class="identifier">parsley</span><span>.</span><span class="identifier">combinator</span><span>.{</span><span class="identifier">manyTill</span><span>}

</span><span class="keyword">val</span><span> </span><span class="identifier">comment</span><span> = </span><span class="identifier">string</span><span>(</span><span class="string-literal">&quot;//&quot;</span><span>) ~&gt; </span><span class="identifier">manyTill</span><span>(</span><span class="identifier">item</span><span>, </span><span class="identifier">endOfLine</span><span>)
</span><span class="comment">// comment: parsley.Parsley[List[Char]] = parsley.Parsley@1a6b496a
</span><span class="comment">// comment: parsley.Parsley[List[Char]] = parsley.Parsley@4f39d58d
</span><span class="identifier">comment</span><span>.</span><span class="identifier">parse</span><span>(</span><span class="string-literal">&quot;// this is a comment</span><span class="escape-sequence">\n</span><span class="string-literal">&quot;</span><span>)
</span><span class="comment">// res0: parsley.Result[String, List[Char]] = Success(List( , t, h, i, s, , i, s, , a, , c, o, m, m, e, n, t))</span></code></pre>

Expand Down
14 changes: 7 additions & 7 deletions 5.0/api-guide/debug.html
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ <h2 id="debugging-problematic-parsers-debug" class="section"><a class="anchor-li
| </span><span class="identifier">string</span><span>(</span><span class="string-literal">&quot;hey&quot;</span><span>).</span><span class="identifier">debug</span><span>(</span><span class="string-literal">&quot;hey&quot;</span><span>)
| </span><span class="identifier">string</span><span>(</span><span class="string-literal">&quot;hi&quot;</span><span>).</span><span class="identifier">debug</span><span>(</span><span class="string-literal">&quot;hi&quot;</span><span>)
)
</span><span class="comment">// hello: parsley.Parsley[String] = parsley.Parsley@b9c47a1
</span><span class="comment">// hello: parsley.Parsley[String] = parsley.Parsley@2614f177
</span><span>
</span><span class="identifier">debug</span><span>.</span><span class="identifier">disableColorRendering</span><span>()

Expand Down Expand Up @@ -243,7 +243,7 @@ <h3 id="watching-references" class="section"><a class="anchor-link left" href="#
.</span><span class="identifier">debug</span><span>(</span><span class="string-literal">&quot;rollback&quot;</span><span>, </span><span class="identifier">r1</span><span> -&gt; </span><span class="string-literal">&quot;r1&quot;</span><span>)
}
}
</span><span class="comment">// p: parsley.Parsley[String] = parsley.Parsley@4a032df6
</span><span class="comment">// p: parsley.Parsley[String] = parsley.Parsley@3d84af2c
</span><span>
</span><span class="identifier">p</span><span>.</span><span class="identifier">parse</span><span>(</span><span class="string-literal">&quot;hello world&quot;</span><span>)
</span><span class="comment">// &gt;rollback&gt; (1, 1): hello·
Expand Down Expand Up @@ -297,7 +297,7 @@ <h2 id="debugging-error-messages-debugerror" class="section"><a class="anchor-li
).</span><span class="identifier">debugError</span><span>(</span><span class="string-literal">&quot;many letterOrDigit&quot;</span><span>)
~&gt; </span><span class="identifier">many</span><span>(</span><span class="identifier">char</span><span>(</span><span class="char-literal">&#39;@&#39;</span><span>).</span><span class="identifier">debugError</span><span>(</span><span class="string-literal">&quot;@&quot;</span><span>)).</span><span class="identifier">debugError</span><span>(</span><span class="string-literal">&quot;many @&quot;</span><span>)
~&gt; </span><span class="identifier">char</span><span>(</span><span class="char-literal">&#39;#&#39;</span><span>).</span><span class="identifier">debugError</span><span>(</span><span class="string-literal">&quot;#&quot;</span><span>)) | </span><span class="identifier">char</span><span>(</span><span class="char-literal">&#39;!&#39;</span><span>).</span><span class="identifier">debugError</span><span>(</span><span class="string-literal">&quot;!&quot;</span><span>)
</span><span class="comment">// q: parsley.Parsley[Char] = parsley.Parsley@288c77c4
</span><span class="comment">// q: parsley.Parsley[Char] = parsley.Parsley@7d72e89f
</span><span>
</span><span class="identifier">q</span><span>.</span><span class="identifier">parse</span><span>(</span><span class="string-literal">&quot;$&quot;</span><span>)
</span><span class="comment">// &gt;many letterOrDigit&gt; (offset 0, line 1, col 1): current hints are Set() (valid at offset 0)
Expand Down Expand Up @@ -395,10 +395,10 @@ <h2 id="profiling-parser-profiler" class="section"><a class="anchor-link left" h
</span><span class="identifier">profiler</span><span>.</span><span class="identifier">summary</span><span>()
</span><span class="comment">// name self time num calls average self time
// -----------------------------------------------------------------
// classic string 2976445.5μs 10001 297.614μs
// voided optimised string 937.2μs 10000 0.093μs
// optimised string 7140.8μs 10000 0.714μs
// voided classic string 3586.0μs 10001 0.358μs
// classic string 3109324.8μs 10001 310.901μs
// voided optimised string 916.5μs 10000 0.091μs
// optimised string 10624.8μs 10000 1.062μs
// voided classic string 3472.5μs 10001 0.347μs
// -----------------------------------------------------------------</span></code></pre>
<p>The above example shows that the <code>string</code> combinator is much faster than the &quot;classic&quot; definition
in terms of <code>traverse</code> and <code>char</code> (not even accounting for its improved error messages!). However,
Expand Down
4 changes: 2 additions & 2 deletions 5.0/api-guide/errors/combinator.html
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ <h3 id="the-label-combinator" class="section"><a class="anchor-link left" href="
<pre class="keep-together pdf epub"><code class="nohighlight"><span class="keyword">import</span><span> </span><span class="identifier">parsley</span><span>.</span><span class="identifier">errors</span><span>.</span><span class="identifier">combinator</span><span>.</span><span class="type-name">ErrorMethods</span><span>

</span><span class="keyword">val</span><span> </span><span class="identifier">digit</span><span> = </span><span class="identifier">satisfy</span><span>(</span><span class="identifier">_</span><span>.</span><span class="identifier">isDigit</span><span>).</span><span class="identifier">label</span><span>(</span><span class="string-literal">&quot;digit&quot;</span><span>)
</span><span class="comment">// digit: parsley.Parsley[Char] = parsley.Parsley@1724c330
</span><span class="comment">// digit: parsley.Parsley[Char] = parsley.Parsley@836c36
</span><span class="identifier">digit</span><span>.</span><span class="identifier">parse</span><span>(</span><span class="string-literal">&quot;a&quot;</span><span>)
</span><span class="comment">// res9: parsley.Result[String, Char] = Failure((line 1, column 1):
// unexpected &quot;a&quot;
Expand All @@ -328,7 +328,7 @@ <h3 id="the-label-combinator" class="section"><a class="anchor-link left" href="
error message properly lines up with the point the input was at when it
entered the combinator - otherwise, the label may be inaccurate. For example:</p>
<pre><code class="nohighlight"><span class="keyword">val</span><span> </span><span class="identifier">twoDigits</span><span> = (</span><span class="identifier">digit</span><span> *&gt; </span><span class="identifier">digit</span><span>).</span><span class="identifier">label</span><span>(</span><span class="string-literal">&quot;two digits&quot;</span><span>)
</span><span class="comment">// twoDigits: parsley.Parsley[Char] = parsley.Parsley@323bb961
</span><span class="comment">// twoDigits: parsley.Parsley[Char] = parsley.Parsley@6db5564e
</span><span class="identifier">twoDigits</span><span>.</span><span class="identifier">parse</span><span>(</span><span class="string-literal">&quot;a&quot;</span><span>)
</span><span class="comment">// res10: parsley.Result[String, Char] = Failure((line 1, column 1):
// unexpected &quot;a&quot;
Expand Down
16 changes: 8 additions & 8 deletions 5.0/api-guide/errors/patterns.html
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,10 @@ <h2 id="verified-errors" class="section"><a class="anchor-link left" href="#veri

</span><span class="comment">// assume that a `lexer` is available
</span><span class="keyword">val</span><span> </span><span class="identifier">float</span><span> = </span><span class="identifier">lexer</span><span>.</span><span class="identifier">nonlexeme</span><span>.</span><span class="identifier">floating</span><span>.</span><span class="identifier">decimal</span><span>
</span><span class="comment">// float: parsley.Parsley[BigDecimal] = parsley.Parsley@78591150
</span><span class="comment">// float: parsley.Parsley[BigDecimal] = parsley.Parsley@4cb8746b
</span><span class="keyword">val</span><span> </span><span class="identifier">_noFloat</span><span> =
</span><span class="identifier">float</span><span>.</span><span class="identifier">verifiedExplain</span><span>(</span><span class="string-literal">&quot;floating-point values may not be used as array indices&quot;</span><span>)
</span><span class="comment">// _noFloat: parsley.Parsley[Nothing] = parsley.Parsley@219d6151
</span><span class="comment">// _noFloat: parsley.Parsley[Nothing] = parsley.Parsley@9a1e8f1
</span><span>
</span><span class="identifier">_noFloat</span><span>.</span><span class="identifier">parse</span><span>(</span><span class="string-literal">&quot;hello&quot;</span><span>)
</span><span class="comment">// res0: parsley.Result[String, Nothing] = Failure((line 1, column 1):
Expand All @@ -202,11 +202,11 @@ <h2 id="verified-errors" class="section"><a class="anchor-link left" href="#veri
// ^^^^^)
</span><span>
</span><span class="keyword">val</span><span> </span><span class="identifier">int</span><span> = </span><span class="identifier">lexer</span><span>.</span><span class="identifier">nonlexeme</span><span>.</span><span class="identifier">unsigned</span><span>.</span><span class="identifier">decimal</span><span>
</span><span class="comment">// int: parsley.Parsley[BigInt] = parsley.Parsley@2a71f8a8
</span><span class="comment">// int: parsley.Parsley[BigInt] = parsley.Parsley@2822d614
</span><span class="keyword">val</span><span> </span><span class="identifier">_noPlus</span><span> = (</span><span class="identifier">char</span><span>(</span><span class="char-literal">&#39;+&#39;</span><span>) ~&gt; </span><span class="identifier">int</span><span>).</span><span class="identifier">verifiedFail</span><span> { </span><span class="identifier">n</span><span> =&gt;
</span><span class="type-name">Seq</span><span>(</span><span class="string-literal">s&quot;the number </span><span class="substitution">$n</span><span class="string-literal"> may not be preceeded by </span><span class="escape-sequence">\&quot;</span><span class="string-literal">+</span><span class="escape-sequence">\&quot;</span><span class="string-literal">&quot;</span><span>)
}
</span><span class="comment">// _noPlus: parsley.Parsley[Nothing] = parsley.Parsley@c90825d
</span><span class="comment">// _noPlus: parsley.Parsley[Nothing] = parsley.Parsley@56508214
</span><span class="identifier">_noPlus</span><span>.</span><span class="identifier">parse</span><span>(</span><span class="string-literal">&quot;+10&quot;</span><span>)
</span><span class="comment">// res2: parsley.Result[String, Nothing] = Failure((line 1, column 1):
// the number 10 may not be preceeded by &quot;+&quot;
Expand All @@ -225,7 +225,7 @@ <h2 id="verified-errors" class="section"><a class="anchor-link left" href="#veri
</span><span class="keyword">override</span><span> </span><span class="keyword">def</span><span> </span><span class="declaration-name">adjustWidth</span><span>(</span><span class="identifier">x</span><span>: </span><span class="type-name">BigInt</span><span>, </span><span class="identifier">width</span><span>: </span><span class="type-name">Int</span><span>) = </span><span class="number-literal">1</span><span>
}
}
</span><span class="comment">// _noPlus: parsley.Parsley[Nothing] = parsley.Parsley@77dfb859
</span><span class="comment">// _noPlus: parsley.Parsley[Nothing] = parsley.Parsley@32a714e8
</span><span class="identifier">_noPlus</span><span>.</span><span class="identifier">parse</span><span>(</span><span class="string-literal">&quot;+10&quot;</span><span>)
</span><span class="comment">// res3: parsley.Result[String, Nothing] = Failure((line 1, column 1):
// a number may not be preceeded by &quot;+&quot;
Expand All @@ -244,7 +244,7 @@ <h2 id="verified-errors" class="section"><a class="anchor-link left" href="#veri
}
}
}
</span><span class="comment">// _noFloat: parsley.Parsley[Nothing] = parsley.Parsley@4def8ea9
</span><span class="comment">// _noFloat: parsley.Parsley[Nothing] = parsley.Parsley@15def607
</span><span>
</span><span class="identifier">_noFloat</span><span>.</span><span class="identifier">parse</span><span>(</span><span class="string-literal">&quot;3.142&quot;</span><span>)
</span><span class="comment">// res4: parsley.Result[String, Nothing] = Failure((line 1, column 1):
Expand Down Expand Up @@ -276,11 +276,11 @@ <h2 id="preventative-errors" class="section"><a class="anchor-link left" href="#
<pre><code class="nohighlight"><span class="keyword">import</span><span> </span><span class="identifier">parsley</span><span>.</span><span class="identifier">errors</span><span>.</span><span class="identifier">patterns</span><span>.</span><span class="type-name">PreventativeErrors</span><span>

</span><span class="keyword">val</span><span> </span><span class="identifier">ident</span><span> = </span><span class="identifier">lexer</span><span>.</span><span class="identifier">nonlexeme</span><span>.</span><span class="identifier">names</span><span>.</span><span class="identifier">identifier</span><span>
</span><span class="comment">// ident: parsley.Parsley[String] = parsley.Parsley@2e47af95
</span><span class="comment">// ident: parsley.Parsley[String] = parsley.Parsley@d8c3ddb
</span><span class="keyword">val</span><span> </span><span class="identifier">_noDot</span><span> = (</span><span class="identifier">char</span><span>(</span><span class="char-literal">&#39;.&#39;</span><span>) ~&gt; </span><span class="identifier">ident</span><span>).</span><span class="identifier">preventativeFail</span><span> { </span><span class="identifier">v</span><span> =&gt;
</span><span class="type-name">Seq</span><span>(</span><span class="string-literal">s&quot;accessing field </span><span class="substitution">$v</span><span class="string-literal"> is not permitted here&quot;</span><span>)
}
</span><span class="comment">// _noDot: parsley.Parsley[Unit] = parsley.Parsley@170da4da
</span><span class="comment">// _noDot: parsley.Parsley[Unit] = parsley.Parsley@36ae23d
</span><span class="identifier">_noDot</span><span>.</span><span class="identifier">parse</span><span>(</span><span class="string-literal">&quot;hi&quot;</span><span>)
</span><span class="comment">// res5: parsley.Result[String, Unit] = Success(())
</span><span class="identifier">_noDot</span><span>.</span><span class="identifier">parse</span><span>(</span><span class="string-literal">&quot;.foo&quot;</span><span>)
Expand Down
2 changes: 1 addition & 1 deletion 5.0/api-guide/expr/chain.html
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ <h2 id="binary-chains" class="section"><a class="anchor-link left" href="#binary
<p>The above can be parsed using <code>chain.left1(p)(op)</code> to have the
effect of parsing like:</p>
<blockquote><h3><code>(((p op p) op p) op p) op p</code></h3></blockquote>
<p>It can also be parded using <code>chain.right1(p)(op)</code> to have the
<p>It can also be parsed using <code>chain.right1(p)(op)</code> to have the
effect of parsing like:</p>
<blockquote><h3><code>p op (p op (p op (p op p)))</code></h3></blockquote>
<div class="callout warning">
Expand Down
4 changes: 2 additions & 2 deletions 5.0/api-guide/expr/precedence.html
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ <h3 id="homogeneous-precedence" class="section"><a class="anchor-link left" href
</span><span class="type-name">Ops</span><span>(</span><span class="type-name">InfixL</span><span>)(</span><span class="string-literal">&quot;*&quot;</span><span> </span><span class="identifier">as</span><span> </span><span class="type-name">Mul</span><span>),
</span><span class="type-name">Ops</span><span>(</span><span class="type-name">InfixL</span><span>)(</span><span class="string-literal">&quot;+&quot;</span><span> </span><span class="identifier">as</span><span> </span><span class="type-name">Add</span><span>, </span><span class="string-literal">&quot;-&quot;</span><span> </span><span class="identifier">as</span><span> </span><span class="type-name">Sub</span><span>)
)
</span><span class="comment">// expr: Parsley[Expr] = parsley.Parsley@3d3273b9
</span><span class="comment">// expr: Parsley[Expr] = parsley.Parsley@1f2ce0d8
</span><span>
</span><span class="identifier">expr</span><span>.</span><span class="identifier">parse</span><span>(</span><span class="string-literal">&quot;x+5*y&quot;</span><span>)
</span><span class="comment">// res0: parsley.Result[String, Expr] = Success(Add(Var(x),Mul(Num(5),Var(y))))</span></code></pre>
Expand Down Expand Up @@ -294,7 +294,7 @@ <h3 id="heterogeneous-precedence" class="section"><a class="anchor-link left" hr
</span><span class="type-name">SOps</span><span>(</span><span class="type-name">InfixL</span><span>)(</span><span class="string-literal">&quot;*&quot;</span><span> </span><span class="identifier">as</span><span> </span><span class="type-name">Mul</span><span>) :+
</span><span class="type-name">SOps</span><span>(</span><span class="type-name">InfixL</span><span>)(</span><span class="string-literal">&quot;+&quot;</span><span class="identifier">as</span><span> </span><span class="type-name">Add</span><span>, </span><span class="string-literal">&quot;-&quot;</span><span> </span><span class="identifier">as</span><span> </span><span class="type-name">Sub</span><span>)
}
</span><span class="comment">// expr: Parsley[Expr] = parsley.Parsley@59b483c4
</span><span class="comment">// expr: Parsley[Expr] = parsley.Parsley@7d44af0f
</span><span>
</span><span class="identifier">expr</span><span>.</span><span class="identifier">parse</span><span>(</span><span class="string-literal">&quot;x+5*y&quot;</span><span>)
</span><span class="comment">// res1: parsley.Result[String, Expr] = Success(Add(Var(x),Mul(Num(5),Var(y))))</span></code></pre>
Expand Down
Loading

0 comments on commit 18cc702

Please sign in to comment.