From a4bbfc61a8973ad029bd7d7908bf2c24398c0715 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Thu, 20 Feb 2020 14:43:34 +0800 Subject: allow value lists in for statement and in local statement to be multiline got Moonscript issue 390 fixed. --- src/MoonP/moon_compiler.cpp | 2 +- src/MoonP/moon_parser.cpp | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') 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) { } const char* moonScriptVersion() { - return "0.5.0-r0.1.2"; + return "0.5.0-r0.1.3"; } class 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() { While = key("while") >> DisableDo >> ensure(Exp, PopDo) >> -key("do") >> Body; - for_step_value = sym(',') >> Exp; - for_args = Space >> Variable >> sym('=') >> Exp >> sym(',') >> Exp >> -for_step_value; + for_step_value = sym(',') >> White >> Exp; + for_args = Space >> Variable >> sym('=') >> Exp >> sym(',') >> White >> Exp >> -for_step_value; For = key("for") >> DisableDo >> ensure(for_args, PopDo) >> @@ -238,7 +238,7 @@ MoonParser::MoonParser() { CompInner = Seperator >> (CompForEach | CompFor) >> *CompClause; star_exp = sym('*') >> Exp; CompForEach = key("for") >> AssignableNameList >> key("in") >> (star_exp | Exp); - CompFor = key("for") >> Space >> Variable >> sym('=') >> Exp >> sym(',') >> Exp >> -for_step_value; + CompFor = key("for") >> Space >> Variable >> sym('=') >> Exp >> sym(',') >> White >> Exp >> -for_step_value; CompClause = CompFor | CompForEach | key("when") >> Exp; Assign = sym('=') >> Seperator >> (With | If | Switch | TableBlock | Exp >> *((sym(',') | sym(';')) >> White >> Exp)); @@ -430,9 +430,9 @@ MoonParser::MoonParser() { fn_arrow = expr("->") | expr("=>"); FunLit = -FnArgsDef >> Space >> fn_arrow >> -Body; - NameList = Seperator >> Space >> Variable >> *(sym(',') >> Space >> Variable); + NameList = Seperator >> Space >> Variable >> *(sym(',') >> White >> Variable); NameOrDestructure = Space >> Variable | TableLit; - AssignableNameList = Seperator >> NameOrDestructure >> *(sym(',') >> NameOrDestructure); + AssignableNameList = Seperator >> NameOrDestructure >> *(sym(',') >> White >> NameOrDestructure); Backcall = -FnArgsDef >> Space >> symx("<-") >> Space >> ChainValue; -- cgit v1.2.3-55-g6feb