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.lua47
1 files changed, 47 insertions, 0 deletions
diff --git a/examples/typedlua/tlerror.lua b/examples/typedlua/tlerror.lua
new file mode 100644
index 0000000..fe3a72e
--- /dev/null
+++ b/examples/typedlua/tlerror.lua
@@ -0,0 +1,47 @@
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("MissingCP", "missing ')'")
12new_error("MissingCC", "missing '}'")
13new_error("MissingCB", "missing ']'")
14new_error("UnionType", "expecting <type> after '|'")
15new_error("FunctionType", "expecting <type> after '->'")
16new_error("MethodType", "expecting <type> after '=>'")
17new_error("TupleType", "expecting <type> after ','")
18new_error("Type", "expecting <type> after ':'")
19new_error("TypeDecEnd", "missing 'end' in type declaration")
20new_error("TypeAliasName", "expecting <name> after 'typealias'")
21new_error("MissingEqTypeAlias", "missing '=' in 'typealias'")
22new_error("DotIndex", "expecting <name> after '.'")
23new_error("MethodName", "expecting <name> after ':'")
24new_error("Then", "missing 'then'")
25new_error("IfEnd", "missing 'end' to close if statement")
26new_error("WhileDo", "missing 'do' in while statement")
27new_error("WhileEnd", "missing 'end' to close while statement")
28new_error("BlockEnd", "missing 'end' to close block")
29new_error("ForDo", "missing 'do' in for statement")
30new_error("ForEnd", "missing 'end' to close for statement")
31new_error("Until", "missing 'until' in repeat statement")
32new_error("FuncEnd", "missing 'end' to close function declaration")
33new_error("ParList", "expecting '...'")
34new_error("MethodCall", "expecting '(' for method call")
35new_error("Label1", "expecting <name> after '::'")
36new_error("Label2", "expecting '::' to close label declaration")
37new_error("LocalAssign", "expecting expression list after '='")
38
39local labels = {}
40for k, v in ipairs(errors) do
41 labels[v.label] = k
42end
43
44return {
45 errors = errors,
46 labels = labels,
47}