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