diff options
Diffstat (limited to 'src/MoonP/moon_parser.h')
-rw-r--r-- | src/MoonP/moon_parser.h | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/MoonP/moon_parser.h b/src/MoonP/moon_parser.h index 12f735b..eefcba5 100644 --- a/src/MoonP/moon_parser.h +++ b/src/MoonP/moon_parser.h | |||
@@ -26,6 +26,8 @@ struct ParseInfo { | |||
26 | ast_ptr<false, ast_node> node; | 26 | ast_ptr<false, ast_node> node; |
27 | std::string error; | 27 | std::string error; |
28 | std::unique_ptr<input> codes; | 28 | std::unique_ptr<input> codes; |
29 | bool exportDefault = false; | ||
30 | std::string moduleName; | ||
29 | std::string errorMessage(std::string_view msg, const input_range* loc) const; | 31 | std::string errorMessage(std::string_view msg, const input_range* loc) const; |
30 | }; | 32 | }; |
31 | 33 | ||
@@ -72,10 +74,13 @@ protected: | |||
72 | struct State { | 74 | struct State { |
73 | State() { | 75 | State() { |
74 | indents.push(0); | 76 | indents.push(0); |
75 | stringOpen = -1; | ||
76 | } | 77 | } |
78 | bool exportDefault = false; | ||
79 | int exportCount = 0; | ||
80 | int moduleFix = 0; | ||
81 | size_t stringOpen = 0; | ||
82 | std::string moduleName = "_module_0"; | ||
77 | std::string buffer; | 83 | std::string buffer; |
78 | size_t stringOpen; | ||
79 | std::stack<int> indents; | 84 | std::stack<int> indents; |
80 | std::stack<bool> doStack; | 85 | std::stack<bool> doStack; |
81 | }; | 86 | }; |
@@ -124,8 +129,8 @@ private: | |||
124 | rule ImportNameList; | 129 | rule ImportNameList; |
125 | rule import_literal_chain; | 130 | rule import_literal_chain; |
126 | rule WithExp; | 131 | rule WithExp; |
127 | rule PopDo; | ||
128 | rule DisableDo; | 132 | rule DisableDo; |
133 | rule PopDo; | ||
129 | rule SwitchElse; | 134 | rule SwitchElse; |
130 | rule SwitchBlock; | 135 | rule SwitchBlock; |
131 | rule IfElseIf; | 136 | rule IfElseIf; |
@@ -181,9 +186,9 @@ private: | |||
181 | AST_RULE(SelfName) | 186 | AST_RULE(SelfName) |
182 | AST_RULE(KeyName) | 187 | AST_RULE(KeyName) |
183 | AST_RULE(VarArg) | 188 | AST_RULE(VarArg) |
184 | AST_RULE(local_flag) | ||
185 | AST_RULE(Seperator) | 189 | AST_RULE(Seperator) |
186 | AST_RULE(NameList) | 190 | AST_RULE(NameList) |
191 | AST_RULE(local_flag) | ||
187 | AST_RULE(Local) | 192 | AST_RULE(Local) |
188 | AST_RULE(colon_import_name) | 193 | AST_RULE(colon_import_name) |
189 | AST_RULE(import_literal_inner) | 194 | AST_RULE(import_literal_inner) |
@@ -249,8 +254,10 @@ private: | |||
249 | AST_RULE(class_member_list) | 254 | AST_RULE(class_member_list) |
250 | AST_RULE(ClassBlock) | 255 | AST_RULE(ClassBlock) |
251 | AST_RULE(ClassDecl) | 256 | AST_RULE(ClassDecl) |
252 | AST_RULE(export_values) | 257 | AST_RULE(global_values) |
253 | AST_RULE(export_op) | 258 | AST_RULE(global_op) |
259 | AST_RULE(Global) | ||
260 | AST_RULE(export_default) | ||
254 | AST_RULE(Export) | 261 | AST_RULE(Export) |
255 | AST_RULE(variable_pair) | 262 | AST_RULE(variable_pair) |
256 | AST_RULE(normal_pair) | 263 | AST_RULE(normal_pair) |