Skip to content

Commit

Permalink
update Yuescript. [skip CI]
Browse files Browse the repository at this point in the history
  • Loading branch information
pigpigyyy committed Nov 18, 2023
1 parent 9cf40ab commit 8ec0858
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion 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.20.6"sv;
const std::string_view version = "0.20.7"sv;
const std::string_view extension = "yue"sv;

class CompileError : public std::logic_error {
Expand Down
18 changes: 14 additions & 4 deletions Source/3rdParty/yuescript/yue_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -617,11 +617,21 @@ YueParser::YueParser() {

Parens = '(' >> *space_break >> space >> Exp >> *space_break >> space >> ')';
Callable = Variable | SelfItem | MacroName | Parens;
fn_args_exp_list = space >> Exp >> space >> *((line_break | ',') >> white >> Exp);

fn_args_value_list = Exp >> *(space >> ',' >> space >> Exp);

fn_args_lit_line = (
push_indent_match >> (space >> fn_args_value_list >> pop_indent | pop_indent)
) | (
space
);

fn_args_lit_lines = space_break >> fn_args_lit_line >> *(-(space >> ',') >> space_break >> fn_args_lit_line) >> -(space >> ',');

fn_args =
'(' >> *space_break >> -fn_args_exp_list >> *space_break >> space >> ')' |
space >> '!' >> not_('=');
'(' >> -(space >> fn_args_value_list >> -(space >> ',')) >>
-fn_args_lit_lines >>
white >> ')' | space >> '!' >> not_('=');

meta_index = Name | index | String;
Metatable = '<' >> space >> '>';
Expand Down Expand Up @@ -701,7 +711,7 @@ YueParser::YueParser() {
table_lit_lines = space_break >> table_lit_line >> *(-(space >> ',') >> space_break >> table_lit_line) >> -(space >> ',');

TableLit =
space >> '{' >> Seperator >>
'{' >> Seperator >>
-(space >> table_value_list >> -(space >> ',')) >>
-table_lit_lines >>
white >> '}';
Expand Down
4 changes: 3 additions & 1 deletion Source/3rdParty/yuescript/yue_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,9 @@ class YueParser {
NONE_AST_RULE(double_string_plain);
NONE_AST_RULE(lua_string_open);
NONE_AST_RULE(lua_string_close);
NONE_AST_RULE(fn_args_exp_list);
NONE_AST_RULE(fn_args_value_list);
NONE_AST_RULE(fn_args_lit_line);
NONE_AST_RULE(fn_args_lit_lines);
NONE_AST_RULE(fn_args);
NONE_AST_RULE(destruct_def);
NONE_AST_RULE(macro_args_def);
Expand Down

0 comments on commit 8ec0858

Please sign in to comment.