aboutsummaryrefslogtreecommitdiff
path: root/examples/typedlua/tlerror.lua
diff options
context:
space:
mode:
Diffstat (limited to 'examples/typedlua/tlerror.lua')
-rw-r--r--examples/typedlua/tlerror.lua66
1 files changed, 66 insertions, 0 deletions
diff --git a/examples/typedlua/tlerror.lua b/examples/typedlua/tlerror.lua
new file mode 100644
index 0000000..94be024
--- /dev/null
+++ b/examples/typedlua/tlerror.lua
@@ -0,0 +1,66 @@
1
2local errors = {}
3local function new_error (label, msg)
4 table.insert(errors, { label = label, msg = msg })
5end
6
7new_error("Number", "malformed <number>")
8new_error("String", "malformed <string>")
9new_error("LongString", "unfinished long string")
10new_error("LongComment", "unfinished long comment")
11new_error("MissingOP", "missing '('")
12new_error("MissingCP", "missing ')'")
13new_error("MissingCC", "missing '}'")
14new_error("MissingCB", "missing ']'")
15new_error("UnionType", "expecting <type> after '|'")
16new_error("FunctionType", "expecting <type> after '->'")
17new_error("MethodType", "expecting <type> after '=>'")
18new_error("TupleType", "expecting <type> after ','")
19new_error("Type", "expecting <type> after ':'")
20new_error("TypeDecEnd", "missing 'end' in type declaration")
21new_error("TypeAliasName", "expecting <name> after 'typealias'")
22new_error("MissingEqTypeAlias", "missing '=' in 'typealias'")
23new_error("DotIndex", "expecting <name> after '.'")
24new_error("MethodName", "expecting <name> after ':'")
25new_error("Then", "missing 'then'")
26new_error("IfEnd", "missing 'end' to close if statement")
27new_error("WhileDo", "missing 'do' in while statement")
28new_error("WhileEnd", "missing 'end' to close while statement")
29new_error("BlockEnd", "missing 'end' to close block")
30new_error("ForDo", "missing 'do' in for statement")
31new_error("ForEnd", "missing 'end' to close for statement")
32new_error("Until", "missing 'until' in repeat statement")
33new_error("FuncEnd", "missing 'end' to close function declaration")
34new_error("ParList", "expecting '...'")
35new_error("MethodCall", "expecting '(' for method call")
36new_error("Label1", "expecting <name> after '::'")
37new_error("Label2", "expecting '::' to close label declaration")
38new_error("LocalAssign1", "expecting expression list after '='")
39new_error("LocalAssign2", "invalid local declaration")
40new_error("ForGen", "expecting 'in'")
41new_error("LocalFunc", "expecting <name> in local function declaration")
42new_error("RetStat", "invalid statement after 'return'")
43new_error("ElseIf", "expecting <exp> after 'elseif'")
44new_error("SubExpr_1", "malformed 'or' expression")
45new_error("SubExpr_2", "malformed 'and' expression")
46new_error("SubExpr_3", "malformed relational expression")
47new_error("SubExpr_4", "malformed '|' expression")
48new_error("SubExpr_5", "malformed '~' expression")
49new_error("SubExpr_6", "malformed '&' expression")
50new_error("SubExpr_7", "malformed shift expression")
51new_error("SubExpr_8", "malformed '..' expression")
52new_error("SubExpr_9", "malformed addition expression")
53new_error("SubExpr_10", "malformed multiplication expression")
54new_error("SubExpr_11", "malformed unary expression")
55new_error("SubExpr_12", "malformed '^' expression")
56new_error("Stat", "invalid statement")
57
58local labels = {}
59for k, v in ipairs(errors) do
60 labels[v.label] = k
61end
62
63return {
64 errors = errors,
65 labels = labels,
66}