aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/yuescript/stacktraceplus.h2
-rw-r--r--src/yuescript/yue_compiler.cpp2
-rw-r--r--src/yuescript/yue_parser.cpp18
-rw-r--r--src/yuescript/yue_parser.h4
4 files changed, 19 insertions, 7 deletions
diff --git a/src/yuescript/stacktraceplus.h b/src/yuescript/stacktraceplus.h
index 6025daa..3167ba8 100644
--- a/src/yuescript/stacktraceplus.h
+++ b/src/yuescript/stacktraceplus.h
@@ -345,7 +345,7 @@ local function getYueLineNumber(fname, line)
345 if source then 345 if source then
346 local current, target = 1, tonumber(line) 346 local current, target = 1, tonumber(line)
347 local findLine = line 347 local findLine = line
348 for lineCode in source:gmatch("[^\n\r]*") do 348 for lineCode in source:gmatch("([^\r\n]*)\r?\n?") do
349 local num = lineCode:match("--%s*(%d+)%s*$") 349 local num = lineCode:match("--%s*(%d+)%s*$")
350 if num then 350 if num then
351 findLine = num 351 findLine = num
diff --git a/src/yuescript/yue_compiler.cpp b/src/yuescript/yue_compiler.cpp
index 8c4afce..69a028f 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
78const std::string_view version = "0.20.6"sv; 78const std::string_view version = "0.20.7"sv;
79const std::string_view extension = "yue"sv; 79const std::string_view extension = "yue"sv;
80 80
81class CompileError : public std::logic_error { 81class CompileError : public std::logic_error {
diff --git a/src/yuescript/yue_parser.cpp b/src/yuescript/yue_parser.cpp
index 11c7627..2206686 100644
--- a/src/yuescript/yue_parser.cpp
+++ b/src/yuescript/yue_parser.cpp
@@ -617,11 +617,21 @@ YueParser::YueParser() {
617 617
618 Parens = '(' >> *space_break >> space >> Exp >> *space_break >> space >> ')'; 618 Parens = '(' >> *space_break >> space >> Exp >> *space_break >> space >> ')';
619 Callable = Variable | SelfItem | MacroName | Parens; 619 Callable = Variable | SelfItem | MacroName | Parens;
620 fn_args_exp_list = space >> Exp >> space >> *((line_break | ',') >> white >> Exp); 620
621 fn_args_value_list = Exp >> *(space >> ',' >> space >> Exp);
622
623 fn_args_lit_line = (
624 push_indent_match >> (space >> fn_args_value_list >> pop_indent | pop_indent)
625 ) | (
626 space
627 );
628
629 fn_args_lit_lines = space_break >> fn_args_lit_line >> *(-(space >> ',') >> space_break >> fn_args_lit_line) >> -(space >> ',');
621 630
622 fn_args = 631 fn_args =
623 '(' >> *space_break >> -fn_args_exp_list >> *space_break >> space >> ')' | 632 '(' >> -(space >> fn_args_value_list >> -(space >> ',')) >>
624 space >> '!' >> not_('='); 633 -fn_args_lit_lines >>
634 white >> ')' | space >> '!' >> not_('=');
625 635
626 meta_index = Name | index | String; 636 meta_index = Name | index | String;
627 Metatable = '<' >> space >> '>'; 637 Metatable = '<' >> space >> '>';
@@ -701,7 +711,7 @@ YueParser::YueParser() {
701 table_lit_lines = space_break >> table_lit_line >> *(-(space >> ',') >> space_break >> table_lit_line) >> -(space >> ','); 711 table_lit_lines = space_break >> table_lit_line >> *(-(space >> ',') >> space_break >> table_lit_line) >> -(space >> ',');
702 712
703 TableLit = 713 TableLit =
704 space >> '{' >> Seperator >> 714 '{' >> Seperator >>
705 -(space >> table_value_list >> -(space >> ',')) >> 715 -(space >> table_value_list >> -(space >> ',')) >>
706 -table_lit_lines >> 716 -table_lit_lines >>
707 white >> '}'; 717 white >> '}';
diff --git a/src/yuescript/yue_parser.h b/src/yuescript/yue_parser.h
index 8156ae2..16b57b2 100644
--- a/src/yuescript/yue_parser.h
+++ b/src/yuescript/yue_parser.h
@@ -217,7 +217,9 @@ private:
217 NONE_AST_RULE(double_string_plain); 217 NONE_AST_RULE(double_string_plain);
218 NONE_AST_RULE(lua_string_open); 218 NONE_AST_RULE(lua_string_open);
219 NONE_AST_RULE(lua_string_close); 219 NONE_AST_RULE(lua_string_close);
220 NONE_AST_RULE(fn_args_exp_list); 220 NONE_AST_RULE(fn_args_value_list);
221 NONE_AST_RULE(fn_args_lit_line);
222 NONE_AST_RULE(fn_args_lit_lines);
221 NONE_AST_RULE(fn_args); 223 NONE_AST_RULE(fn_args);
222 NONE_AST_RULE(destruct_def); 224 NONE_AST_RULE(destruct_def);
223 NONE_AST_RULE(macro_args_def); 225 NONE_AST_RULE(macro_args_def);