aboutsummaryrefslogtreecommitdiff
path: root/lpeglabel.html
diff options
context:
space:
mode:
Diffstat (limited to 'lpeglabel.html')
-rw-r--r--lpeglabel.html47
1 files changed, 28 insertions, 19 deletions
diff --git a/lpeglabel.html b/lpeglabel.html
index 30e6636..59e744a 100644
--- a/lpeglabel.html
+++ b/lpeglabel.html
@@ -61,30 +61,27 @@ with the standard patterns of LPeg.
61<p> 61<p>
62This document describes the new functions available 62This document describes the new functions available
63in LpegLabel and presents some examples of usage. 63in LpegLabel and presents some examples of usage.
64For a more detailed and formal discussion about 64In LPegLabel, the result of an unsuccessful matching
65PEGs with labels please see 65is a triple <code>nil, lab, sfail</code>, where <code>lab</code>
66<a href="http://www.inf.puc-rio.br/~roberto/docs/sblp2013-1.pdf"> 66is the label associated with the failure, and
67Exception Handling for Error Reporting in Parsing Expression Grammars 67<code>sfail</code> is the suffix input where
68</a> 68the label was thrown.
69and
70<a href="http://arxiv.org/abs/1405.6646">Error Reporting in Parsing Expression Grammars</a>.
71</p> 69</p>
72 70
73
74<p> 71<p>
75Below there is a brief summary of the new functions 72Below there is a brief summary of the new functions
76provided by LpegLabel: 73provided by LpegLabel:
77</p> 74</p>
78<table border="1"> 75<table border="1">
79<tbody><tr><td><b>Function</b></td><td><b>Description</b></td></tr> 76<tbody><tr><td><b>Function</b></td><td><b>Description</b></td></tr>
80<tr><td><a href="#f-t"><code>lpeglabel.T (l<sub>1</sub>, ..., l<sub>n</sub>)</code></a></td> 77<tr><td><a href="#f-t"><code>lpeglabel.T (l)</code></a></td>
81 <td>Throws labels <code>l<sub>1</sub>, ..., l<sub>n</sub></code></td></tr> 78 <td>Throws label <code>l</code></td></tr>
82<tr><td><a href="#f-lc"><code>lpeglabel.Lc (p1, p2, l<sub>1</sub>, ..., l<sub>n</sub>)</code></a></td> 79<tr><td><a href="#f-lc"><code>lpeglabel.Lc (p1, p2, l<sub>1</sub>, ..., l<sub>n</sub>)</code></a></td>
83 <td>Matches <code>p1</code> and tries to match <code>p2</code> 80 <td>Matches <code>p1</code> and tries to match <code>p2</code>
84 if the matching of <code>p1</code> gives one of l<sub>1</sub>, ..., l<sub>n</sub> 81 if the matching of <code>p1</code> gives one of l<sub>1</sub>, ..., l<sub>n</sub>
85 </td></tr> 82 </td></tr>
86<tr><td><a href="#re-t"><code>%{l<sub>1</sub>, ..., l<sub>n</sub>}</code></a></td> 83<tr><td><a href="#re-t"><code>%{l}</code></a></td>
87 <td>Syntax of <em>relabel</em> module. Equivalent to <code>lpeg.T(l<sub>1</sub>, ..., l<sub>n</sub>)</code> 84 <td>Syntax of <em>relabel</em> module. Equivalent to <code>lpeg.T(l)</code>
88 </td></tr> 85 </td></tr>
89<tr><td><a href="#re-lc"><code>p1 /{l<sub>1</sub>, ..., l<sub>n</sub>} p2</code></a></td> 86<tr><td><a href="#re-lc"><code>p1 /{l<sub>1</sub>, ..., l<sub>n</sub>} p2</code></a></td>
90 <td>Syntax of <em>relabel</em> module. Equivalent to <code>lpeg.Lc(p1, p2, l<sub>1</sub>, ..., l<sub>n</sub>)</code> 87 <td>Syntax of <em>relabel</em> module. Equivalent to <code>lpeg.Lc(p1, p2, l<sub>1</sub>, ..., l<sub>n</sub>)</code>
@@ -95,18 +92,30 @@ provided by LpegLabel:
95</tbody></table> 92</tbody></table>
96 93
97<p> 94<p>
98In case of an unsucessful matching, the <em>match</em> function now returns 95For a more detailed and formal discussion about
96PEGs with labels please see
97<a href="http://www.inf.puc-rio.br/~roberto/docs/sblp2013-1.pdf">
98Exception Handling for Error Reporting in Parsing Expression Grammars</a>,
99<a href="http://arxiv.org/abs/1405.6646">Error Reporting in Parsing Expression Grammars</a>,
100and <a href="http://dx.doi.org/10.1145/2851613.2851750">
101A parsing machine for parsing expression grammars with labeled failures</a>.
102</p>
103
104<!--
105<p>
106In case of an unsucessful matching, the <em>match</em> function returns
99<code>nil</code> plus a list of labels. These labels may be used to build 107<code>nil</code> plus a list of labels. These labels may be used to build
100a good error message. 108a good error message.
101</p> 109</p>
110-->
102 111
103<h2><a name="func">Functions</a></h2> 112<h2><a name="func">Functions</a></h2>
104 113
105 114
106<h3><a name="f-t"></a><code>lpeglabel.T(l<sub>1</sub>, ..., l<sub>n</sub>)</code></h3> 115<h3><a name="f-t"></a><code>lpeglabel.T(l)</code></h3>
107<p> 116<p>
108Returns a pattern that throws the list of labels <code>l<sub>1</sub>, ..., l<sub>n</sub></code>. 117Returns a pattern that throws the label <code>l</code>.
109A label must be an integer between <code>0</code> and <code>31</code>. 118A label must be an integer between <code>0</code> and <code>63</code>.
110 119
111The label <code>0</code> is equivalent to the regular failure of PEGs. 120The label <code>0</code> is equivalent to the regular failure of PEGs.
112 121
@@ -131,9 +140,9 @@ labeled ordered choice pattern.
131</p> 140</p>
132 141
133 142
134<h3><a name="re-t"></a><code>%{l<sub>1</sub>, ..., l<sub>n</sub>}</code></h3> 143<h3><a name="re-t"></a><code>%{l}</code></h3>
135<p> 144<p>
136Syntax of <em>relabel</em> module. Equivalent to <code>lpeg.T(l<sub>1</sub>, ..., l<sub>n</sub>)</code>. 145Syntax of <em>relabel</em> module. Equivalent to <code>lpeg.T(l)</code>.
137</p> 146</p>
138 147
139 148
@@ -157,7 +166,7 @@ of <code>relabel</code> module will not recognize a pattern as
157<h3><a name="re-setl"></a><code>relabel.setlabels (tlabel)</code></h3> 166<h3><a name="re-setl"></a><code>relabel.setlabels (tlabel)</code></h3>
158 167
159<p>Allows to specicify a table with labels. They keys of 168<p>Allows to specicify a table with labels. They keys of
160<code>tlabel</code> must be integers between <code>0</code> and <code>31</code>, 169<code>tlabel</code> must be integers between <code>0</code> and <code>63</code>,
161and the associated values should be strings. 170and the associated values should be strings.
162</p> 171</p>
163 172