diff options
Diffstat (limited to 'MoonParser/moon_ast.h')
-rw-r--r-- | MoonParser/moon_ast.h | 581 |
1 files changed, 0 insertions, 581 deletions
diff --git a/MoonParser/moon_ast.h b/MoonParser/moon_ast.h deleted file mode 100644 index a77fb40..0000000 --- a/MoonParser/moon_ast.h +++ /dev/null | |||
@@ -1,581 +0,0 @@ | |||
1 | #pragma once | ||
2 | |||
3 | #include "moon_parser.h" | ||
4 | |||
5 | namespace MoonP { | ||
6 | |||
7 | #define AST_LEAF(type, id) \ | ||
8 | extern rule type; \ | ||
9 | class type##_t : public ast_node \ | ||
10 | { \ | ||
11 | public: \ | ||
12 | virtual int get_type() override { return ast_type<type##_t>(); } \ | ||
13 | virtual size_t getId() const override { return id; } \ | ||
14 | virtual const char* getName() const override { return #type; } | ||
15 | |||
16 | #define AST_NODE(type, id) \ | ||
17 | extern rule type; \ | ||
18 | class type##_t : public ast_container \ | ||
19 | { \ | ||
20 | public: \ | ||
21 | virtual int get_type() override { return ast_type<type##_t>(); } \ | ||
22 | virtual size_t getId() const override { return id; } \ | ||
23 | virtual const char* getName() const override { return #type; } | ||
24 | |||
25 | #define AST_MEMBER(type, ...) \ | ||
26 | type##_t() { \ | ||
27 | add_members({__VA_ARGS__}); \ | ||
28 | } | ||
29 | |||
30 | #define AST_END(type) \ | ||
31 | }; | ||
32 | |||
33 | AST_LEAF(Num, "Num"_id) | ||
34 | AST_END(Num) | ||
35 | |||
36 | AST_LEAF(Name, "Name"_id) | ||
37 | AST_END(Name) | ||
38 | |||
39 | AST_NODE(Variable, "Variable"_id) | ||
40 | ast_ptr<true, Name_t> name; | ||
41 | AST_MEMBER(Variable, &name) | ||
42 | AST_END(Variable) | ||
43 | |||
44 | AST_NODE(LuaKeyword, "LuaKeyword"_id) | ||
45 | ast_ptr<true, Name_t> name; | ||
46 | AST_MEMBER(LuaKeyword, &name) | ||
47 | AST_END(LuaKeyword) | ||
48 | |||
49 | AST_LEAF(self, "self"_id) | ||
50 | AST_END(self) | ||
51 | |||
52 | AST_NODE(self_name, "self_name"_id) | ||
53 | ast_ptr<true, Name_t> name; | ||
54 | AST_MEMBER(self_name, &name) | ||
55 | AST_END(self_name) | ||
56 | |||
57 | AST_LEAF(self_class, "self_class"_id) | ||
58 | AST_END(self_class) | ||
59 | |||
60 | AST_NODE(self_class_name, "self_class_name"_id) | ||
61 | ast_ptr<true, Name_t> name; | ||
62 | AST_MEMBER(self_class_name, &name) | ||
63 | AST_END(self_class_name) | ||
64 | |||
65 | AST_NODE(SelfName, "SelfName"_id) | ||
66 | ast_sel<true, self_class_name_t, self_class_t, self_name_t, self_t> name; | ||
67 | AST_MEMBER(SelfName, &name) | ||
68 | AST_END(SelfName) | ||
69 | |||
70 | AST_NODE(KeyName, "KeyName"_id) | ||
71 | ast_sel<true, SelfName_t, Name_t> name; | ||
72 | AST_MEMBER(KeyName, &name) | ||
73 | AST_END(KeyName) | ||
74 | |||
75 | AST_LEAF(VarArg, "VarArg"_id) | ||
76 | AST_END(VarArg) | ||
77 | |||
78 | AST_LEAF(local_flag, "local_flag"_id) | ||
79 | AST_END(local_flag) | ||
80 | |||
81 | AST_LEAF(Seperator, "Seperator"_id) | ||
82 | AST_END(Seperator) | ||
83 | |||
84 | AST_NODE(NameList, "NameList"_id) | ||
85 | ast_ptr<true, Seperator_t> sep; | ||
86 | ast_list<true, Variable_t> names; | ||
87 | AST_MEMBER(NameList, &sep, &names) | ||
88 | AST_END(NameList) | ||
89 | |||
90 | AST_NODE(Local, "Local"_id) | ||
91 | ast_sel<true, local_flag_t, NameList_t> name; | ||
92 | std::list<std::string> forceDecls; | ||
93 | std::list<std::string> decls; | ||
94 | AST_MEMBER(Local, &name) | ||
95 | AST_END(Local) | ||
96 | |||
97 | AST_NODE(colon_import_name, "colon_import_name"_id) | ||
98 | ast_ptr<true, Variable_t> name; | ||
99 | AST_MEMBER(colon_import_name, &name) | ||
100 | AST_END(colon_import_name) | ||
101 | |||
102 | class Exp_t; | ||
103 | |||
104 | AST_NODE(Import, "Import"_id) | ||
105 | ast_ptr<true, Seperator_t> sep; | ||
106 | ast_sel_list<true, colon_import_name_t, Variable_t> names; | ||
107 | ast_ptr<true, Exp_t> exp; | ||
108 | AST_MEMBER(Import, &sep, &names, &exp) | ||
109 | AST_END(Import) | ||
110 | |||
111 | AST_NODE(ExpListLow, "ExpListLow"_id) | ||
112 | ast_ptr<true, Seperator_t> sep; | ||
113 | ast_list<true, Exp_t> exprs; | ||
114 | AST_MEMBER(ExpListLow, &sep, &exprs) | ||
115 | AST_END(ExpListLow) | ||
116 | |||
117 | AST_NODE(ExpList, "ExpList"_id) | ||
118 | ast_ptr<true, Seperator_t> sep; | ||
119 | ast_list<true, Exp_t> exprs; | ||
120 | AST_MEMBER(ExpList, &sep, &exprs) | ||
121 | AST_END(ExpList) | ||
122 | |||
123 | AST_NODE(Return, "Return"_id) | ||
124 | ast_ptr<false, ExpListLow_t> valueList; | ||
125 | AST_MEMBER(Return, &valueList) | ||
126 | AST_END(Return) | ||
127 | |||
128 | class Assign_t; | ||
129 | class Body_t; | ||
130 | |||
131 | AST_NODE(With, "With"_id) | ||
132 | ast_ptr<true, ExpList_t> valueList; | ||
133 | ast_ptr<false, Assign_t> assigns; | ||
134 | ast_ptr<true, Body_t> body; | ||
135 | AST_MEMBER(With, &valueList, &assigns, &body) | ||
136 | AST_END(With) | ||
137 | |||
138 | AST_NODE(SwitchCase, "SwitchCase"_id) | ||
139 | ast_ptr<true, ExpList_t> valueList; | ||
140 | ast_ptr<true, Body_t> body; | ||
141 | AST_MEMBER(SwitchCase, &valueList, &body) | ||
142 | AST_END(SwitchCase) | ||
143 | |||
144 | AST_NODE(Switch, "Switch"_id) | ||
145 | ast_ptr<true, Exp_t> target; | ||
146 | ast_ptr<true, Seperator_t> sep; | ||
147 | ast_list<true, SwitchCase_t> branches; | ||
148 | ast_ptr<false, Body_t> lastBranch; | ||
149 | AST_MEMBER(Switch, &target, &sep, &branches, &lastBranch) | ||
150 | AST_END(Switch) | ||
151 | |||
152 | AST_NODE(IfCond, "IfCond"_id) | ||
153 | ast_ptr<true, Exp_t> condition; | ||
154 | ast_ptr<false, Assign_t> assign; | ||
155 | AST_MEMBER(IfCond, &condition, &assign) | ||
156 | AST_END(IfCond) | ||
157 | |||
158 | AST_NODE(If, "If"_id) | ||
159 | ast_ptr<true, Seperator_t> sep; | ||
160 | ast_sel_list<true, IfCond_t, Body_t> nodes; | ||
161 | AST_MEMBER(If, &sep, &nodes) | ||
162 | AST_END(If) | ||
163 | |||
164 | AST_NODE(Unless, "Unless"_id) | ||
165 | ast_ptr<true, Seperator_t> sep; | ||
166 | ast_sel_list<true, IfCond_t, Body_t> nodes; | ||
167 | AST_MEMBER(Unless, &sep, &nodes) | ||
168 | AST_END(Unless) | ||
169 | |||
170 | AST_NODE(While, "While"_id) | ||
171 | ast_ptr<true, Exp_t> condition; | ||
172 | ast_ptr<true, Body_t> body; | ||
173 | AST_MEMBER(While, &condition, &body) | ||
174 | AST_END(While) | ||
175 | |||
176 | AST_NODE(for_step_value, "for_step_value"_id) | ||
177 | ast_ptr<true, Exp_t> value; | ||
178 | AST_MEMBER(for_step_value, &value) | ||
179 | AST_END(for_step_value) | ||
180 | |||
181 | AST_NODE(For, "For"_id) | ||
182 | ast_ptr<true, Variable_t> varName; | ||
183 | ast_ptr<true, Exp_t> startValue; | ||
184 | ast_ptr<true, Exp_t> stopValue; | ||
185 | ast_ptr<false, for_step_value_t> stepValue; | ||
186 | ast_ptr<true, Body_t> body; | ||
187 | AST_MEMBER(For, &varName, &startValue, &stopValue, &stepValue, &body) | ||
188 | AST_END(For) | ||
189 | |||
190 | class AssignableNameList_t; | ||
191 | class star_exp_t; | ||
192 | |||
193 | AST_NODE(ForEach, "ForEach"_id) | ||
194 | ast_ptr<true, AssignableNameList_t> nameList; | ||
195 | ast_sel<true, star_exp_t, ExpList_t> loopValue; | ||
196 | ast_ptr<true, Body_t> body; | ||
197 | AST_MEMBER(ForEach, &nameList, &loopValue, &body) | ||
198 | AST_END(ForEach) | ||
199 | |||
200 | AST_NODE(Do, "Do"_id) | ||
201 | ast_ptr<true, Body_t> body; | ||
202 | AST_MEMBER(Do, &body) | ||
203 | AST_END(Do) | ||
204 | |||
205 | class CompInner_t; | ||
206 | class Statement_t; | ||
207 | |||
208 | AST_NODE(Comprehension, "Comprehension"_id) | ||
209 | ast_sel<true, Exp_t, Statement_t> value; | ||
210 | ast_ptr<true, CompInner_t> forLoop; | ||
211 | AST_MEMBER(Comprehension, &value, &forLoop) | ||
212 | AST_END(Comprehension) | ||
213 | |||
214 | AST_NODE(comp_value, "comp_value"_id) | ||
215 | ast_ptr<true, Exp_t> value; | ||
216 | AST_MEMBER(comp_value, &value) | ||
217 | AST_END(comp_value) | ||
218 | |||
219 | AST_NODE(TblComprehension, "TblComprehension"_id) | ||
220 | ast_ptr<true, Exp_t> key; | ||
221 | ast_ptr<false, comp_value_t> value; | ||
222 | ast_ptr<true, CompInner_t> forLoop; | ||
223 | AST_MEMBER(TblComprehension, &key, &value, &forLoop) | ||
224 | AST_END(TblComprehension) | ||
225 | |||
226 | AST_NODE(star_exp, "star_exp"_id) | ||
227 | ast_ptr<true, Exp_t> value; | ||
228 | AST_MEMBER(star_exp, &value) | ||
229 | AST_END(star_exp) | ||
230 | |||
231 | AST_NODE(CompForEach, "CompForEach"_id) | ||
232 | ast_ptr<true, AssignableNameList_t> nameList; | ||
233 | ast_sel<true, star_exp_t, Exp_t> loopValue; | ||
234 | AST_MEMBER(CompForEach, &nameList, &loopValue) | ||
235 | AST_END(CompForEach) | ||
236 | |||
237 | AST_NODE(CompFor, "CompFor"_id) | ||
238 | ast_ptr<true, Variable_t> varName; | ||
239 | ast_ptr<true, Exp_t> startValue; | ||
240 | ast_ptr<true, Exp_t> stopValue; | ||
241 | ast_ptr<false, for_step_value_t> stepValue; | ||
242 | AST_MEMBER(CompFor, &varName, &startValue, &stopValue, &stepValue) | ||
243 | AST_END(CompFor) | ||
244 | |||
245 | AST_NODE(CompInner, "CompInner"_id) | ||
246 | ast_ptr<true, Seperator_t> sep; | ||
247 | ast_sel_list<true, CompFor_t, CompForEach_t, Exp_t> items; | ||
248 | AST_MEMBER(CompInner, &sep, &items) | ||
249 | AST_END(CompInner) | ||
250 | |||
251 | class TableBlock_t; | ||
252 | |||
253 | AST_NODE(Assign, "Assign"_id) | ||
254 | ast_ptr<true, Seperator_t> sep; | ||
255 | ast_sel_list<true, With_t, If_t, Switch_t, TableBlock_t, Exp_t> values; | ||
256 | AST_MEMBER(Assign, &sep, &values) | ||
257 | AST_END(Assign) | ||
258 | |||
259 | AST_LEAF(update_op, "update_op"_id) | ||
260 | AST_END(update_op) | ||
261 | |||
262 | AST_NODE(Update, "Update"_id) | ||
263 | ast_ptr<true, update_op_t> op; | ||
264 | ast_ptr<true, Exp_t> value; | ||
265 | AST_MEMBER(Update, &op, &value) | ||
266 | AST_END(Update) | ||
267 | |||
268 | AST_LEAF(BinaryOperator, "BinaryOperator"_id) | ||
269 | AST_END(BinaryOperator) | ||
270 | |||
271 | class AssignableChain_t; | ||
272 | |||
273 | AST_NODE(Assignable, "Assignable"_id) | ||
274 | ast_sel<true, AssignableChain_t, Variable_t, SelfName_t> item; | ||
275 | AST_MEMBER(Assignable, &item) | ||
276 | AST_END(Assignable) | ||
277 | |||
278 | class Value_t; | ||
279 | |||
280 | AST_NODE(exp_op_value, "exp_op_value"_id) | ||
281 | ast_ptr<true, BinaryOperator_t> op; | ||
282 | ast_ptr<true, Value_t> value; | ||
283 | AST_MEMBER(exp_op_value, &op, &value) | ||
284 | AST_END(exp_op_value) | ||
285 | |||
286 | AST_NODE(Exp, "Exp"_id) | ||
287 | ast_ptr<true, Value_t> value; | ||
288 | ast_list<false, exp_op_value_t> opValues; | ||
289 | AST_MEMBER(Exp, &value, &opValues) | ||
290 | AST_END(Exp) | ||
291 | |||
292 | class Parens_t; | ||
293 | |||
294 | AST_NODE(Callable, "Callable"_id) | ||
295 | ast_sel<true, Variable_t, SelfName_t, VarArg_t, Parens_t> item; | ||
296 | AST_MEMBER(Callable, &item) | ||
297 | AST_END(Callable) | ||
298 | |||
299 | AST_NODE(variable_pair, "variable_pair"_id) | ||
300 | ast_ptr<true, Variable_t> name; | ||
301 | AST_MEMBER(variable_pair, &name) | ||
302 | AST_END(variable_pair) | ||
303 | |||
304 | class DoubleString_t; | ||
305 | class SingleString_t; | ||
306 | |||
307 | AST_NODE(normal_pair, "normal_pair"_id) | ||
308 | ast_sel<true, KeyName_t, Exp_t, DoubleString_t, SingleString_t> key; | ||
309 | ast_sel<true, Exp_t, TableBlock_t> value; | ||
310 | AST_MEMBER(normal_pair, &key, &value) | ||
311 | AST_END(normal_pair) | ||
312 | |||
313 | AST_NODE(simple_table, "simple_table"_id) | ||
314 | ast_ptr<true, Seperator_t> sep; | ||
315 | ast_sel_list<true, variable_pair_t, normal_pair_t> pairs; | ||
316 | AST_MEMBER(simple_table, &sep, &pairs) | ||
317 | AST_END(simple_table) | ||
318 | |||
319 | class String_t; | ||
320 | class const_value_t; | ||
321 | class ClassDecl_t; | ||
322 | class unary_exp_t; | ||
323 | class TableLit_t; | ||
324 | class FunLit_t; | ||
325 | |||
326 | AST_NODE(SimpleValue, "SimpleValue"_id) | ||
327 | ast_sel<true, const_value_t, | ||
328 | If_t, Unless_t, Switch_t, With_t, ClassDecl_t, | ||
329 | ForEach_t, For_t, While_t, Do_t, unary_exp_t, | ||
330 | TblComprehension_t, TableLit_t, Comprehension_t, | ||
331 | FunLit_t, Num_t> value; | ||
332 | AST_MEMBER(SimpleValue, &value) | ||
333 | AST_END(SimpleValue) | ||
334 | |||
335 | AST_LEAF(LuaStringOpen, "LuaStringOpen"_id) | ||
336 | AST_END(LuaStringOpen) | ||
337 | |||
338 | AST_LEAF(LuaStringContent, "LuaStringContent"_id) | ||
339 | AST_END(LuaStringContent) | ||
340 | |||
341 | AST_LEAF(LuaStringClose, "LuaStringClose"_id) | ||
342 | AST_END(LuaStringClose) | ||
343 | |||
344 | AST_NODE(LuaString, "LuaString"_id) | ||
345 | ast_ptr<true, LuaStringOpen_t> open; | ||
346 | ast_ptr<true, LuaStringContent_t> content; | ||
347 | ast_ptr<true, LuaStringClose_t> close; | ||
348 | AST_MEMBER(LuaString, &open, &content, &close) | ||
349 | AST_END(LuaString) | ||
350 | |||
351 | AST_LEAF(SingleString, "SingleString"_id) | ||
352 | AST_END(SingleString) | ||
353 | |||
354 | AST_LEAF(double_string_inner, "double_string_inner"_id) | ||
355 | AST_END(double_string_inner) | ||
356 | |||
357 | AST_NODE(double_string_content, "double_string_content"_id) | ||
358 | ast_sel<true, double_string_inner_t, Exp_t> content; | ||
359 | AST_MEMBER(double_string_content, &content) | ||
360 | AST_END(double_string_content) | ||
361 | |||
362 | AST_NODE(DoubleString, "DoubleString"_id) | ||
363 | ast_ptr<true, Seperator_t> sep; | ||
364 | ast_list<false, double_string_content_t> segments; | ||
365 | AST_MEMBER(DoubleString, &sep, &segments) | ||
366 | AST_END(DoubleString) | ||
367 | |||
368 | AST_NODE(String, "String"_id) | ||
369 | ast_sel<true, DoubleString_t, SingleString_t, LuaString_t> str; | ||
370 | AST_MEMBER(String, &str) | ||
371 | AST_END(String) | ||
372 | |||
373 | AST_NODE(DotChainItem, "DotChainItem"_id) | ||
374 | ast_ptr<true, Name_t> name; | ||
375 | AST_MEMBER(DotChainItem, &name) | ||
376 | AST_END(DotChainItem) | ||
377 | |||
378 | AST_NODE(ColonChainItem, "ColonChainItem"_id) | ||
379 | ast_sel<true, LuaKeyword_t, Name_t> name; | ||
380 | bool switchToDot = false; | ||
381 | AST_MEMBER(ColonChainItem, &name) | ||
382 | AST_END(ColonChainItem) | ||
383 | |||
384 | class default_value_t; | ||
385 | |||
386 | AST_NODE(Slice, "Slice"_id) | ||
387 | ast_sel<true, Exp_t, default_value_t> startValue; | ||
388 | ast_sel<true, Exp_t, default_value_t> stopValue; | ||
389 | ast_sel<true, Exp_t, default_value_t> stepValue; | ||
390 | AST_MEMBER(Slice, &startValue, &stopValue, &stepValue) | ||
391 | AST_END(Slice) | ||
392 | |||
393 | AST_NODE(Parens, "Parens"_id) | ||
394 | ast_ptr<true, Exp_t> expr; | ||
395 | AST_MEMBER(Parens, &expr) | ||
396 | AST_END(Parens) | ||
397 | |||
398 | AST_NODE(Invoke, "Invoke"_id) | ||
399 | ast_ptr<true, Seperator_t> sep; | ||
400 | ast_sel_list<false, Exp_t, SingleString_t, DoubleString_t, LuaString_t> args; | ||
401 | AST_MEMBER(Invoke, &sep, &args) | ||
402 | AST_END(Invoke) | ||
403 | |||
404 | class InvokeArgs_t; | ||
405 | |||
406 | AST_NODE(ChainValue, "ChainValue"_id) | ||
407 | ast_ptr<true, Seperator_t> sep; | ||
408 | ast_sel_list<true, Callable_t, Invoke_t, DotChainItem_t, ColonChainItem_t, Slice_t, Exp_t, String_t, InvokeArgs_t> items; | ||
409 | AST_MEMBER(ChainValue, &sep, &items) | ||
410 | AST_END(ChainValue) | ||
411 | |||
412 | AST_NODE(AssignableChain, "AssignableChain"_id) | ||
413 | ast_ptr<true, Seperator_t> sep; | ||
414 | ast_sel_list<true, Callable_t, Invoke_t, DotChainItem_t, ColonChainItem_t, Exp_t, String_t> items; | ||
415 | AST_MEMBER(AssignableChain, &sep, &items) | ||
416 | AST_END(AssignableChain) | ||
417 | |||
418 | AST_NODE(Value, "Value"_id) | ||
419 | ast_sel<true, SimpleValue_t, simple_table_t, ChainValue_t, String_t> item; | ||
420 | AST_MEMBER(Value, &item) | ||
421 | AST_END(Value) | ||
422 | |||
423 | AST_LEAF(default_value, "default_value"_id) | ||
424 | AST_END(default_value) | ||
425 | |||
426 | AST_NODE(TableLit, "TableLit"_id) | ||
427 | ast_ptr<true, Seperator_t> sep; | ||
428 | ast_sel_list<false, variable_pair_t, normal_pair_t, Exp_t> values; | ||
429 | AST_MEMBER(TableLit, &sep, &values) | ||
430 | AST_END(TableLit) | ||
431 | |||
432 | AST_NODE(TableBlock, "TableBlock"_id) | ||
433 | ast_ptr<true, Seperator_t> sep; | ||
434 | ast_sel_list<false, variable_pair_t, normal_pair_t> values; | ||
435 | AST_MEMBER(TableBlock, &sep, &values) | ||
436 | AST_END(TableBlock) | ||
437 | |||
438 | AST_NODE(class_member_list, "class_member_list"_id) | ||
439 | ast_ptr<true, Seperator_t> sep; | ||
440 | ast_sel_list<true, variable_pair_t, normal_pair_t> values; | ||
441 | AST_MEMBER(class_member_list, &sep, &values) | ||
442 | AST_END(class_member_list) | ||
443 | |||
444 | AST_NODE(ClassBlock, "ClassBlock"_id) | ||
445 | ast_ptr<true, Seperator_t> sep; | ||
446 | ast_sel_list<true, class_member_list_t, Statement_t> contents; | ||
447 | AST_MEMBER(ClassBlock, &sep, &contents) | ||
448 | AST_END(ClassBlock) | ||
449 | |||
450 | AST_NODE(ClassDecl, "ClassDecl"_id) | ||
451 | ast_ptr<false, Assignable_t> name; | ||
452 | ast_ptr<false, Exp_t> extend; | ||
453 | ast_ptr<false, ClassBlock_t> body; | ||
454 | AST_MEMBER(ClassDecl, &name, &extend, &body) | ||
455 | AST_END(ClassDecl) | ||
456 | |||
457 | AST_NODE(export_values, "export_values"_id) | ||
458 | ast_ptr<true, NameList_t> nameList; | ||
459 | ast_ptr<false, ExpListLow_t> valueList; | ||
460 | AST_MEMBER(export_values, &nameList, &valueList) | ||
461 | AST_END(export_values) | ||
462 | |||
463 | AST_LEAF(export_op, "export_op"_id) | ||
464 | AST_END(export_op) | ||
465 | |||
466 | AST_NODE(Export, "Export"_id) | ||
467 | ast_sel<true, ClassDecl_t, export_op_t, export_values_t> item; | ||
468 | AST_MEMBER(Export, &item) | ||
469 | AST_END(Export) | ||
470 | |||
471 | AST_NODE(FnArgDef, "FnArgDef"_id) | ||
472 | ast_sel<true, Variable_t, SelfName_t> name; | ||
473 | ast_ptr<false, Exp_t> defaultValue; | ||
474 | AST_MEMBER(FnArgDef, &name, &defaultValue) | ||
475 | AST_END(FnArgDef) | ||
476 | |||
477 | AST_NODE(FnArgDefList, "FnArgDefList"_id) | ||
478 | ast_ptr<true, Seperator_t> sep; | ||
479 | ast_list<false, FnArgDef_t> definitions; | ||
480 | ast_ptr<false, VarArg_t> varArg; | ||
481 | AST_MEMBER(FnArgDefList, &sep, &definitions, &varArg) | ||
482 | AST_END(FnArgDefList) | ||
483 | |||
484 | AST_NODE(outer_var_shadow, "outer_var_shadow"_id) | ||
485 | ast_ptr<false, NameList_t> varList; | ||
486 | AST_MEMBER(outer_var_shadow, &varList) | ||
487 | AST_END(outer_var_shadow) | ||
488 | |||
489 | AST_NODE(FnArgsDef, "FnArgsDef"_id) | ||
490 | ast_ptr<false, FnArgDefList_t> defList; | ||
491 | ast_ptr<false, outer_var_shadow_t> shadowOption; | ||
492 | AST_MEMBER(FnArgsDef, &defList, &shadowOption) | ||
493 | AST_END(FnArgsDef) | ||
494 | |||
495 | AST_LEAF(fn_arrow, "fn_arrow"_id) | ||
496 | AST_END(fn_arrow) | ||
497 | |||
498 | AST_NODE(FunLit, "FunLit"_id) | ||
499 | ast_ptr<false, FnArgsDef_t> argsDef; | ||
500 | ast_ptr<true, fn_arrow_t> arrow; | ||
501 | ast_ptr<false, Body_t> body; | ||
502 | AST_MEMBER(FunLit, &argsDef, &arrow, &body) | ||
503 | AST_END(FunLit) | ||
504 | |||
505 | AST_NODE(NameOrDestructure, "NameOrDestructure"_id) | ||
506 | ast_sel<true, Variable_t, TableLit_t> item; | ||
507 | AST_MEMBER(NameOrDestructure, &item) | ||
508 | AST_END(NameOrDestructure) | ||
509 | |||
510 | AST_NODE(AssignableNameList, "AssignableNameList"_id) | ||
511 | ast_ptr<true, Seperator_t> sep; | ||
512 | ast_list<true, NameOrDestructure_t> items; | ||
513 | AST_MEMBER(AssignableNameList, &sep, &items) | ||
514 | AST_END(AssignableNameList) | ||
515 | |||
516 | AST_NODE(InvokeArgs, "InvokeArgs"_id) | ||
517 | ast_ptr<true, Seperator_t> sep; | ||
518 | ast_sel_list<true, Exp_t, TableBlock_t> args; | ||
519 | AST_MEMBER(InvokeArgs, &sep, &args) | ||
520 | AST_END(InvokeArgs) | ||
521 | |||
522 | AST_LEAF(const_value, "const_value"_id) | ||
523 | AST_END(const_value) | ||
524 | |||
525 | AST_NODE(unary_exp, "unary_exp"_id) | ||
526 | ast_ptr<true, Exp_t> item; | ||
527 | AST_MEMBER(unary_exp, &item) | ||
528 | AST_END(unary_exp) | ||
529 | |||
530 | AST_NODE(ExpListAssign, "ExpListAssign"_id) | ||
531 | ast_ptr<true, ExpList_t> expList; | ||
532 | ast_sel<false, Update_t, Assign_t> action; | ||
533 | AST_MEMBER(ExpListAssign, &expList, &action) | ||
534 | AST_END(ExpListAssign) | ||
535 | |||
536 | AST_NODE(if_else_line, "if_else_line"_id) | ||
537 | ast_ptr<true, Exp_t> condition; | ||
538 | ast_sel<false, Exp_t, default_value_t> elseExpr; | ||
539 | AST_MEMBER(if_else_line, &condition, &elseExpr) | ||
540 | AST_END(if_else_line) | ||
541 | |||
542 | AST_NODE(unless_line, "unless_line"_id) | ||
543 | ast_ptr<true, Exp_t> condition; | ||
544 | AST_MEMBER(unless_line, &condition) | ||
545 | AST_END(unless_line) | ||
546 | |||
547 | AST_NODE(statement_appendix, "statement_appendix"_id) | ||
548 | ast_sel<true, if_else_line_t, unless_line_t, CompInner_t> item; | ||
549 | AST_MEMBER(statement_appendix, &item) | ||
550 | AST_END(statement_appendix) | ||
551 | |||
552 | AST_LEAF(BreakLoop, "BreakLoop"_id) | ||
553 | AST_END(BreakLoop) | ||
554 | |||
555 | AST_NODE(Statement, "Statement"_id) | ||
556 | ast_sel<true, Import_t, While_t, For_t, ForEach_t, | ||
557 | Return_t, Local_t, Export_t, BreakLoop_t, | ||
558 | ExpListAssign_t> content; | ||
559 | ast_ptr<false, statement_appendix_t> appendix; | ||
560 | AST_MEMBER(Statement, &content, &appendix) | ||
561 | AST_END(Statement) | ||
562 | |||
563 | class Block_t; | ||
564 | |||
565 | AST_NODE(Body, "Body"_id) | ||
566 | ast_sel<true, Block_t, Statement_t> content; | ||
567 | AST_MEMBER(Body, &content) | ||
568 | AST_END(Body) | ||
569 | |||
570 | AST_NODE(Block, "Block"_id) | ||
571 | ast_ptr<true, Seperator_t> sep; | ||
572 | ast_list<false, Statement_t> statements; | ||
573 | AST_MEMBER(Block, &sep, &statements) | ||
574 | AST_END(Block) | ||
575 | |||
576 | AST_NODE(File, "File"_id) | ||
577 | ast_ptr<true, Block_t> block; | ||
578 | AST_MEMBER(File, &block) | ||
579 | AST_END(File) | ||
580 | |||
581 | } // namespace MoonP | ||