diff options
Diffstat (limited to '')
| -rw-r--r-- | src/yuescript/yue_ast.h | 3 | ||||
| -rw-r--r-- | src/yuescript/yue_compiler.cpp | 5 | ||||
| -rw-r--r-- | src/yuescript/yue_parser.cpp | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/src/yuescript/yue_ast.h b/src/yuescript/yue_ast.h index 6b2b7f8..6d90add 100644 --- a/src/yuescript/yue_ast.h +++ b/src/yuescript/yue_ast.h | |||
| @@ -80,6 +80,7 @@ class Macro_t; | |||
| 80 | class In_t; | 80 | class In_t; |
| 81 | class NormalDef_t; | 81 | class NormalDef_t; |
| 82 | class SpreadListExp_t; | 82 | class SpreadListExp_t; |
| 83 | class Comprehension_t; | ||
| 83 | } // namespace yue | 84 | } // namespace yue |
| 84 | 85 | ||
| 85 | AST_LEAF(Num) | 86 | AST_LEAF(Num) |
| @@ -171,7 +172,7 @@ AST_END(CloseAttrib, "close"sv) | |||
| 171 | AST_NODE(LocalAttrib) | 172 | AST_NODE(LocalAttrib) |
| 172 | ast_sel<true, ConstAttrib_t, CloseAttrib_t> attrib; | 173 | ast_sel<true, ConstAttrib_t, CloseAttrib_t> attrib; |
| 173 | ast_ptr<true, Seperator_t> sep; | 174 | ast_ptr<true, Seperator_t> sep; |
| 174 | ast_sel_list<true, Variable_t, SimpleTable_t, TableLit_t> leftList; | 175 | ast_sel_list<true, Variable_t, SimpleTable_t, TableLit_t, Comprehension_t> leftList; |
| 175 | ast_ptr<true, Assign_t> assign; | 176 | ast_ptr<true, Assign_t> assign; |
| 176 | AST_MEMBER(LocalAttrib, &attrib, &sep, &leftList, &assign) | 177 | AST_MEMBER(LocalAttrib, &attrib, &sep, &leftList, &assign) |
| 177 | AST_END(LocalAttrib, "local_attrib"sv) | 178 | AST_END(LocalAttrib, "local_attrib"sv) |
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp index d43f79b..f163bdf 100644 --- a/src/yuescript/yue_compiler.cpp +++ b/src/yuescript/yue_compiler.cpp | |||
| @@ -75,7 +75,7 @@ static std::unordered_set<std::string> Metamethods = { | |||
| 75 | "close"s // Lua 5.4 | 75 | "close"s // Lua 5.4 |
| 76 | }; | 76 | }; |
| 77 | 77 | ||
| 78 | const std::string_view version = "0.21.5"sv; | 78 | const std::string_view version = "0.21.6"sv; |
| 79 | const std::string_view extension = "yue"sv; | 79 | const std::string_view extension = "yue"sv; |
| 80 | 80 | ||
| 81 | class CompileError : public std::logic_error { | 81 | class CompileError : public std::logic_error { |
| @@ -9376,7 +9376,8 @@ private: | |||
| 9376 | case id<SimpleTable_t>(): | 9376 | case id<SimpleTable_t>(): |
| 9377 | value->item.set(item); | 9377 | value->item.set(item); |
| 9378 | break; | 9378 | break; |
| 9379 | case id<TableLit_t>(): { | 9379 | case id<TableLit_t>(): |
| 9380 | case id<Comprehension_t>(): { | ||
| 9380 | auto simpleValue = item->new_ptr<SimpleValue_t>(); | 9381 | auto simpleValue = item->new_ptr<SimpleValue_t>(); |
| 9381 | simpleValue->value.set(item); | 9382 | simpleValue->value.set(item); |
| 9382 | value->item.set(simpleValue); | 9383 | value->item.set(simpleValue); |
diff --git a/src/yuescript/yue_parser.cpp b/src/yuescript/yue_parser.cpp index 3557534..4e6105b 100644 --- a/src/yuescript/yue_parser.cpp +++ b/src/yuescript/yue_parser.cpp | |||
| @@ -286,7 +286,7 @@ YueParser::YueParser() { | |||
| 286 | 286 | ||
| 287 | ConstAttrib = key("const"); | 287 | ConstAttrib = key("const"); |
| 288 | CloseAttrib = key("close"); | 288 | CloseAttrib = key("close"); |
| 289 | local_const_item = Variable | SimpleTable | TableLit; | 289 | local_const_item = Variable | SimpleTable | TableLit | Comprehension; |
| 290 | LocalAttrib = ( | 290 | LocalAttrib = ( |
| 291 | ConstAttrib >> Seperator >> space >> local_const_item >> *(space >> ',' >> space >> local_const_item) | | 291 | ConstAttrib >> Seperator >> space >> local_const_item >> *(space >> ',' >> space >> local_const_item) | |
| 292 | CloseAttrib >> Seperator >> space >> Variable >> *(space >> ',' >> space >> Variable) | 292 | CloseAttrib >> Seperator >> space >> Variable >> *(space >> ',' >> space >> Variable) |
