aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Murbach Maidl <andremm@gmail.com>2015-10-07 15:17:08 -0300
committerAndre Murbach Maidl <andremm@gmail.com>2015-10-07 15:17:08 -0300
commite8e389b9ddebe6ced19d5f4bc112b309ffe1a8ff (patch)
treeee65e06be5455257282a2c966d1630a9de6cd118
parent9f277371cfb63082b04b7432c80b80e0e8fd6ddb (diff)
downloadlpeglabel-e8e389b9ddebe6ced19d5f4bc112b309ffe1a8ff.tar.gz
lpeglabel-e8e389b9ddebe6ced19d5f4bc112b309ffe1a8ff.tar.bz2
lpeglabel-e8e389b9ddebe6ced19d5f4bc112b309ffe1a8ff.zip
Adding some missing annotations due to MAXLABELS limitation to 32 labels
-rwxr-xr-xexamples/typedlua/test.lua8
-rw-r--r--examples/typedlua/tlerror.lua3
-rw-r--r--examples/typedlua/tlparser.lua6
3 files changed, 10 insertions, 7 deletions
diff --git a/examples/typedlua/test.lua b/examples/typedlua/test.lua
index 3b99e5c..ffdbd70 100755
--- a/examples/typedlua/test.lua
+++ b/examples/typedlua/test.lua
@@ -1828,7 +1828,7 @@ for k;v in pairs(t) do end
1828test.lua:1:6: syntax error, unexpected ';', expecting 'in', ',', ':', '=' 1828test.lua:1:6: syntax error, unexpected ';', expecting 'in', ',', ':', '='
1829]=] 1829]=]
1830e = [=[ 1830e = [=[
1831test.lua:1:6: unexpected ';', expecting 'in', ',', ':', '=' 1831test.lua:1:6: expecting 'in'
1832]=] 1832]=]
1833 1833
1834r, m = parse(s) 1834r, m = parse(s)
@@ -1910,7 +1910,7 @@ function a.b:c:d () end
1910test.lua:1:15: syntax error, unexpected ':', expecting '(' 1910test.lua:1:15: syntax error, unexpected ':', expecting '('
1911]=] 1911]=]
1912e = [=[ 1912e = [=[
1913test.lua:1:15: unexpected ':', expecting '(' 1913test.lua:1:15: missing '('
1914]=] 1914]=]
1915 1915
1916r, m = parse(s) 1916r, m = parse(s)
@@ -2030,7 +2030,7 @@ local function t.a() end
2030test.lua:1:17: syntax error, unexpected '.', expecting '(' 2030test.lua:1:17: syntax error, unexpected '.', expecting '('
2031]=] 2031]=]
2032e = [=[ 2032e = [=[
2033test.lua:1:17: unexpected '.', expecting '(' 2033test.lua:1:17: missing '('
2034]=] 2034]=]
2035 2035
2036r, m = parse(s) 2036r, m = parse(s)
@@ -2069,7 +2069,7 @@ local function (a, b, c, ...) end
2069test.lua:1:16: syntax error, unexpected '(', expecting 'Name' 2069test.lua:1:16: syntax error, unexpected '(', expecting 'Name'
2070]=] 2070]=]
2071e = [=[ 2071e = [=[
2072test.lua:1:16: unexpected '(', expecting 'Name' 2072test.lua:1:16: expecting <name> in local function declaration
2073]=] 2073]=]
2074 2074
2075r, m = parse(s) 2075r, m = parse(s)
diff --git a/examples/typedlua/tlerror.lua b/examples/typedlua/tlerror.lua
index fe3a72e..6881b6b 100644
--- a/examples/typedlua/tlerror.lua
+++ b/examples/typedlua/tlerror.lua
@@ -8,6 +8,7 @@ new_error("Number", "malformed <number>")
8new_error("String", "malformed <string>") 8new_error("String", "malformed <string>")
9new_error("LongString", "unfinished long string") 9new_error("LongString", "unfinished long string")
10new_error("LongComment", "unfinished long comment") 10new_error("LongComment", "unfinished long comment")
11new_error("MissingOP", "missing '('")
11new_error("MissingCP", "missing ')'") 12new_error("MissingCP", "missing ')'")
12new_error("MissingCC", "missing '}'") 13new_error("MissingCC", "missing '}'")
13new_error("MissingCB", "missing ']'") 14new_error("MissingCB", "missing ']'")
@@ -35,6 +36,8 @@ new_error("MethodCall", "expecting '(' for method call")
35new_error("Label1", "expecting <name> after '::'") 36new_error("Label1", "expecting <name> after '::'")
36new_error("Label2", "expecting '::' to close label declaration") 37new_error("Label2", "expecting '::' to close label declaration")
37new_error("LocalAssign", "expecting expression list after '='") 38new_error("LocalAssign", "expecting expression list after '='")
39new_error("ForGen", "expecting 'in'")
40new_error("LocalFunc", "expecting <name> in local function declaration")
38 41
39local labels = {} 42local labels = {}
40for k, v in ipairs(errors) do 43for k, v in ipairs(errors) do
diff --git a/examples/typedlua/tlparser.lua b/examples/typedlua/tlparser.lua
index c8d03ea..2180812 100644
--- a/examples/typedlua/tlparser.lua
+++ b/examples/typedlua/tlparser.lua
@@ -161,7 +161,7 @@ local G = lpeg.P { "TypedLua";
161 ForNum = lpeg.V("Id") * tllexer.symb("=") * lpeg.V("Expr") * tllexer.symb(",") * 161 ForNum = lpeg.V("Id") * tllexer.symb("=") * lpeg.V("Expr") * tllexer.symb(",") *
162 lpeg.V("Expr") * (tllexer.symb(",") * lpeg.V("Expr"))^-1 * 162 lpeg.V("Expr") * (tllexer.symb(",") * lpeg.V("Expr"))^-1 *
163 lpeg.V("ForBody"); 163 lpeg.V("ForBody");
164 ForGen = lpeg.V("NameList") * tllexer.kw("in") * 164 ForGen = lpeg.V("NameList") * tllexer.try(tllexer.kw("in"), "ForGen") *
165 lpeg.V("ExpList") * lpeg.V("ForBody"); 165 lpeg.V("ExpList") * lpeg.V("ForBody");
166 ForStat = tllexer.kw("for") * (lpeg.V("ForNum") + lpeg.V("ForGen")) * tllexer.try(tllexer.kw("end"), "ForEnd"); 166 ForStat = tllexer.kw("for") * (lpeg.V("ForNum") + lpeg.V("ForGen")) * tllexer.try(tllexer.kw("end"), "ForEnd");
167 RepeatStat = tllexer.kw("repeat") * lpeg.V("Block") * 167 RepeatStat = tllexer.kw("repeat") * lpeg.V("Block") *
@@ -172,13 +172,13 @@ local G = lpeg.P { "TypedLua";
172 ParList = lpeg.V("NameList") * (tllexer.symb(",") * tllexer.try(lpeg.V("TypedVarArg"), "ParList"))^-1 + 172 ParList = lpeg.V("NameList") * (tllexer.symb(",") * tllexer.try(lpeg.V("TypedVarArg"), "ParList"))^-1 +
173 lpeg.V("TypedVarArg"); 173 lpeg.V("TypedVarArg");
174 TypedVarArg = tllexer.symb("...") * (tllexer.symb(":") * tllexer.try(lpeg.V("Type"), "Type"))^-1; 174 TypedVarArg = tllexer.symb("...") * (tllexer.symb(":") * tllexer.try(lpeg.V("Type"), "Type"))^-1;
175 FuncBody = tllexer.symb("(") * lpeg.V("ParList")^-1 * tllexer.try(tllexer.symb(")"), "MissingCP") * 175 FuncBody = tllexer.try(tllexer.symb("("), "MissingOP") * lpeg.V("ParList")^-1 * tllexer.try(tllexer.symb(")"), "MissingCP") *
176 (tllexer.symb(":") * tllexer.try(lpeg.V("RetType"), "Type"))^-1 * 176 (tllexer.symb(":") * tllexer.try(lpeg.V("RetType"), "Type"))^-1 *
177 lpeg.V("Block") * tllexer.try(tllexer.kw("end"), "FuncEnd"); 177 lpeg.V("Block") * tllexer.try(tllexer.kw("end"), "FuncEnd");
178 FuncStat = tllexer.kw("const")^-1 * 178 FuncStat = tllexer.kw("const")^-1 *
179 tllexer.kw("function") * lpeg.V("FuncName") * lpeg.V("FuncBody"); 179 tllexer.kw("function") * lpeg.V("FuncName") * lpeg.V("FuncBody");
180 LocalFunc = tllexer.kw("function") * 180 LocalFunc = tllexer.kw("function") *
181 lpeg.V("Id") * lpeg.V("FuncBody"); 181 tllexer.try(lpeg.V("Id"), "LocalFunc") * lpeg.V("FuncBody");
182 LocalAssign = lpeg.V("NameList") * 182 LocalAssign = lpeg.V("NameList") *
183 ((tllexer.symb("=") * tllexer.try(lpeg.V("ExpList"), "LocalAssign")))^-1; 183 ((tllexer.symb("=") * tllexer.try(lpeg.V("ExpList"), "LocalAssign")))^-1;
184 LocalStat = tllexer.kw("local") * 184 LocalStat = tllexer.kw("local") *