aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLi Jin <dragon-fly@qq.com>2020-02-20 14:43:34 +0800
committerLi Jin <dragon-fly@qq.com>2020-02-20 14:43:34 +0800
commita4bbfc61a8973ad029bd7d7908bf2c24398c0715 (patch)
treeb6100b8e2ac1d4f13bc2557f90c67d4cbd6061b4 /src
parent3a084cfad7aa8da8d2c4b7849347b0832ef8e87e (diff)
downloadyuescript-a4bbfc61a8973ad029bd7d7908bf2c24398c0715.tar.gz
yuescript-a4bbfc61a8973ad029bd7d7908bf2c24398c0715.tar.bz2
yuescript-a4bbfc61a8973ad029bd7d7908bf2c24398c0715.zip
allow value lists in for statement and in local statement to be multiline got Moonscript issue 390 fixed.
Diffstat (limited to 'src')
-rw-r--r--src/MoonP/moon_compiler.cpp2
-rw-r--r--src/MoonP/moon_parser.cpp10
2 files changed, 6 insertions, 6 deletions
diff --git a/src/MoonP/moon_compiler.cpp b/src/MoonP/moon_compiler.cpp
index 4596542..e6d010c 100644
--- a/src/MoonP/moon_compiler.cpp
+++ b/src/MoonP/moon_compiler.cpp
@@ -32,7 +32,7 @@ inline std::string s(std::string_view sv) {
32} 32}
33 33
34const char* moonScriptVersion() { 34const char* moonScriptVersion() {
35 return "0.5.0-r0.1.2"; 35 return "0.5.0-r0.1.3";
36} 36}
37 37
38class MoonCompiler { 38class MoonCompiler {
diff --git a/src/MoonP/moon_parser.cpp b/src/MoonP/moon_parser.cpp
index 0b59776..8d7fdc5 100644
--- a/src/MoonP/moon_parser.cpp
+++ b/src/MoonP/moon_parser.cpp
@@ -198,8 +198,8 @@ MoonParser::MoonParser() {
198 198
199 While = key("while") >> DisableDo >> ensure(Exp, PopDo) >> -key("do") >> Body; 199 While = key("while") >> DisableDo >> ensure(Exp, PopDo) >> -key("do") >> Body;
200 200
201 for_step_value = sym(',') >> Exp; 201 for_step_value = sym(',') >> White >> Exp;
202 for_args = Space >> Variable >> sym('=') >> Exp >> sym(',') >> Exp >> -for_step_value; 202 for_args = Space >> Variable >> sym('=') >> Exp >> sym(',') >> White >> Exp >> -for_step_value;
203 203
204 For = key("for") >> DisableDo >> 204 For = key("for") >> DisableDo >>
205 ensure(for_args, PopDo) >> 205 ensure(for_args, PopDo) >>
@@ -238,7 +238,7 @@ MoonParser::MoonParser() {
238 CompInner = Seperator >> (CompForEach | CompFor) >> *CompClause; 238 CompInner = Seperator >> (CompForEach | CompFor) >> *CompClause;
239 star_exp = sym('*') >> Exp; 239 star_exp = sym('*') >> Exp;
240 CompForEach = key("for") >> AssignableNameList >> key("in") >> (star_exp | Exp); 240 CompForEach = key("for") >> AssignableNameList >> key("in") >> (star_exp | Exp);
241 CompFor = key("for") >> Space >> Variable >> sym('=') >> Exp >> sym(',') >> Exp >> -for_step_value; 241 CompFor = key("for") >> Space >> Variable >> sym('=') >> Exp >> sym(',') >> White >> Exp >> -for_step_value;
242 CompClause = CompFor | CompForEach | key("when") >> Exp; 242 CompClause = CompFor | CompForEach | key("when") >> Exp;
243 243
244 Assign = sym('=') >> Seperator >> (With | If | Switch | TableBlock | Exp >> *((sym(',') | sym(';')) >> White >> Exp)); 244 Assign = sym('=') >> Seperator >> (With | If | Switch | TableBlock | Exp >> *((sym(',') | sym(';')) >> White >> Exp));
@@ -430,9 +430,9 @@ MoonParser::MoonParser() {
430 fn_arrow = expr("->") | expr("=>"); 430 fn_arrow = expr("->") | expr("=>");
431 FunLit = -FnArgsDef >> Space >> fn_arrow >> -Body; 431 FunLit = -FnArgsDef >> Space >> fn_arrow >> -Body;
432 432
433 NameList = Seperator >> Space >> Variable >> *(sym(',') >> Space >> Variable); 433 NameList = Seperator >> Space >> Variable >> *(sym(',') >> White >> Variable);
434 NameOrDestructure = Space >> Variable | TableLit; 434 NameOrDestructure = Space >> Variable | TableLit;
435 AssignableNameList = Seperator >> NameOrDestructure >> *(sym(',') >> NameOrDestructure); 435 AssignableNameList = Seperator >> NameOrDestructure >> *(sym(',') >> White >> NameOrDestructure);
436 436
437 Backcall = -FnArgsDef >> Space >> symx("<-") >> Space >> ChainValue; 437 Backcall = -FnArgsDef >> Space >> symx("<-") >> Space >> ChainValue;
438 438