aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergio Queiroz <sqmedeiros@gmail.com>2016-12-16 11:45:46 -0300
committerSergio Queiroz <sqmedeiros@gmail.com>2016-12-16 11:45:46 -0300
commit1968c31ba622b8b5770b0b3fb0973d9e797959f1 (patch)
tree1f2086bf2a815b1657d7a72d36dc75de767b0e8b
parentbbc6ec52e9ba1a030bbb503708fa2f3010efd983 (diff)
downloadlpeglabel-1968c31ba622b8b5770b0b3fb0973d9e797959f1.tar.gz
lpeglabel-1968c31ba622b8b5770b0b3fb0973d9e797959f1.tar.bz2
lpeglabel-1968c31ba622b8b5770b0b3fb0973d9e797959f1.zip
Renaming "lpeglabelrec" to "lpeglabel", and "relabelrec" to "relabel"
-rw-r--r--README.md48
-rw-r--r--examples/expRec.lua4
-rw-r--r--examples/expRecAut.lua4
-rw-r--r--examples/listId1.lua4
-rw-r--r--examples/listId2.lua4
-rw-r--r--examples/listId2Rec2.lua4
-rw-r--r--examples/listId2Rec2Cap.lua4
-rw-r--r--examples/listIdRe1.lua2
-rw-r--r--examples/listIdRe2.lua2
-rw-r--r--examples/tiny.lua2
-rw-r--r--examples/typedlua/tllexer.lua2
-rw-r--r--examples/typedlua/tlparser.lua2
-rw-r--r--lptree.c4
-rw-r--r--makefile14
-rw-r--r--relabel.lua2
-rwxr-xr-xtest.lua4
-rw-r--r--testlabel.lua4
-rw-r--r--testrelabelparser.lua2
18 files changed, 56 insertions, 56 deletions
diff --git a/README.md b/README.md
index 9bc162d..5deec35 100644
--- a/README.md
+++ b/README.md
@@ -35,21 +35,21 @@ Below there is a brief summary of the new functions provided by LpegLabel:
35 35
36<table border="1"> 36<table border="1">
37<tbody><tr><td><b>Function</b></td><td><b>Description</b></td></tr> 37<tbody><tr><td><b>Function</b></td><td><b>Description</b></td></tr>
38<tr><td><a href="#f-t"><code>lpeglabelrec.T (l)</code></a></td> 38<tr><td><a href="#f-t"><code>lpeglabel.T (l)</code></a></td>
39 <td>Throws a label <code>l</code> to signal an error</td></tr> 39 <td>Throws a label <code>l</code> to signal an error</td></tr>
40<tr><td><a href="#f-rec"><code>lpeglabelrec.Rec (p1, p2, l1 [, l2, ..., ln])</code></a></td> 40<tr><td><a href="#f-rec"><code>lpeglabel.Rec (p1, p2, l1 [, l2, ..., ln])</code></a></td>
41 <td>Specifies a recovery pattern <code>p2</code> for <code>p1</code>, 41 <td>Specifies a recovery pattern <code>p2</code> for <code>p1</code>,
42 when the matching of <code>p1</code> gives one of the labels l1, ..., ln.</td></tr> 42 when the matching of <code>p1</code> gives one of the labels l1, ..., ln.</td></tr>
43<tr><td><a href="#re-t"><code>%{l}</code></a></td> 43<tr><td><a href="#re-t"><code>%{l}</code></a></td>
44 <td>Syntax of <em>relabelrec</em> module. Equivalent to <code>lpeglabelrec.T(l)</code> 44 <td>Syntax of <em>relabel</em> module. Equivalent to <code>lpeglabel.T(l)</code>
45 </td></tr> 45 </td></tr>
46<tr><td><a href="#re-rec"><code>p1 //{l1 [, l2, ..., ln} p2</code></a></td> 46<tr><td><a href="#re-rec"><code>p1 //{l1 [, l2, ..., ln} p2</code></a></td>
47 <td>Syntax of <em>relabelrec</em> module. Equivalent to <code>lpeglabelrec.Rec(p1, p2, l1, ..., ln)</code> 47 <td>Syntax of <em>relabel</em> module. Equivalent to <code>lpeglabel.Rec(p1, p2, l1, ..., ln)</code>
48 </td></tr> 48 </td></tr>
49<tr><td><a href="#re-line"><code>relabelrec.calcline(subject, i)</code></a></td> 49<tr><td><a href="#re-line"><code>relabel.calcline(subject, i)</code></a></td>
50 <td>Calculates line and column information regarding position <i>i</i> of the subject</code> 50 <td>Calculates line and column information regarding position <i>i</i> of the subject</code>
51 </td></tr> 51 </td></tr>
52<tr><td><a href="#re-setl"><code>relabelrec.setlabels (tlabel)</code></a></td> 52<tr><td><a href="#re-setl"><code>relabel.setlabels (tlabel)</code></a></td>
53 <td>Allows to specicify a table with mnemonic labels. 53 <td>Allows to specicify a table with mnemonic labels.
54 </td></tr> 54 </td></tr>
55</tbody></table> 55</tbody></table>
@@ -58,14 +58,14 @@ Below there is a brief summary of the new functions provided by LpegLabel:
58### Functions 58### Functions
59 59
60 60
61#### <a name="f-t"></a><code>lpeglabelrec.T(l)</code> 61#### <a name="f-t"></a><code>lpeglabel.T(l)</code>
62 62
63 63
64Returns a pattern that throws the label `l`. 64Returns a pattern that throws the label `l`.
65A label must be an integer between 1 and 255. 65A label must be an integer between 1 and 255.
66 66
67 67
68#### <a name="f-rec"></a><code>lpeglabelrec.Rec(p1, p2, l1, ..., ln)</code> 68#### <a name="f-rec"></a><code>lpeglabel.Rec(p1, p2, l1, ..., ln)</code>
69 69
70Returns a *recovery pattern*. 70Returns a *recovery pattern*.
71If the matching of `p1` gives one of the labels `l1, ..., ln`, 71If the matching of `p1` gives one of the labels `l1, ..., ln`,
@@ -76,23 +76,23 @@ Otherwise, the result of the matching of `p1` is the pattern's result.
76 76
77#### <a name="re-t"></a><code>%{l}</code> 77#### <a name="re-t"></a><code>%{l}</code>
78 78
79Syntax of *relabelrec* module. Equivalent to `lpeg.T(l)`. 79Syntax of *relabel* module. Equivalent to `lpeg.T(l)`.
80 80
81 81
82#### <a name="re-lc"></a><code>p1 //{l1, ..., ln} p2</code> 82#### <a name="re-lc"></a><code>p1 //{l1, ..., ln} p2</code>
83 83
84Syntax of *relabelrec* module. Equivalent to `lpeglabelrec.Rec(p1, p2, l1, ..., ln)`. 84Syntax of *relabel* module. Equivalent to `lpeglabel.Rec(p1, p2, l1, ..., ln)`.
85 85
86The `//{}` operator is left-associative. 86The `//{}` operator is left-associative.
87 87
88 88
89 89
90#### <a name="re-line"></a><code>relabelrec.calcline (subject, i)</code> 90#### <a name="re-line"></a><code>relabel.calcline (subject, i)</code>
91 91
92Returns line and column information regarding position <i>i</i> of the subject. 92Returns line and column information regarding position <i>i</i> of the subject.
93 93
94 94
95#### <a name="re-setl"></a><code>relabelrec.setlabels (tlabel)</code> 95#### <a name="re-setl"></a><code>relabel.setlabels (tlabel)</code>
96 96
97Allows to specicify a table with labels. They keys of 97Allows to specicify a table with labels. They keys of
98`tlabel` must be integers between 1 and 255, 98`tlabel` must be integers between 1 and 255,
@@ -118,8 +118,8 @@ table and to return the index associated with each error message.
118 118
119 119
120```lua 120```lua
121local m = require'lpeglabelrec' 121local m = require'lpeglabel'
122local re = require'relabelrec' 122local re = require'relabel'
123 123
124local terror = {} 124local terror = {}
125 125
@@ -176,7 +176,7 @@ the <em>regular</em> matching. For example, in the example below
176we expect to match rule `A`, but when a failure occur the label 42 176we expect to match rule `A`, but when a failure occur the label 42
177is thrown and then we will try to match the recovery pattern `recp`: 177is thrown and then we will try to match the recovery pattern `recp`:
178```lua 178```lua
179local m = require'lpeglabelrec' 179local m = require'lpeglabel'
180 180
181local recp = m.P"oast" 181local recp = m.P"oast"
182 182
@@ -223,8 +223,8 @@ When the matching of an identifier fails, a defaul value ('NONE')
223is provided. 223is provided.
224 224
225```lua 225```lua
226local m = require'lpeglabelrec' 226local m = require'lpeglabel'
227local re = require'relabelrec' 227local re = require'relabel'
228 228
229local terror = {} 229local terror = {}
230 230
@@ -311,14 +311,14 @@ print(mymatch(grec, "one\n two123, \nthree,"))
311-- Error at line 3 (col 6): expecting an identifier 311-- Error at line 3 (col 6): expecting an identifier
312``` 312```
313 313
314##### *relabelrec* syntax 314##### *relabel* syntax
315 315
316Below we describe again a grammar that matches a list of identifiers, 316Below we describe again a grammar that matches a list of identifiers,
317now using the syntax supported by *relabelrec*, where `//{}` is the 317now using the syntax supported by *relabel*, where `//{}` is the
318recovery operator, and `%{}` is the throw operator: 318recovery operator, and `%{}` is the throw operator:
319 319
320```lua 320```lua
321local re = require 'relabelrec' 321local re = require 'relabel'
322 322
323local errinfo = { 323local errinfo = {
324 {"errUndef", "undefined"}, 324 {"errUndef", "undefined"},
@@ -428,8 +428,8 @@ task to build manually the recovery grammar `grec`. In the next example
428we will show how to build the recovery grammar in a more automatic way. 428we will show how to build the recovery grammar in a more automatic way.
429 429
430```lua 430```lua
431local m = require"lpeglabelrec" 431local m = require"lpeglabel"
432local re = require"relabelrec" 432local re = require"relabel"
433 433
434local labels = { 434local labels = {
435 {"ExpTermFirst", "expected an expression"}, 435 {"ExpTermFirst", "expected an expression"},
@@ -566,8 +566,8 @@ In the example below we also throw an error when the grammar
566does not match the whole subject. 566does not match the whole subject.
567 567
568```lua 568```lua
569local m = require"lpeglabelrec" 569local m = require"lpeglabel"
570local re = require"relabelrec" 570local re = require"relabel"
571 571
572local num = m.R("09")^1 / tonumber 572local num = m.R("09")^1 / tonumber
573local op = m.S("+-") 573local op = m.S("+-")
diff --git a/examples/expRec.lua b/examples/expRec.lua
index 5c5fd7d..52bd40a 100644
--- a/examples/expRec.lua
+++ b/examples/expRec.lua
@@ -1,5 +1,5 @@
1local m = require"lpeglabelrec" 1local m = require"lpeglabel"
2local re = require"relabelrec" 2local re = require"relabel"
3 3
4local labels = { 4local labels = {
5 {"ExpTermFirst", "expected an expression"}, 5 {"ExpTermFirst", "expected an expression"},
diff --git a/examples/expRecAut.lua b/examples/expRecAut.lua
index f870d73..b8280a7 100644
--- a/examples/expRecAut.lua
+++ b/examples/expRecAut.lua
@@ -1,5 +1,5 @@
1local m = require"lpeglabelrec" 1local m = require"lpeglabel"
2local re = require"relabelrec" 2local re = require"relabel"
3 3
4local num = m.R("09")^1 / tonumber 4local num = m.R("09")^1 / tonumber
5local op = m.S("+-") 5local op = m.S("+-")
diff --git a/examples/listId1.lua b/examples/listId1.lua
index dee46e9..b7943c1 100644
--- a/examples/listId1.lua
+++ b/examples/listId1.lua
@@ -1,5 +1,5 @@
1local m = require'lpeglabelrec' 1local m = require'lpeglabel'
2local re = require'relabelrec' 2local re = require'relabel'
3 3
4local id = m.R'az'^1 4local id = m.R'az'^1
5 5
diff --git a/examples/listId2.lua b/examples/listId2.lua
index 46f0063..3ee89da 100644
--- a/examples/listId2.lua
+++ b/examples/listId2.lua
@@ -1,5 +1,5 @@
1local m = require'lpeglabelrec' 1local m = require'lpeglabel'
2local re = require'relabelrec' 2local re = require'relabel'
3 3
4local terror = {} 4local terror = {}
5 5
diff --git a/examples/listId2Rec2.lua b/examples/listId2Rec2.lua
index c6705dd..3506095 100644
--- a/examples/listId2Rec2.lua
+++ b/examples/listId2Rec2.lua
@@ -1,5 +1,5 @@
1local m = require'lpeglabelrec' 1local m = require'lpeglabel'
2local re = require'relabelrec' 2local re = require'relabel'
3 3
4local terror = {} 4local terror = {}
5 5
diff --git a/examples/listId2Rec2Cap.lua b/examples/listId2Rec2Cap.lua
index 1c22c88..32a4113 100644
--- a/examples/listId2Rec2Cap.lua
+++ b/examples/listId2Rec2Cap.lua
@@ -1,5 +1,5 @@
1local m = require'lpeglabelrec' 1local m = require'lpeglabel'
2local re = require'relabelrec' 2local re = require'relabel'
3 3
4local terror = {} 4local terror = {}
5 5
diff --git a/examples/listIdRe1.lua b/examples/listIdRe1.lua
index 3988a3b..3098c66 100644
--- a/examples/listIdRe1.lua
+++ b/examples/listIdRe1.lua
@@ -1,4 +1,4 @@
1local re = require 'relabelrec' 1local re = require 'relabel'
2 2
3local g = re.compile[[ 3local g = re.compile[[
4 S <- Id List 4 S <- Id List
diff --git a/examples/listIdRe2.lua b/examples/listIdRe2.lua
index 6bab6ba..58ddedd 100644
--- a/examples/listIdRe2.lua
+++ b/examples/listIdRe2.lua
@@ -1,4 +1,4 @@
1local re = require 'relabelrec' 1local re = require 'relabel'
2 2
3local errinfo = { 3local errinfo = {
4 {"errUndef", "undefined"}, 4 {"errUndef", "undefined"},
diff --git a/examples/tiny.lua b/examples/tiny.lua
index 784e031..734536c 100644
--- a/examples/tiny.lua
+++ b/examples/tiny.lua
@@ -1,4 +1,4 @@
1local re = require 'relabelrec' 1local re = require 'relabel'
2 2
3local terror = {} 3local terror = {}
4 4
diff --git a/examples/typedlua/tllexer.lua b/examples/typedlua/tllexer.lua
index d6033ec..96f296d 100644
--- a/examples/typedlua/tllexer.lua
+++ b/examples/typedlua/tllexer.lua
@@ -1,6 +1,6 @@
1local tllexer = {} 1local tllexer = {}
2 2
3local lpeg = require "lpeglabelrec" 3local lpeg = require "lpeglabel"
4lpeg.locale(lpeg) 4lpeg.locale(lpeg)
5 5
6local tlerror = require "tlerror" 6local tlerror = require "tlerror"
diff --git a/examples/typedlua/tlparser.lua b/examples/typedlua/tlparser.lua
index fe4fd5e..a301fa6 100644
--- a/examples/typedlua/tlparser.lua
+++ b/examples/typedlua/tlparser.lua
@@ -1,6 +1,6 @@
1local tlparser = {} 1local tlparser = {}
2 2
3local lpeg = require "lpeglabelrec" 3local lpeg = require "lpeglabel"
4lpeg.locale(lpeg) 4lpeg.locale(lpeg)
5 5
6local tllexer = require "tllexer" 6local tllexer = require "tllexer"
diff --git a/lptree.c b/lptree.c
index e15198e..6633035 100644
--- a/lptree.c
+++ b/lptree.c
@@ -1348,8 +1348,8 @@ static struct luaL_Reg metareg[] = {
1348}; 1348};
1349 1349
1350 1350
1351int luaopen_lpeglabelrec (lua_State *L); /* labeled failure */ 1351int luaopen_lpeglabel (lua_State *L); /* labeled failure */
1352int luaopen_lpeglabelrec (lua_State *L) { /* labeled failure */ 1352int luaopen_lpeglabel (lua_State *L) { /* labeled failure */
1353 luaL_newmetatable(L, PATTERN_T); 1353 luaL_newmetatable(L, PATTERN_T);
1354 lua_pushnumber(L, MAXBACK); /* initialize maximum backtracking */ 1354 lua_pushnumber(L, MAXBACK); /* initialize maximum backtracking */
1355 lua_setfield(L, LUA_REGISTRYINDEX, MAXSTACKIDX); 1355 lua_setfield(L, LUA_REGISTRYINDEX, MAXSTACKIDX);
diff --git a/makefile b/makefile
index 414651e..5728b38 100644
--- a/makefile
+++ b/makefile
@@ -1,4 +1,4 @@
1LIBNAME = lpeglabelrec 1LIBNAME = lpeglabel
2LUADIR = ../lua/ 2LUADIR = ../lua/
3 3
4COPT = -O2 4COPT = -O2
@@ -29,24 +29,24 @@ FILES = lpvm.o lpcap.o lptree.o lpcode.o lpprint.o
29 29
30# For Linux 30# For Linux
31linux: 31linux:
32 make lpeglabelrec.so "DLLFLAGS = -shared -fPIC" 32 make lpeglabel.so "DLLFLAGS = -shared -fPIC"
33 33
34# For Mac OS 34# For Mac OS
35macosx: 35macosx:
36 make lpeglabelrec.so "DLLFLAGS = -bundle -undefined dynamic_lookup" 36 make lpeglabel.so "DLLFLAGS = -bundle -undefined dynamic_lookup"
37 37
38lpeglabelrec.so: $(FILES) 38lpeglabel.so: $(FILES)
39 env $(CC) $(DLLFLAGS) $(FILES) -o lpeglabelrec.so 39 env $(CC) $(DLLFLAGS) $(FILES) -o lpeglabel.so
40 40
41$(FILES): makefile 41$(FILES): makefile
42 42
43test: test.lua testlabel.lua testerrors.lua relabel.lua lpeglabelrec.so 43test: test.lua testlabel.lua testerrors.lua relabel.lua lpeglabel.so
44 lua test.lua 44 lua test.lua
45 lua testlabel.lua 45 lua testlabel.lua
46 lua testerrors.lua 46 lua testerrors.lua
47 47
48clean: 48clean:
49 rm -f $(FILES) lpeglabelrec.so 49 rm -f $(FILES) lpeglabel.so
50 50
51 51
52lpcap.o: lpcap.c lpcap.h lptypes.h 52lpcap.o: lpcap.c lpcap.h lptypes.h
diff --git a/relabel.lua b/relabel.lua
index af1a440..cf76e89 100644
--- a/relabel.lua
+++ b/relabel.lua
@@ -6,7 +6,7 @@ local pcall = pcall
6local setmetatable = setmetatable 6local setmetatable = setmetatable
7local unpack, tinsert, concat = table.unpack or unpack, table.insert, table.concat 7local unpack, tinsert, concat = table.unpack or unpack, table.insert, table.concat
8local rep = string.rep 8local rep = string.rep
9local m = require"lpeglabelrec" 9local m = require"lpeglabel"
10 10
11-- 'm' will be used to parse expressions, and 'mm' will be used to 11-- 'm' will be used to parse expressions, and 'mm' will be used to
12-- create expressions; that is, 're' runs on 'm', creating patterns 12-- create expressions; that is, 're' runs on 'm', creating patterns
diff --git a/test.lua b/test.lua
index 18ab20f..d5922ac 100755
--- a/test.lua
+++ b/test.lua
@@ -4,7 +4,7 @@
4 4
5-- require"strict" -- just to be pedantic 5-- require"strict" -- just to be pedantic
6 6
7local m = require"lpeglabelrec" 7local m = require"lpeglabel"
8 8
9 9
10-- for general use 10-- for general use
@@ -1110,7 +1110,7 @@ checkeq(t, {'a', 'aa', 20, 'a', 'aaa', 'aaa'})
1110-- Tests for 're' module 1110-- Tests for 're' module
1111------------------------------------------------------------------- 1111-------------------------------------------------------------------
1112 1112
1113local re = require "relabelrec" 1113local re = require "relabel"
1114 1114
1115local match, compile = re.match, re.compile 1115local match, compile = re.match, re.compile
1116 1116
diff --git a/testlabel.lua b/testlabel.lua
index d9bac64..9fcdcfc 100644
--- a/testlabel.lua
+++ b/testlabel.lua
@@ -1,4 +1,4 @@
1local m = require 'lpeglabelrec' 1local m = require 'lpeglabel'
2 2
3local p, r, l, s, serror 3local p, r, l, s, serror
4 4
@@ -363,7 +363,7 @@ assert(r == nil and l == 5 and serror == s)
363print("+") 363print("+")
364 364
365 365
366local re = require 'relabelrec' 366local re = require 'relabel'
367 367
368g = re.compile[['a' //{4,9} [a-z] 368g = re.compile[['a' //{4,9} [a-z]
369]] 369]]
diff --git a/testrelabelparser.lua b/testrelabelparser.lua
index 3f3ad41..5a43621 100644
--- a/testrelabelparser.lua
+++ b/testrelabelparser.lua
@@ -1,4 +1,4 @@
1local re = require 'relabelrec' 1local re = require 'relabel'
2 2
3function testerror(repatt, msg) 3function testerror(repatt, msg)
4 msg = msg:match("^%s*(.-)%s*$") -- trim 4 msg = msg:match("^%s*(.-)%s*$") -- trim