diff options
author | Andre Murbach Maidl <andremm@gmail.com> | 2015-10-07 15:17:08 -0300 |
---|---|---|
committer | Andre Murbach Maidl <andremm@gmail.com> | 2015-10-07 15:17:08 -0300 |
commit | e8e389b9ddebe6ced19d5f4bc112b309ffe1a8ff (patch) | |
tree | ee65e06be5455257282a2c966d1630a9de6cd118 | |
parent | 9f277371cfb63082b04b7432c80b80e0e8fd6ddb (diff) | |
download | lpeglabel-e8e389b9ddebe6ced19d5f4bc112b309ffe1a8ff.tar.gz lpeglabel-e8e389b9ddebe6ced19d5f4bc112b309ffe1a8ff.tar.bz2 lpeglabel-e8e389b9ddebe6ced19d5f4bc112b309ffe1a8ff.zip |
Adding some missing annotations due to MAXLABELS limitation to 32 labels
-rwxr-xr-x | examples/typedlua/test.lua | 8 | ||||
-rw-r--r-- | examples/typedlua/tlerror.lua | 3 | ||||
-rw-r--r-- | examples/typedlua/tlparser.lua | 6 |
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 | |||
1828 | test.lua:1:6: syntax error, unexpected ';', expecting 'in', ',', ':', '=' | 1828 | test.lua:1:6: syntax error, unexpected ';', expecting 'in', ',', ':', '=' |
1829 | ]=] | 1829 | ]=] |
1830 | e = [=[ | 1830 | e = [=[ |
1831 | test.lua:1:6: unexpected ';', expecting 'in', ',', ':', '=' | 1831 | test.lua:1:6: expecting 'in' |
1832 | ]=] | 1832 | ]=] |
1833 | 1833 | ||
1834 | r, m = parse(s) | 1834 | r, m = parse(s) |
@@ -1910,7 +1910,7 @@ function a.b:c:d () end | |||
1910 | test.lua:1:15: syntax error, unexpected ':', expecting '(' | 1910 | test.lua:1:15: syntax error, unexpected ':', expecting '(' |
1911 | ]=] | 1911 | ]=] |
1912 | e = [=[ | 1912 | e = [=[ |
1913 | test.lua:1:15: unexpected ':', expecting '(' | 1913 | test.lua:1:15: missing '(' |
1914 | ]=] | 1914 | ]=] |
1915 | 1915 | ||
1916 | r, m = parse(s) | 1916 | r, m = parse(s) |
@@ -2030,7 +2030,7 @@ local function t.a() end | |||
2030 | test.lua:1:17: syntax error, unexpected '.', expecting '(' | 2030 | test.lua:1:17: syntax error, unexpected '.', expecting '(' |
2031 | ]=] | 2031 | ]=] |
2032 | e = [=[ | 2032 | e = [=[ |
2033 | test.lua:1:17: unexpected '.', expecting '(' | 2033 | test.lua:1:17: missing '(' |
2034 | ]=] | 2034 | ]=] |
2035 | 2035 | ||
2036 | r, m = parse(s) | 2036 | r, m = parse(s) |
@@ -2069,7 +2069,7 @@ local function (a, b, c, ...) end | |||
2069 | test.lua:1:16: syntax error, unexpected '(', expecting 'Name' | 2069 | test.lua:1:16: syntax error, unexpected '(', expecting 'Name' |
2070 | ]=] | 2070 | ]=] |
2071 | e = [=[ | 2071 | e = [=[ |
2072 | test.lua:1:16: unexpected '(', expecting 'Name' | 2072 | test.lua:1:16: expecting <name> in local function declaration |
2073 | ]=] | 2073 | ]=] |
2074 | 2074 | ||
2075 | r, m = parse(s) | 2075 | r, 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>") | |||
8 | new_error("String", "malformed <string>") | 8 | new_error("String", "malformed <string>") |
9 | new_error("LongString", "unfinished long string") | 9 | new_error("LongString", "unfinished long string") |
10 | new_error("LongComment", "unfinished long comment") | 10 | new_error("LongComment", "unfinished long comment") |
11 | new_error("MissingOP", "missing '('") | ||
11 | new_error("MissingCP", "missing ')'") | 12 | new_error("MissingCP", "missing ')'") |
12 | new_error("MissingCC", "missing '}'") | 13 | new_error("MissingCC", "missing '}'") |
13 | new_error("MissingCB", "missing ']'") | 14 | new_error("MissingCB", "missing ']'") |
@@ -35,6 +36,8 @@ new_error("MethodCall", "expecting '(' for method call") | |||
35 | new_error("Label1", "expecting <name> after '::'") | 36 | new_error("Label1", "expecting <name> after '::'") |
36 | new_error("Label2", "expecting '::' to close label declaration") | 37 | new_error("Label2", "expecting '::' to close label declaration") |
37 | new_error("LocalAssign", "expecting expression list after '='") | 38 | new_error("LocalAssign", "expecting expression list after '='") |
39 | new_error("ForGen", "expecting 'in'") | ||
40 | new_error("LocalFunc", "expecting <name> in local function declaration") | ||
38 | 41 | ||
39 | local labels = {} | 42 | local labels = {} |
40 | for k, v in ipairs(errors) do | 43 | for 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") * |