From cb5371a7dcfde196db07f5a2a3f144888b73d522 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Thu, 6 Aug 2020 10:32:05 +0800 Subject: remove support for escape new line symbol, binary operator expressions can now be written multiline without escape new line symbol. --- spec/inputs/backcall.moon | 8 ++++---- spec/inputs/syntax.moon | 41 ++++++++++++++++++++++------------------- 2 files changed, 26 insertions(+), 23 deletions(-) (limited to 'spec/inputs') diff --git a/spec/inputs/backcall.moon b/spec/inputs/backcall.moon index 86b0ba3..a648b16 100644 --- a/spec/inputs/backcall.moon +++ b/spec/inputs/backcall.moon @@ -1,10 +1,10 @@ {"abc", 123, 998} |> foreach print -{1,2,3} \ - |> map((x)-> x * 2) \ - |> filter((x)-> x > 4) \ - |> reduce(0, (a,b)-> a + b) \ +{1,2,3} + |> map((x)-> x * 2) + |> filter((x)-> x > 4) + |> reduce(0, (a,b)-> a + b) |> print [i |> tostring for i = 0,10] |> table.concat(",") |> print diff --git a/spec/inputs/syntax.moon b/spec/inputs/syntax.moon index ccee5f2..a781aa3 100644 --- a/spec/inputs/syntax.moon +++ b/spec/inputs/syntax.moon @@ -284,8 +284,8 @@ z = a- b str = --[[ This is a multi line comment. It's OK. -]] strA \ -- comment 1 - .. strB \ -- comment 2 +]] strA -- comment 1 + .. strB -- comment 2 .. strC func --[[port]] 3000, --[[ip]] "192.168.1.1" @@ -296,51 +296,54 @@ f = -> e,f f = -> - a,b \ - ,c,d \ + a,b + ,c,d ,e,f with obj - invoke \ + invoke( --[[arg1]] \func!, --[[arg2]] 123, --[[arg3]] "abc" + ) -invokeA \ - invokeB \ +invokeA( + invokeB( invokeC 123 + ) +) -123 \ - |> invokeC \ - |> invokeB \ +123 + |> invokeC + |> invokeB |> invokeA v = { a -1 - a\ --1 - a\ + a( +-1) + a - 1 a-1 a - 1 a - 1 - a -\ + a- 1 a - --[[123]]1 a ~1 - a\ -~1 - a\ + a( +~1) + a ~ 1 a~1 a ~ 1 a ~ 1 - a ~\ + a~ 1 - a ~--[[123]]1 + a ~ --[[123]]1 } nil -- cgit v1.2.3-55-g6feb