diff options
-rwxr-xr-x | examples/typedlua/test.lua | 84 | ||||
-rw-r--r-- | examples/typedlua/tlparser.lua | 4 |
2 files changed, 44 insertions, 44 deletions
diff --git a/examples/typedlua/test.lua b/examples/typedlua/test.lua index 4e173b9..ed4e7a1 100755 --- a/examples/typedlua/test.lua +++ b/examples/typedlua/test.lua | |||
@@ -290,7 +290,7 @@ local f = 9e | |||
290 | test.lua:2:1: syntax error, unexpected 'EOF', expecting '=', ',', 'String', '{', '(', ':', '[', '.' | 290 | test.lua:2:1: syntax error, unexpected 'EOF', expecting '=', ',', 'String', '{', '(', ':', '[', '.' |
291 | ]=] | 291 | ]=] |
292 | e = [=[ | 292 | e = [=[ |
293 | test.lua:1:11: malformed <number> | 293 | test.lua:1:12: malformed <number> |
294 | ]=] | 294 | ]=] |
295 | 295 | ||
296 | r, m = parse(s) | 296 | r, m = parse(s) |
@@ -303,7 +303,7 @@ local f = 5.e | |||
303 | test.lua:2:1: syntax error, unexpected 'EOF', expecting '=', ',', 'String', '{', '(', ':', '[', '.' | 303 | test.lua:2:1: syntax error, unexpected 'EOF', expecting '=', ',', 'String', '{', '(', ':', '[', '.' |
304 | ]=] | 304 | ]=] |
305 | e = [=[ | 305 | e = [=[ |
306 | test.lua:1:11: malformed <number> | 306 | test.lua:1:13: malformed <number> |
307 | ]=] | 307 | ]=] |
308 | 308 | ||
309 | r, m = parse(s) | 309 | r, m = parse(s) |
@@ -316,7 +316,7 @@ local f = .9e- | |||
316 | test.lua:1:14: syntax error, unexpected '-', expecting '=', ',', 'String', '{', '(', ':', '[', '.' | 316 | test.lua:1:14: syntax error, unexpected '-', expecting '=', ',', 'String', '{', '(', ':', '[', '.' |
317 | ]=] | 317 | ]=] |
318 | e = [=[ | 318 | e = [=[ |
319 | test.lua:1:11: malformed <number> | 319 | test.lua:1:14: malformed <number> |
320 | ]=] | 320 | ]=] |
321 | 321 | ||
322 | r, m = parse(s) | 322 | r, m = parse(s) |
@@ -329,7 +329,7 @@ local f = 5.9e+ | |||
329 | test.lua:1:15: syntax error, unexpected '+', expecting '=', ',', 'String', '{', '(', ':', '[', '.' | 329 | test.lua:1:15: syntax error, unexpected '+', expecting '=', ',', 'String', '{', '(', ':', '[', '.' |
330 | ]=] | 330 | ]=] |
331 | e = [=[ | 331 | e = [=[ |
332 | test.lua:1:11: malformed <number> | 332 | test.lua:1:15: malformed <number> |
333 | ]=] | 333 | ]=] |
334 | 334 | ||
335 | r, m = parse(s) | 335 | r, m = parse(s) |
@@ -346,7 +346,7 @@ local hex = 0xG | |||
346 | test.lua:4:1: syntax error, unexpected 'EOF', expecting '=', ',', 'String', '{', '(', ':', '[', '.' | 346 | test.lua:4:1: syntax error, unexpected 'EOF', expecting '=', ',', 'String', '{', '(', ':', '[', '.' |
347 | ]=] | 347 | ]=] |
348 | e = [=[ | 348 | e = [=[ |
349 | test.lua:3:13: malformed <number> | 349 | test.lua:3:14: malformed <number> |
350 | ]=] | 350 | ]=] |
351 | 351 | ||
352 | r, m = parse(s) | 352 | r, m = parse(s) |
@@ -373,7 +373,7 @@ long string | |||
373 | test.lua:5:13: syntax error, unexpected '[', expecting '(', 'Name', '{', 'function', '...', 'true', 'false', 'nil', 'String', 'Number', '#', '~', '-', 'not' | 373 | test.lua:5:13: syntax error, unexpected '[', expecting '(', 'Name', '{', 'function', '...', 'true', 'false', 'nil', 'String', 'Number', '#', '~', '-', 'not' |
374 | ]=] | 374 | ]=] |
375 | e = [=[ | 375 | e = [=[ |
376 | test.lua:5:13: unfinished long string | 376 | test.lua:14:1: unfinished long string |
377 | ]=] | 377 | ]=] |
378 | 378 | ||
379 | r, m = parse(s) | 379 | r, m = parse(s) |
@@ -392,7 +392,7 @@ local ss6 = "testing unfinished string | |||
392 | test.lua:3:13: syntax error, unexpected '"', expecting '(', 'Name', '{', 'function', '...', 'true', 'false', 'nil', 'String', 'Number', '#', '~', '-', 'not' | 392 | test.lua:3:13: syntax error, unexpected '"', expecting '(', 'Name', '{', 'function', '...', 'true', 'false', 'nil', 'String', 'Number', '#', '~', '-', 'not' |
393 | ]=] | 393 | ]=] |
394 | e = [=[ | 394 | e = [=[ |
395 | test.lua:3:13: malformed <string> | 395 | test.lua:6:1: malformed <string> |
396 | ]=] | 396 | ]=] |
397 | 397 | ||
398 | r, m = parse(s) | 398 | r, m = parse(s) |
@@ -409,7 +409,7 @@ comment | |||
409 | test.lua:3:1: syntax error, unexpected 'comment', expecting '=', ',', 'String', '{', '(', ':', '[', '.' | 409 | test.lua:3:1: syntax error, unexpected 'comment', expecting '=', ',', 'String', '{', '(', ':', '[', '.' |
410 | ]=] | 410 | ]=] |
411 | e = [=[ | 411 | e = [=[ |
412 | test.lua:4:1: unfinished long comment | 412 | test.lua:1:1: unfinished long comment |
413 | ]=] | 413 | ]=] |
414 | 414 | ||
415 | r, m = parse(s) | 415 | r, m = parse(s) |
@@ -1703,7 +1703,7 @@ a = function (a,b,) end | |||
1703 | test.lua:1:19: syntax error, unexpected ')', expecting '...', 'Name' | 1703 | test.lua:1:19: syntax error, unexpected ')', expecting '...', 'Name' |
1704 | ]=] | 1704 | ]=] |
1705 | e = [=[ | 1705 | e = [=[ |
1706 | test.lua:1:19: expecting '...' | 1706 | test.lua:1:18: expecting '...' |
1707 | ]=] | 1707 | ]=] |
1708 | 1708 | ||
1709 | r, m = parse(s) | 1709 | r, m = parse(s) |
@@ -1716,7 +1716,7 @@ a = function (...,a) end | |||
1716 | test.lua:1:18: syntax error, unexpected ',', expecting ')', ':' | 1716 | test.lua:1:18: syntax error, unexpected ',', expecting ')', ':' |
1717 | ]=] | 1717 | ]=] |
1718 | e = [=[ | 1718 | e = [=[ |
1719 | test.lua:1:18: missing ')' | 1719 | test.lua:1:17: missing ')' |
1720 | ]=] | 1720 | ]=] |
1721 | 1721 | ||
1722 | r, m = parse(s) | 1722 | r, m = parse(s) |
@@ -1729,7 +1729,7 @@ local a = function (1) end | |||
1729 | test.lua:1:21: syntax error, unexpected '1', expecting ')', '...', 'Name' | 1729 | test.lua:1:21: syntax error, unexpected '1', expecting ')', '...', 'Name' |
1730 | ]=] | 1730 | ]=] |
1731 | e = [=[ | 1731 | e = [=[ |
1732 | test.lua:1:21: missing ')' | 1732 | test.lua:1:20: missing ')' |
1733 | ]=] | 1733 | ]=] |
1734 | 1734 | ||
1735 | r, m = parse(s) | 1735 | r, m = parse(s) |
@@ -1757,7 +1757,7 @@ a = 3 / / 2 | |||
1757 | test.lua:1:9: syntax error, unexpected '/', expecting '(', 'Name', '{', 'function', '...', 'true', 'false', 'nil', 'String', 'Number', '#', '~', '-', 'not' | 1757 | test.lua:1:9: syntax error, unexpected '/', expecting '(', 'Name', '{', 'function', '...', 'true', 'false', 'nil', 'String', 'Number', '#', '~', '-', 'not' |
1758 | ]=] | 1758 | ]=] |
1759 | e = [=[ | 1759 | e = [=[ |
1760 | test.lua:1:9: malformed multiplication expression | 1760 | test.lua:1:8: malformed multiplication expression |
1761 | ]=] | 1761 | ]=] |
1762 | 1762 | ||
1763 | r, m = parse(s) | 1763 | r, m = parse(s) |
@@ -1772,7 +1772,7 @@ b = 1 && 1 | |||
1772 | test.lua:1:8: syntax error, unexpected '&', expecting '(', 'Name', '{', 'function', '...', 'true', 'false', 'nil', 'String', 'Number', '#', '~', '-', 'not' | 1772 | test.lua:1:8: syntax error, unexpected '&', expecting '(', 'Name', '{', 'function', '...', 'true', 'false', 'nil', 'String', 'Number', '#', '~', '-', 'not' |
1773 | ]=] | 1773 | ]=] |
1774 | e = [=[ | 1774 | e = [=[ |
1775 | test.lua:1:8: malformed '&' expression | 1775 | test.lua:1:7: malformed '&' expression |
1776 | ]=] | 1776 | ]=] |
1777 | 1777 | ||
1778 | r, m = parse(s) | 1778 | r, m = parse(s) |
@@ -1785,7 +1785,7 @@ b = 1 <> 0 | |||
1785 | test.lua:1:8: syntax error, unexpected '>', expecting '(', 'Name', '{', 'function', '...', 'true', 'false', 'nil', 'String', 'Number', '#', '~', '-', 'not' | 1785 | test.lua:1:8: syntax error, unexpected '>', expecting '(', 'Name', '{', 'function', '...', 'true', 'false', 'nil', 'String', 'Number', '#', '~', '-', 'not' |
1786 | ]=] | 1786 | ]=] |
1787 | e = [=[ | 1787 | e = [=[ |
1788 | test.lua:1:8: malformed relational expression | 1788 | test.lua:1:7: malformed relational expression |
1789 | ]=] | 1789 | ]=] |
1790 | 1790 | ||
1791 | r, m = parse(s) | 1791 | r, m = parse(s) |
@@ -1798,7 +1798,7 @@ b = 1 < < 0 | |||
1798 | test.lua:1:9: syntax error, unexpected '<', expecting '(', 'Name', '{', 'function', '...', 'true', 'false', 'nil', 'String', 'Number', '#', '~', '-', 'not' | 1798 | test.lua:1:9: syntax error, unexpected '<', expecting '(', 'Name', '{', 'function', '...', 'true', 'false', 'nil', 'String', 'Number', '#', '~', '-', 'not' |
1799 | ]=] | 1799 | ]=] |
1800 | e = [=[ | 1800 | e = [=[ |
1801 | test.lua:1:9: malformed relational expression | 1801 | test.lua:1:8: malformed relational expression |
1802 | ]=] | 1802 | ]=] |
1803 | 1803 | ||
1804 | r, m = parse(s) | 1804 | r, m = parse(s) |
@@ -1813,7 +1813,7 @@ concat2 = 2^3..1 | |||
1813 | test.lua:1:15: syntax error, unexpected '.1', expecting 'return', '(', 'Name', 'typealias', 'interface', 'goto', 'break', '::', 'local', 'function', 'const', 'repeat', 'for', 'do', 'while', 'if', ';', ',', 'or', 'and', '>', '<', '>=', '<=', '==', '~=', '|', '~', '&', '>>', '<<', '..', '-', '+', '%', '/', '//', '*', '^' | 1813 | test.lua:1:15: syntax error, unexpected '.1', expecting 'return', '(', 'Name', 'typealias', 'interface', 'goto', 'break', '::', 'local', 'function', 'const', 'repeat', 'for', 'do', 'while', 'if', ';', ',', 'or', 'and', '>', '<', '>=', '<=', '==', '~=', '|', '~', '&', '>>', '<<', '..', '-', '+', '%', '/', '//', '*', '^' |
1814 | ]=] | 1814 | ]=] |
1815 | e = [=[ | 1815 | e = [=[ |
1816 | test.lua:1:13: malformed <number> | 1816 | test.lua:1:14: malformed <number> |
1817 | ]=] | 1817 | ]=] |
1818 | 1818 | ||
1819 | r, m = parse(s) | 1819 | r, m = parse(s) |
@@ -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: expecting 'in' | 1831 | test.lua:1:5: expecting 'in' |
1832 | ]=] | 1832 | ]=] |
1833 | 1833 | ||
1834 | r, m = parse(s) | 1834 | r, m = parse(s) |
@@ -1841,7 +1841,7 @@ for k,v in pairs(t:any) do end | |||
1841 | test.lua:1:23: syntax error, unexpected ')', expecting 'String', '{', '(' | 1841 | test.lua:1:23: syntax error, unexpected ')', expecting 'String', '{', '(' |
1842 | ]=] | 1842 | ]=] |
1843 | e = [=[ | 1843 | e = [=[ |
1844 | test.lua:1:23: expecting '(' for method call | 1844 | test.lua:1:22: expecting '(' for method call |
1845 | ]=] | 1845 | ]=] |
1846 | 1846 | ||
1847 | r, m = parse(s) | 1847 | r, m = parse(s) |
@@ -1856,7 +1856,7 @@ for i=1,10, do end | |||
1856 | test.lua:1:13: syntax error, unexpected 'do', expecting '(', 'Name', '{', 'function', '...', 'true', 'false', 'nil', 'String', 'Number', '#', '~', '-', 'not' | 1856 | test.lua:1:13: syntax error, unexpected 'do', expecting '(', 'Name', '{', 'function', '...', 'true', 'false', 'nil', 'String', 'Number', '#', '~', '-', 'not' |
1857 | ]=] | 1857 | ]=] |
1858 | e = [=[ | 1858 | e = [=[ |
1859 | test.lua:1:13: missing 'do' in for statement | 1859 | test.lua:1:10: missing 'do' in for statement |
1860 | ]=] | 1860 | ]=] |
1861 | 1861 | ||
1862 | r, m = parse(s) | 1862 | r, m = parse(s) |
@@ -1869,7 +1869,7 @@ for i=1,n:number do end | |||
1869 | test.lua:1:18: syntax error, unexpected 'do', expecting 'String', '{', '(' | 1869 | test.lua:1:18: syntax error, unexpected 'do', expecting 'String', '{', '(' |
1870 | ]=] | 1870 | ]=] |
1871 | e = [=[ | 1871 | e = [=[ |
1872 | test.lua:1:18: expecting '(' for method call | 1872 | test.lua:1:17: expecting '(' for method call |
1873 | ]=] | 1873 | ]=] |
1874 | 1874 | ||
1875 | r, m = parse(s) | 1875 | r, m = parse(s) |
@@ -1884,7 +1884,7 @@ function func(a,b,c,) end | |||
1884 | test.lua:1:21: syntax error, unexpected ')', expecting '...', 'Name' | 1884 | test.lua:1:21: syntax error, unexpected ')', expecting '...', 'Name' |
1885 | ]=] | 1885 | ]=] |
1886 | e = [=[ | 1886 | e = [=[ |
1887 | test.lua:1:21: expecting '...' | 1887 | test.lua:1:20: expecting '...' |
1888 | ]=] | 1888 | ]=] |
1889 | 1889 | ||
1890 | r, m = parse(s) | 1890 | r, m = parse(s) |
@@ -1897,7 +1897,7 @@ function func(...,a) end | |||
1897 | test.lua:1:18: syntax error, unexpected ',', expecting ')', ':' | 1897 | test.lua:1:18: syntax error, unexpected ',', expecting ')', ':' |
1898 | ]=] | 1898 | ]=] |
1899 | e = [=[ | 1899 | e = [=[ |
1900 | test.lua:1:18: missing ')' | 1900 | test.lua:1:17: missing ')' |
1901 | ]=] | 1901 | ]=] |
1902 | 1902 | ||
1903 | r, m = parse(s) | 1903 | 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: missing '(' | 1913 | test.lua:1:14: missing '(' |
1914 | ]=] | 1914 | ]=] |
1915 | 1915 | ||
1916 | r, m = parse(s) | 1916 | r, m = parse(s) |
@@ -1986,7 +1986,7 @@ if a:any then else end | |||
1986 | test.lua:1:10: syntax error, unexpected 'then', expecting 'String', '{', '(' | 1986 | test.lua:1:10: syntax error, unexpected 'then', expecting 'String', '{', '(' |
1987 | ]=] | 1987 | ]=] |
1988 | e = [=[ | 1988 | e = [=[ |
1989 | test.lua:1:10: expecting '(' for method call | 1989 | test.lua:1:9: expecting '(' for method call |
1990 | ]=] | 1990 | ]=] |
1991 | 1991 | ||
1992 | r, m = parse(s) | 1992 | r, m = parse(s) |
@@ -2002,7 +2002,7 @@ s = [=[ | |||
2002 | test.lua:2:4: syntax error, unexpected 'not', expecting 'Name' | 2002 | test.lua:2:4: syntax error, unexpected 'not', expecting 'Name' |
2003 | ]=] | 2003 | ]=] |
2004 | e = [=[ | 2004 | e = [=[ |
2005 | test.lua:2:4: expecting <name> after '::' | 2005 | test.lua:2:3: expecting <name> after '::' |
2006 | ]=] | 2006 | ]=] |
2007 | 2007 | ||
2008 | r, m = parse(s) | 2008 | 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: missing '(' | 2033 | test.lua:1:16: missing '(' |
2034 | ]=] | 2034 | ]=] |
2035 | 2035 | ||
2036 | r, m = parse(s) | 2036 | r, m = parse(s) |
@@ -2043,7 +2043,7 @@ local function test (a,) end | |||
2043 | test.lua:1:24: syntax error, unexpected ')', expecting '...', 'Name' | 2043 | test.lua:1:24: syntax error, unexpected ')', expecting '...', 'Name' |
2044 | ]=] | 2044 | ]=] |
2045 | e = [=[ | 2045 | e = [=[ |
2046 | test.lua:1:24: expecting '...' | 2046 | test.lua:1:23: expecting '...' |
2047 | ]=] | 2047 | ]=] |
2048 | 2048 | ||
2049 | r, m = parse(s) | 2049 | r, m = parse(s) |
@@ -2056,7 +2056,7 @@ local function test(...,a) end | |||
2056 | test.lua:1:24: syntax error, unexpected ',', expecting ')', ':' | 2056 | test.lua:1:24: syntax error, unexpected ',', expecting ')', ':' |
2057 | ]=] | 2057 | ]=] |
2058 | e = [=[ | 2058 | e = [=[ |
2059 | test.lua:1:24: missing ')' | 2059 | test.lua:1:23: missing ')' |
2060 | ]=] | 2060 | ]=] |
2061 | 2061 | ||
2062 | r, m = parse(s) | 2062 | 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: expecting <name> in local function declaration | 2072 | test.lua:1:15: expecting <name> in local function declaration |
2073 | ]=] | 2073 | ]=] |
2074 | 2074 | ||
2075 | r, m = parse(s) | 2075 | r, m = parse(s) |
@@ -2121,7 +2121,7 @@ t = { , } | |||
2121 | test.lua:1:7: syntax error, unexpected ',', expecting '}', '(', '{', 'function', '...', 'true', 'false', 'nil', 'String', 'Number', '#', '~', '-', 'not', 'Name', '[', 'const' | 2121 | test.lua:1:7: syntax error, unexpected ',', expecting '}', '(', '{', 'function', '...', 'true', 'false', 'nil', 'String', 'Number', '#', '~', '-', 'not', 'Name', '[', 'const' |
2122 | ]=] | 2122 | ]=] |
2123 | e = [=[ | 2123 | e = [=[ |
2124 | test.lua:1:7: missing '}' | 2124 | test.lua:1:6: missing '}' |
2125 | ]=] | 2125 | ]=] |
2126 | 2126 | ||
2127 | r, m = parse(s) | 2127 | r, m = parse(s) |
@@ -2139,7 +2139,7 @@ end | |||
2139 | test.lua:3:3: syntax error, unexpected 'i', expecting 'do', 'or', 'and', '>', '<', '>=', '<=', '==', '~=', '|', '~', '&', '>>', '<<', '..', '-', '+', '%', '/', '//', '*', '^', 'String', '{', '(', ':', '[', '.' | 2139 | test.lua:3:3: syntax error, unexpected 'i', expecting 'do', 'or', 'and', '>', '<', '>=', '<=', '==', '~=', '|', '~', '&', '>>', '<<', '..', '-', '+', '%', '/', '//', '*', '^', 'String', '{', '(', ':', '[', '.' |
2140 | ]=] | 2140 | ]=] |
2141 | e = [=[ | 2141 | e = [=[ |
2142 | test.lua:3:3: missing 'do' in while statement | 2142 | test.lua:3:2: missing 'do' in while statement |
2143 | ]=] | 2143 | ]=] |
2144 | 2144 | ||
2145 | r, m = parse(s) | 2145 | r, m = parse(s) |
@@ -2154,7 +2154,7 @@ t[x:any] = 1 | |||
2154 | test.lua:1:8: syntax error, unexpected ']', expecting 'String', '{', '(' | 2154 | test.lua:1:8: syntax error, unexpected ']', expecting 'String', '{', '(' |
2155 | ]=] | 2155 | ]=] |
2156 | e = [=[ | 2156 | e = [=[ |
2157 | test.lua:1:8: expecting '(' for method call | 2157 | test.lua:1:7: expecting '(' for method call |
2158 | ]=] | 2158 | ]=] |
2159 | 2159 | ||
2160 | r, m = parse(s) | 2160 | r, m = parse(s) |
@@ -2167,7 +2167,7 @@ x:number, y, z:boolean = 1, nil, true | |||
2167 | test.lua:1:9: syntax error, unexpected ',', expecting 'String', '{', '(' | 2167 | test.lua:1:9: syntax error, unexpected ',', expecting 'String', '{', '(' |
2168 | ]=] | 2168 | ]=] |
2169 | e = [=[ | 2169 | e = [=[ |
2170 | test.lua:1:9: expecting '(' for method call | 2170 | test.lua:1:8: expecting '(' for method call |
2171 | ]=] | 2171 | ]=] |
2172 | 2172 | ||
2173 | r, m = parse(s) | 2173 | r, m = parse(s) |
@@ -2193,7 +2193,7 @@ x = ...:any | |||
2193 | test.lua:1:8: syntax error, unexpected ':', expecting 'return', '(', 'Name', 'typealias', 'interface', 'goto', 'break', '::', 'local', 'function', 'const', 'repeat', 'for', 'do', 'while', 'if', ';', ',', 'or', 'and', '>', '<', '>=', '<=', '==', '~=', '|', '~', '&', '>>', '<<', '..', '-', '+', '%', '/', '//', '*', '^' | 2193 | test.lua:1:8: syntax error, unexpected ':', expecting 'return', '(', 'Name', 'typealias', 'interface', 'goto', 'break', '::', 'local', 'function', 'const', 'repeat', 'for', 'do', 'while', 'if', ';', ',', 'or', 'and', '>', '<', '>=', '<=', '==', '~=', '|', '~', '&', '>>', '<<', '..', '-', '+', '%', '/', '//', '*', '^' |
2194 | ]=] | 2194 | ]=] |
2195 | e = [=[ | 2195 | e = [=[ |
2196 | test.lua:1:8: invalid statement | 2196 | test.lua:1:7: invalid statement |
2197 | ]=] | 2197 | ]=] |
2198 | 2198 | ||
2199 | r, m = parse(s) | 2199 | r, m = parse(s) |
@@ -2206,7 +2206,7 @@ f(x:any) | |||
2206 | test.lua:1:8: syntax error, unexpected ')', expecting 'String', '{', '(' | 2206 | test.lua:1:8: syntax error, unexpected ')', expecting 'String', '{', '(' |
2207 | ]=] | 2207 | ]=] |
2208 | e = [=[ | 2208 | e = [=[ |
2209 | test.lua:1:8: expecting '(' for method call | 2209 | test.lua:1:7: expecting '(' for method call |
2210 | ]=] | 2210 | ]=] |
2211 | 2211 | ||
2212 | r, m = parse(s) | 2212 | r, m = parse(s) |
@@ -2219,7 +2219,7 @@ f(...:any) | |||
2219 | test.lua:1:6: syntax error, unexpected ':', expecting ')', ',', 'or', 'and', '>', '<', '>=', '<=', '==', '~=', '|', '~', '&', '>>', '<<', '..', '-', '+', '%', '/', '//', '*', '^' | 2219 | test.lua:1:6: syntax error, unexpected ':', expecting ')', ',', 'or', 'and', '>', '<', '>=', '<=', '==', '~=', '|', '~', '&', '>>', '<<', '..', '-', '+', '%', '/', '//', '*', '^' |
2220 | ]=] | 2220 | ]=] |
2221 | e = [=[ | 2221 | e = [=[ |
2222 | test.lua:1:6: missing ')' | 2222 | test.lua:1:5: missing ')' |
2223 | ]=] | 2223 | ]=] |
2224 | 2224 | ||
2225 | r, m = parse(s) | 2225 | r, m = parse(s) |
@@ -2232,7 +2232,7 @@ local x:number* | |||
2232 | test.lua:1:15: syntax error, unexpected '*', expecting 'return', '(', 'Name', 'typealias', 'interface', 'goto', 'break', '::', 'local', 'function', 'const', 'repeat', 'for', 'do', 'while', 'if', ';', '=', ',', '?', '|' | 2232 | test.lua:1:15: syntax error, unexpected '*', expecting 'return', '(', 'Name', 'typealias', 'interface', 'goto', 'break', '::', 'local', 'function', 'const', 'repeat', 'for', 'do', 'while', 'if', ';', '=', ',', '?', '|' |
2233 | ]=] | 2233 | ]=] |
2234 | e = [=[ | 2234 | e = [=[ |
2235 | test.lua:1:15: invalid local declaration | 2235 | test.lua:1:6: invalid local declaration |
2236 | ]=] | 2236 | ]=] |
2237 | 2237 | ||
2238 | r, m = parse(s) | 2238 | r, m = parse(s) |
@@ -2258,7 +2258,7 @@ local x:number?|string? | |||
2258 | test.lua:1:16: syntax error, unexpected '|', expecting 'return', '(', 'Name', 'typealias', 'interface', 'goto', 'break', '::', 'local', 'function', 'const', 'repeat', 'for', 'do', 'while', 'if', ';', '=', ',' | 2258 | test.lua:1:16: syntax error, unexpected '|', expecting 'return', '(', 'Name', 'typealias', 'interface', 'goto', 'break', '::', 'local', 'function', 'const', 'repeat', 'for', 'do', 'while', 'if', ';', '=', ',' |
2259 | ]=] | 2259 | ]=] |
2260 | e = [=[ | 2260 | e = [=[ |
2261 | test.lua:1:16: invalid local declaration | 2261 | test.lua:1:6: invalid local declaration |
2262 | ]=] | 2262 | ]=] |
2263 | 2263 | ||
2264 | r, m = parse(s) | 2264 | r, m = parse(s) |
@@ -2271,7 +2271,7 @@ local x:() -> number | |||
2271 | test.lua:1:15: syntax error, unexpected 'number', expecting '(' | 2271 | test.lua:1:15: syntax error, unexpected 'number', expecting '(' |
2272 | ]=] | 2272 | ]=] |
2273 | e = [=[ | 2273 | e = [=[ |
2274 | test.lua:1:15: expecting <type> after '->' | 2274 | test.lua:1:14: expecting <type> after '->' |
2275 | ]=] | 2275 | ]=] |
2276 | 2276 | ||
2277 | r, m = parse(s) | 2277 | r, m = parse(s) |
@@ -2284,7 +2284,7 @@ local x:() -> (number)? | (string)? | |||
2284 | test.lua:1:35: syntax error, unexpected '?', expecting '->' | 2284 | test.lua:1:35: syntax error, unexpected '?', expecting '->' |
2285 | ]=] | 2285 | ]=] |
2286 | e = [=[ | 2286 | e = [=[ |
2287 | test.lua:1:35: expecting <type> after '|' | 2287 | test.lua:1:26: expecting <type> after '|' |
2288 | ]=] | 2288 | ]=] |
2289 | 2289 | ||
2290 | r, m = parse(s) | 2290 | r, m = parse(s) |
@@ -2297,7 +2297,7 @@ local x:{()->():string} | |||
2297 | test.lua:1:16: syntax error, unexpected ':', expecting '}', '?', '|' | 2297 | test.lua:1:16: syntax error, unexpected ':', expecting '}', '?', '|' |
2298 | ]=] | 2298 | ]=] |
2299 | e = [=[ | 2299 | e = [=[ |
2300 | test.lua:1:16: missing '}' | 2300 | test.lua:1:15: missing '}' |
2301 | ]=] | 2301 | ]=] |
2302 | 2302 | ||
2303 | r, m = parse(s) | 2303 | r, m = parse(s) |
@@ -2310,7 +2310,7 @@ local x:{string:t 1} | |||
2310 | test.lua:1:19: syntax error, unexpected '1', expecting '}', '?', '|' | 2310 | test.lua:1:19: syntax error, unexpected '1', expecting '}', '?', '|' |
2311 | ]=] | 2311 | ]=] |
2312 | e = [=[ | 2312 | e = [=[ |
2313 | test.lua:1:19: missing '}' | 2313 | test.lua:1:18: missing '}' |
2314 | ]=] | 2314 | ]=] |
2315 | 2315 | ||
2316 | r, m = parse(s) | 2316 | r, m = parse(s) |
diff --git a/examples/typedlua/tlparser.lua b/examples/typedlua/tlparser.lua index dba94f7..a301fa6 100644 --- a/examples/typedlua/tlparser.lua +++ b/examples/typedlua/tlparser.lua | |||
@@ -226,9 +226,9 @@ end | |||
226 | function tlparser.parse (subject, filename, strict, integer) | 226 | function tlparser.parse (subject, filename, strict, integer) |
227 | local errorinfo = {} | 227 | local errorinfo = {} |
228 | lpeg.setmaxstack(1000) | 228 | lpeg.setmaxstack(1000) |
229 | local ast, label, _ = lpeg.match(G, subject, nil, errorinfo, strict, integer) | 229 | local ast, label, suffix = lpeg.match(G, subject, nil, errorinfo, strict, integer) |
230 | if not ast then | 230 | if not ast then |
231 | local line, col = lineno(subject, errorinfo.ffp) | 231 | local line, col = lineno(subject, string.len(subject) - string.len(suffix)) |
232 | local error_msg = string.format("%s:%d:%d: ", filename, line, col) | 232 | local error_msg = string.format("%s:%d:%d: ", filename, line, col) |
233 | if label ~= 0 then | 233 | if label ~= 0 then |
234 | error_msg = error_msg .. tlerror.errors[label].msg | 234 | error_msg = error_msg .. tlerror.errors[label].msg |