Skip to content
← Back

src/syntax/process/strictvisitor.ghul

1
namespace Syntax is
2
use System.NotImplementedException;
3
4
use IO.Std;
5
6
use Trees;
7
8
class StrictVisitor: Visitor abstract is
9
init() is
10
super.init();
11
si
12
13
throw_not_implemented(name: string, node: Node) =>
14
throw NotImplementedException(
15
"Visitor {self} does not define a visit method for {name} {node.get_type()} and/or this node does not accept this visitor"
16
);
17
18
visit(node: Node) => throw NotImplementedException("Visitor itself is missing a matching method for {node.get_type()}");
19
20
visit(identifier: Identifiers.Identifier) => throw_not_implemented("identifier", identifier);
21
22
visit(identifier: Identifiers.QUALIFIED) => throw_not_implemented("qualified identifier", identifier);
23
24
visit(modifier: Modifiers.Modifier) => throw_not_implemented("modifier", modifier);
25
26
visit(modifiers: Modifiers.LIST) => throw_not_implemented("modifiers", modifiers);
27
28
visit(definition: Definitions.Definition) => throw_not_implemented("definition", definition);
29
30
visit(definitions: Definitions.LIST) => throw_not_implemented("definition list", definitions);
31
32
visit(`namespace: Definitions.NAMESPACE) => throw_not_implemented("namespace", `namespace);
33
34
visit(`use: Definitions.USE) => throw_not_implemented("use", `use);
35
36
visit(super_call: Definitions.SUPER_CALL) => throw_not_implemented("super call", super_call);
37
38
visit(`class: Definitions.CLASS) => throw_not_implemented("class", `class);
39
40
visit(`trait: Definitions.TRAIT) => throw_not_implemented("trait", `trait);
41
42
visit(`struct: Definitions.STRUCT) => throw_not_implemented("struct", `struct);
43
44
visit(`partial: Definitions.PARTIAL) => throw_not_implemented("partial", `partial);
45
46
visit(`impl: Definitions.IMPL) => throw_not_implemented("impl", `impl);
47
48
visit(`union: Definitions.UNION) => throw_not_implemented("union", `union);
49
50
visit(variant: Definitions.VARIANT) => throw_not_implemented("variant", variant);
51
52
visit(`enum: Definitions.ENUM) => throw_not_implemented("enum", `enum);
53
54
visit(enum_member: Definitions.ENUM_MEMBER) => throw_not_implemented("enum member", enum_member);
55
56
visit(function: Definitions.FUNCTION) => throw_not_implemented("function", function);
57
58
visit(property: Definitions.PROPERTY) => throw_not_implemented("property", property);
59
60
visit(indexer: Definitions.INDEXER) => throw_not_implemented("indexer", indexer);
61
62
visit(variable: Variables.VARIABLE) => throw_not_implemented("variable", variable);
63
64
visit(variables: Variables.LIST) => throw_not_implemented("variable list", variables);
65
66
visit(destructure_element: Trees.Variables.SIMPLE_VARIABLE_LEFT) => throw_not_implemented("simple variable name", destructure_element);
67
68
visit(destructure_element_list: Trees.Variables.DESTRUCTURING_VARIABLE_LEFT) => throw_not_implemented("destructure variable names", destructure_element_list);
69
70
visit(literal_leaf: Trees.Variables.LITERAL_VARIABLE_LEFT) => throw_not_implemented("literal leaf in destructure", literal_leaf);
71
72
visit(type_expression: TypeExpressions.TypeExpression) => throw_not_implemented("type_expression", type_expression);
73
74
visit(type_expression: TypeExpressions.INFER) => throw_not_implemented("infer", type_expression);
75
76
visit(structured: TypeExpressions.Structured) => throw_not_implemented("structured", structured);
77
78
visit(array: TypeExpressions.ARRAY_) => throw_not_implemented("array", array);
79
80
visit(pointer: TypeExpressions.POINTER) => throw_not_implemented("pointer", pointer);
81
82
visit(optional: TypeExpressions.OPTIONAL) => throw_not_implemented("optional", optional);
83
84
visit(reference: TypeExpressions.REFERENCE) => throw_not_implemented("reference", reference);
85
86
visit(member: TypeExpressions.MEMBER) => throw_not_implemented("member", member);
87
88
visit(named: TypeExpressions.NAMED) => throw_not_implemented("named", named);
89
90
visit(types: TypeExpressions.LIST) => throw_not_implemented("type_expression list", types);
91
92
visit(generic: TypeExpressions.GENERIC) => throw_not_implemented("generic", generic);
93
94
visit(function: TypeExpressions.FUNCTION) => throw_not_implemented("function", function);
95
96
visit(tuple: TypeExpressions.TUPLE) => throw_not_implemented("tuple", tuple);
97
98
visit(element: TypeExpressions.NAMED_TUPLE_ELEMENT) => throw_not_implemented("name tuple element", element);
99
100
visit(element: TypeExpressions.UNDEFINED) => throw_not_implemented("???", element);
101
102
visit(constraint: TypeExpressions.TYPE_PARAMETER_CONSTRAINT) => throw_not_implemented("type parameter constraint", constraint);
103
104
visit(expression: Expressions.Expression) => throw_not_implemented("expression", expression);
105
106
visit(identifier: Expressions.IDENTIFIER) => throw_not_implemented("identifier", identifier);
107
108
visit(literal: Expressions.Literals.Literal) => throw_not_implemented("literal", literal);
109
110
visit(`string: Expressions.Literals.STRING) => throw_not_implemented("string literal", `string);
111
112
visit(interpolation: Expressions.STRING_INTERPOLATION) => throw_not_implemented("string interpolation", interpolation);
113
114
visit(integer: Expressions.Literals.INTEGER) => throw_not_implemented("integer literal", integer);
115
116
visit(float: Expressions.Literals.FLOAT) => throw_not_implemented("float literal", float);
117
118
visit(character: Expressions.Literals.CHARACTER) => throw_not_implemented("character literal", character);
119
120
visit(boolean: Expressions.Literals.BOOLEAN) => throw_not_implemented("boolean literal", boolean);
121
122
visit(variable: Expressions.VARIABLE) => throw_not_implemented("variable", variable);
123
124
visit(variable: Expressions.TUPLE_ELEMENT) => throw_not_implemented("tuple element", variable);
125
126
visit(none: Expressions.Literals.NONE) => throw_not_implemented("none", none);
127
128
visit(`null: Expressions.NULL) => throw_not_implemented("null", `null);
129
130
visit(`self: Expressions.SELF) => throw_not_implemented("self", `self);
131
132
visit(`super: Expressions.SUPER) => throw_not_implemented("super", `super);
133
134
visit(`new: Expressions.NEW) => throw_not_implemented("new", `new);
135
136
visit(`cast: Expressions.CAST) => throw_not_implemented("cast", `cast);
137
138
visit(`await: Expressions.AWAIT) => throw_not_implemented("await", `await);
139
140
visit(spill: Expressions.SPILL) => throw_not_implemented("spill", spill);
141
142
visit(`isa: Expressions.ISA) => throw_not_implemented("isa", `isa);
143
144
visit(`isa: Expressions.TYPEOF) => throw_not_implemented("isa", `isa);
145
146
visit(`default: Expressions.DEFAULT) => throw_not_implemented("default", `default);
147
148
visit(function: Syntax.Trees.Expressions.FUNCTION) => throw_not_implemented("function", function);
149
150
visit(recurse: Expressions.RECURSE) => throw_not_implemented("rec", recurse);
151
152
visit(tuple: Expressions.TUPLE) => throw_not_implemented("tuple", tuple);
153
154
visit(sequence: Expressions.SEQUENCE) => throw_not_implemented("sequence", sequence);
155
156
visit(list: Expressions.LIST) => throw_not_implemented("list", list);
157
158
visit(call: Expressions.CALL) => throw_not_implemented("call", call);
159
160
visit(member: Expressions.MEMBER) => throw_not_implemented("member", member);
161
162
visit(specialization: Expressions.EXPLICIT_SPECIALIZATION) => throw_not_implemented("explicit specialization", specialization);
163
164
visit(ambiguous_expression: Expressions.AMBIGUOUS_EXPRESSION) => throw_not_implemented("type expression", ambiguous_expression);
165
166
visit(generic_application: Expressions.GENERIC_APPLICATION) => throw_not_implemented("type expression", generic_application);
167
168
visit(index: Expressions.INDEX) => throw_not_implemented("index", index);
169
170
visit(has_value: Expressions.HAS_VALUE) => throw_not_implemented("has value", has_value);
171
172
visit(unwrap: Expressions.UNWRAP) => throw_not_implemented("unwrap", unwrap);
173
174
visit(reference: Expressions.REFERENCE) => throw_not_implemented("reference", reference);
175
176
visit(unary: Expressions.UNARY) => throw_not_implemented("unary", unary);
177
178
visit(binary: Expressions.BINARY) => throw_not_implemented("binary", binary);
179
180
pre(statement: Expressions.STATEMENT) -> bool is
181
throw_not_implemented("statement expression", statement);
182
return false;
183
si
184
185
visit(statement: Expressions.STATEMENT) => throw_not_implemented("statement expression", statement);
186
187
visit(left: Trees.Expressions.SIMPLE_LEFT_EXPRESSION) => throw_not_implemented("single expression left", left);
188
189
visit(destructure_left: Trees.Expressions.DESTRUCTURING_LEFT_EXPRESSION) => throw_not_implemented("destructure left", destructure_left);
190
191
visit(statement: Expressions.LET_IN) => throw_not_implemented("let in", statement);
192
193
pre(block: Expressions.VAL_BLOCK) -> bool is
194
throw_not_implemented("val block", block);
195
return false;
196
si
197
198
visit(block: Expressions.VAL_BLOCK) => throw_not_implemented("val block", block);
199
200
visit(assert_in: Expressions.ASSERT_IN) => throw_not_implemented("assert in", assert_in);
201
202
visit(statement: Statements.Statement) => throw_not_implemented("statement", statement);
203
204
visit(statements: Statements.LIST) => throw_not_implemented("statement list", statements);
205
206
visit(l: Statements.LET) => throw_not_implemented("let", l);
207
208
visit(assign: Statements.ASSIGNMENT) => throw_not_implemented("assignment", assign);
209
210
visit(expression: Statements.EXPRESSION) => throw_not_implemented("expression", expression);
211
212
visit(`return: Statements.RETURN) => throw_not_implemented("return", `return);
213
214
visit(`throw: Statements.THROW) => throw_not_implemented("throw", `throw);
215
216
visit(`yield: Statements.YIELD) => throw_not_implemented("yield", `yield);
217
218
visit(`assert: Statements.ASSERT) => throw_not_implemented("assert", `assert);
219
220
visit(`if: Statements.IF) => throw_not_implemented("if", `if);
221
222
visit(rb: Statements.REFUTABLE_BINDING) => throw_not_implemented("refutable binding", rb);
223
224
visit(`case: Statements.CASE) => throw_not_implemented("case", `case);
225
226
visit(case_match: Statements.CASE_MATCH) => throw_not_implemented("case match", case_match);
227
228
visit(`try: Statements.TRY) => throw_not_implemented("try", `try);
229
230
visit(`catch: Statements.CATCH) => throw_not_implemented("catch", `catch);
231
232
visit(`do: Statements.DO) => throw_not_implemented("do", `do);
233
234
visit(`for: Statements.FOR) => throw_not_implemented("for", `for);
235
236
visit(labelled: Statements.LABELLED) => throw_not_implemented("labelled", labelled);
237
238
visit(`break: Statements.BREAK) => throw_not_implemented("break", `break);
239
240
visit(`continue: Statements.CONTINUE) => throw_not_implemented("continue", `continue);
241
242
visit(body: Bodies.Body) => throw_not_implemented("body", body);
243
244
visit(expression: Bodies.EXPRESSION) => throw_not_implemented("expression body", expression);
245
246
visit(block: Bodies.BLOCK) => throw_not_implemented("block body", block);
247
si
248
si