Skip to content

Commit

Permalink
deploy: f41d13b
Browse files Browse the repository at this point in the history
  • Loading branch information
j-mie6 committed Apr 26, 2024
1 parent 7241270 commit 8e8c16f
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@52e311ab
</span><span class="comment">// comment: parsley.Parsley[List[Char]] = parsley.Parsley@20ee3140
</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@68550327
</span><span class="comment">// hello: parsley.Parsley[String] = parsley.Parsley@41614a86
</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@6113a4c4
</span><span class="comment">// p: parsley.Parsley[String] = parsley.Parsley@71155f45
</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@6f61bfa2
</span><span class="comment">// q: parsley.Parsley[Char] = parsley.Parsley@3da3a679
</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 2832078.5μs 10001 283.179μs
// voided optimised string 852.6μs 10000 0.085μs
// optimised string 8644.4μs 10000 0.864μs
// voided classic string 3398.7μs 10001 0.339μs
// classic string 2892147.5μs 10001 289.185μs
// voided optimised string 595.3μs 10000 0.059μs
// optimised string 9183.2μs 10000 0.918μs
// voided classic string 2576.9μs 10001 0.257μ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@4430c746
</span><span class="comment">// digit: parsley.Parsley[Char] = parsley.Parsley@51f4ed3d
</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@4f7dea29
</span><span class="comment">// twoDigits: parsley.Parsley[Char] = parsley.Parsley@1afb799c
</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@3fcb3c16
</span><span class="comment">// float: parsley.Parsley[BigDecimal] = parsley.Parsley@533f0bc9
</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@4c6501c2
</span><span class="comment">// _noFloat: parsley.Parsley[Nothing] = parsley.Parsley@11dd3fb8
</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@336a68c1
</span><span class="comment">// int: parsley.Parsley[BigInt] = parsley.Parsley@1c443cd4
</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@c573cf
</span><span class="comment">// _noPlus: parsley.Parsley[Nothing] = parsley.Parsley@24ce7ae3
</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@2e088d2a
</span><span class="comment">// _noPlus: parsley.Parsley[Nothing] = parsley.Parsley@469a2946
</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@4c41c19c
</span><span class="comment">// _noFloat: parsley.Parsley[Nothing] = parsley.Parsley@4df64163
</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@574329a2
</span><span class="comment">// ident: parsley.Parsley[String] = parsley.Parsley@5fe1cd50
</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@3396ad7d
</span><span class="comment">// _noDot: parsley.Parsley[Unit] = parsley.Parsley@7ac0560b
</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@5217562a
</span><span class="comment">// expr: Parsley[Expr] = parsley.Parsley@74c87d16
</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@4abcc1c6
</span><span class="comment">// expr: Parsley[Expr] = parsley.Parsley@3da85a8d
</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 8e8c16f

Please sign in to comment.