From d8901102a1e39e651b08b66257c176b5803b9bc0 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Mon, 3 Feb 2020 11:25:11 +0800 Subject: enable explist to be multi-line without backslash. confirmed there is no similar issue like Moonscript issue 202 or issue 391. --- spec/inputs/assign.moon | 3 +-- spec/inputs/destructure.moon | 9 +++++++++ spec/inputs/syntax.moon | 9 +++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) (limited to 'spec') diff --git a/spec/inputs/assign.moon b/spec/inputs/assign.moon index 4e50147..e8fcbfd 100644 --- a/spec/inputs/assign.moon +++ b/spec/inputs/assign.moon @@ -26,5 +26,4 @@ else print "the other" "nothing", "yeah" - - +c, d = 1, 2 if true diff --git a/spec/inputs/destructure.moon b/spec/inputs/destructure.moon index e0f2198..d61b6ae 100644 --- a/spec/inputs/destructure.moon +++ b/spec/inputs/destructure.moon @@ -103,3 +103,12 @@ do do {if:{a,b,c}} = thing + +do + {:a, :b} = {a: "Hello", b: "World"} if true + + {days, hours, mins, secs} = [tonumber a for a in *{ + string.match "1 2 3 4", "(.+)%s(.+)%s(.+)%s(.+)" + }] + + {:one, :two, :three} = {w,true for w in foo\gmatch("%S+")} diff --git a/spec/inputs/syntax.moon b/spec/inputs/syntax.moon index abee3e3..ae3fc0c 100644 --- a/spec/inputs/syntax.moon +++ b/spec/inputs/syntax.moon @@ -281,10 +281,15 @@ It's OK. func --[[port]] 3000, --[[ip]] "192.168.1.1" f = -> - a,b, \ - c,d, \ + a,b, + c,d, e,f +f = -> + a,b \ + ,c,d \ + ,e,f + with obj invoke \ --[[arg1]] \func!, -- cgit v1.2.3-55-g6feb