Skip to content

Commit

Permalink
deploy: 768c7e4
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mie6 committed Apr 15, 2024
1 parent c9fb296 commit bace8ba
Show file tree
Hide file tree
Showing 14 changed files with 46 additions and 46 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@62cd4c9
</span><span class="comment">// comment: parsley.Parsley[List[Char]] = parsley.Parsley@7e221678
</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@26344217
</span><span class="comment">// hello: parsley.Parsley[String] = parsley.Parsley@7b8c56f2
</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@51478654
</span><span class="comment">// p: parsley.Parsley[String] = parsley.Parsley@5c7d1943
</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@3a93f256
</span><span class="comment">// q: parsley.Parsley[Char] = parsley.Parsley@160469a6
</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 3412549.2μs 10001 341.220μs
// voided optimised string 1018.3μs 10000 0.101μs
// optimised string 9999.2μs 10000 0.999μs
// voided classic string 3478.9μs 10001 0.347μs
// classic string 3344730.2μs 10001 334.439μs
// voided optimised string 927.8μs 10000 0.092μs
// optimised string 9617.1μs 10000 0.961μs
// voided classic string 3386.0μs 10001 0.338μ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@3731a3c8
</span><span class="comment">// digit: parsley.Parsley[Char] = parsley.Parsley@3dc5367
</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@61980c0c
</span><span class="comment">// twoDigits: parsley.Parsley[Char] = parsley.Parsley@56910917
</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@588bbf81
</span><span class="comment">// float: parsley.Parsley[BigDecimal] = parsley.Parsley@d67ff3b
</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@634cb576
</span><span class="comment">// _noFloat: parsley.Parsley[Nothing] = parsley.Parsley@66bdd22a
</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@40e096b2
</span><span class="comment">// int: parsley.Parsley[BigInt] = parsley.Parsley@378ccfaf
</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@6c386845
</span><span class="comment">// _noPlus: parsley.Parsley[Nothing] = parsley.Parsley@23382e54
</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@15f1d552
</span><span class="comment">// _noPlus: parsley.Parsley[Nothing] = parsley.Parsley@4bbd5747
</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@65ae37c5
</span><span class="comment">// _noFloat: parsley.Parsley[Nothing] = parsley.Parsley@69ab65e7
</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@396586fe
</span><span class="comment">// ident: parsley.Parsley[String] = parsley.Parsley@78e7084e
</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@27047811
</span><span class="comment">// _noDot: parsley.Parsley[Unit] = parsley.Parsley@2d808dde
</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
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@195d14f4
</span><span class="comment">// expr: Parsley[Expr] = parsley.Parsley@1c24b545
</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@6aa33150
</span><span class="comment">// expr: Parsley[Expr] = parsley.Parsley@504d6585
</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 bace8ba

Please sign in to comment.