aboutsummaryrefslogtreecommitdiff
path: root/src/MoonP/moon_ast.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/MoonP/moon_ast.h')
-rw-r--r--src/MoonP/moon_ast.h40
1 files changed, 31 insertions, 9 deletions
diff --git a/src/MoonP/moon_ast.h b/src/MoonP/moon_ast.h
index 90508a5..dfe70ea 100644
--- a/src/MoonP/moon_ast.h
+++ b/src/MoonP/moon_ast.h
@@ -35,7 +35,15 @@ public: \
35}; \ 35}; \
36template<> constexpr int id<type##_t>() { return COUNTER_READ; } 36template<> constexpr int id<type##_t>() { return COUNTER_READ; }
37 37
38AST_LEAF(Num) 38AST_LEAF(Decimal)
39AST_END(Decimal)
40
41AST_LEAF(Integer)
42AST_END(Integer)
43
44AST_NODE(Num)
45 ast_sel<true, Decimal_t, Integer_t> num;
46 AST_MEMBER(Num, &num)
39AST_END(Num) 47AST_END(Num)
40 48
41AST_LEAF(Name) 49AST_LEAF(Name)
@@ -146,9 +154,29 @@ AST_NODE(ImportFrom)
146 AST_MEMBER(ImportFrom, &sep, &names, &exp) 154 AST_MEMBER(ImportFrom, &sep, &names, &exp)
147AST_END(ImportFrom) 155AST_END(ImportFrom)
148 156
157class MacroName_t;
158
159AST_NODE(macro_name_pair)
160 ast_ptr<true, MacroName_t> key;
161 ast_ptr<true, MacroName_t> value;
162 AST_MEMBER(macro_name_pair, &key, &value)
163AST_END(macro_name_pair)
164
165AST_LEAF(import_all_macro)
166AST_END(import_all_macro)
167
168class variable_pair_t;
169class normal_pair_t;
170
171AST_NODE(ImportTabLit)
172 ast_ptr<true, Seperator_t> sep;
173 ast_sel_list<false, variable_pair_t, normal_pair_t, MacroName_t, macro_name_pair_t, import_all_macro_t> items;
174 AST_MEMBER(ImportTabLit, &sep, &items)
175AST_END(ImportTabLit)
176
149AST_NODE(ImportAs) 177AST_NODE(ImportAs)
150 ast_ptr<true, ImportLiteral_t> literal; 178 ast_ptr<true, ImportLiteral_t> literal;
151 ast_sel<false, Variable_t, TableLit_t> target; 179 ast_sel<false, Variable_t, ImportTabLit_t> target;
152 AST_MEMBER(ImportAs, &literal, &target) 180 AST_MEMBER(ImportAs, &literal, &target)
153AST_END(ImportAs) 181AST_END(ImportAs)
154 182
@@ -515,15 +543,9 @@ AST_END(Value)
515AST_LEAF(default_value) 543AST_LEAF(default_value)
516AST_END(default_value) 544AST_END(default_value)
517 545
518AST_NODE(macro_name_pair)
519 ast_ptr<true, MacroName_t> key;
520 ast_ptr<true, MacroName_t> value;
521 AST_MEMBER(macro_name_pair, &key, &value)
522AST_END(macro_name_pair)
523
524AST_NODE(TableLit) 546AST_NODE(TableLit)
525 ast_ptr<true, Seperator_t> sep; 547 ast_ptr<true, Seperator_t> sep;
526 ast_sel_list<false, variable_pair_t, normal_pair_t, Exp_t, MacroName_t, macro_name_pair_t> values; 548 ast_sel_list<false, variable_pair_t, normal_pair_t, Exp_t> values;
527 AST_MEMBER(TableLit, &sep, &values) 549 AST_MEMBER(TableLit, &sep, &values)
528AST_END(TableLit) 550AST_END(TableLit)
529 551