Skip to content

Commit

Permalink
update Yuescript.
Browse files Browse the repository at this point in the history
  • Loading branch information
pigpigyyy committed Dec 19, 2023
1 parent d25b6de commit 6bf5bbe
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Source/3rdParty/yuescript/yue_ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class Macro_t;
class In_t;
class NormalDef_t;
class SpreadListExp_t;
class Comprehension_t;
} // namespace yue

AST_LEAF(Num)
Expand Down Expand Up @@ -171,7 +172,7 @@ AST_END(CloseAttrib, "close"sv)
AST_NODE(LocalAttrib)
ast_sel<true, ConstAttrib_t, CloseAttrib_t> attrib;
ast_ptr<true, Seperator_t> sep;
ast_sel_list<true, Variable_t, SimpleTable_t, TableLit_t> leftList;
ast_sel_list<true, Variable_t, SimpleTable_t, TableLit_t, Comprehension_t> leftList;
ast_ptr<true, Assign_t> assign;
AST_MEMBER(LocalAttrib, &attrib, &sep, &leftList, &assign)
AST_END(LocalAttrib, "local_attrib"sv)
Expand Down
5 changes: 3 additions & 2 deletions Source/3rdParty/yuescript/yue_compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ static std::unordered_set<std::string> Metamethods = {
"close"s // Lua 5.4
};

const std::string_view version = "0.21.5"sv;
const std::string_view version = "0.21.6"sv;
const std::string_view extension = "yue"sv;

class CompileError : public std::logic_error {
Expand Down Expand Up @@ -9376,7 +9376,8 @@ class YueCompilerImpl {
case id<SimpleTable_t>():
value->item.set(item);
break;
case id<TableLit_t>(): {
case id<TableLit_t>():
case id<Comprehension_t>(): {
auto simpleValue = item->new_ptr<SimpleValue_t>();
simpleValue->value.set(item);
value->item.set(simpleValue);
Expand Down
2 changes: 1 addition & 1 deletion Source/3rdParty/yuescript/yue_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ YueParser::YueParser() {

ConstAttrib = key("const");
CloseAttrib = key("close");
local_const_item = Variable | SimpleTable | TableLit;
local_const_item = Variable | SimpleTable | TableLit | Comprehension;
LocalAttrib = (
ConstAttrib >> Seperator >> space >> local_const_item >> *(space >> ',' >> space >> local_const_item) |
CloseAttrib >> Seperator >> space >> Variable >> *(space >> ',' >> space >> Variable)
Expand Down

0 comments on commit 6bf5bbe

Please sign in to comment.