diff options
Diffstat (limited to 'spec/inputs')
| -rw-r--r-- | spec/inputs/assign.yue | 2 | ||||
| -rw-r--r-- | spec/inputs/compile_doc.yue | 4 | ||||
| -rw-r--r-- | spec/inputs/cond.yue | 28 | ||||
| -rw-r--r-- | spec/inputs/destructure.yue | 8 | ||||
| -rw-r--r-- | spec/inputs/existential.yue | 2 | ||||
| -rw-r--r-- | spec/inputs/macro_teal.yue | 2 | ||||
| -rw-r--r-- | spec/inputs/pipe.yue | 2 | ||||
| -rw-r--r-- | spec/inputs/plus.yue | 8 | ||||
| -rw-r--r-- | spec/inputs/try_catch.yue | 4 | ||||
| -rw-r--r-- | spec/inputs/unicode/assign.yue | 2 | ||||
| -rw-r--r-- | spec/inputs/unicode/cond.yue | 28 | ||||
| -rw-r--r-- | spec/inputs/unicode/destructure.yue | 8 | ||||
| -rw-r--r-- | spec/inputs/unicode/existential.yue | 2 | ||||
| -rw-r--r-- | spec/inputs/unicode/pipe.yue | 2 | ||||
| -rw-r--r-- | spec/inputs/unicode/plus.yue | 8 | ||||
| -rw-r--r-- | spec/inputs/unicode/try_catch.yue | 4 |
16 files changed, 57 insertions, 57 deletions
diff --git a/spec/inputs/assign.yue b/spec/inputs/assign.yue index 8ae5cac..2c89a99 100644 --- a/spec/inputs/assign.yue +++ b/spec/inputs/assign.yue | |||
| @@ -30,7 +30,7 @@ c, d = 1, 2 if true | |||
| 30 | 30 | ||
| 31 | x = (do | 31 | x = (do |
| 32 | f! | 32 | f! |
| 33 | 123) if f = getHandler! | 33 | 123) if f := getHandler! |
| 34 | 34 | ||
| 35 | (using nil) <- _ | 35 | (using nil) <- _ |
| 36 | 36 | ||
diff --git a/spec/inputs/compile_doc.yue b/spec/inputs/compile_doc.yue index 4ce2b13..64d7d40 100644 --- a/spec/inputs/compile_doc.yue +++ b/spec/inputs/compile_doc.yue | |||
| @@ -8,13 +8,13 @@ for [compiledFile, docFile] in *[ | |||
| 8 | text = \read "*a" | 8 | text = \read "*a" |
| 9 | codes = [] | 9 | codes = [] |
| 10 | for code in text\gmatch "```moonscript(.-)```" | 10 | for code in text\gmatch "```moonscript(.-)```" |
| 11 | if result, err = to_lua code, implicit_return_root: false, reserve_line_number: false | 11 | if result, err := to_lua code, implicit_return_root: false, reserve_line_number: false |
| 12 | codes[] = result | 12 | codes[] = result |
| 13 | elseif not err\match "macro exporting module only accepts macro definition" | 13 | elseif not err\match "macro exporting module only accepts macro definition" |
| 14 | print err | 14 | print err |
| 15 | os.exit 1 | 15 | os.exit 1 |
| 16 | for code in text\gmatch "<pre>(.-)</pre>" | 16 | for code in text\gmatch "<pre>(.-)</pre>" |
| 17 | if result, err = to_lua code\gsub("<", "<")\gsub(">", ">"), implicit_return_root: false, reserve_line_number: false | 17 | if result, err := to_lua code\gsub("<", "<")\gsub(">", ">"), implicit_return_root: false, reserve_line_number: false |
| 18 | codes[] = result | 18 | codes[] = result |
| 19 | else | 19 | else |
| 20 | print err | 20 | print err |
diff --git a/spec/inputs/cond.yue b/spec/inputs/cond.yue index 5bc6c9b..cce96df 100644 --- a/spec/inputs/cond.yue +++ b/spec/inputs/cond.yue | |||
| @@ -52,18 +52,18 @@ elseif "just us" | |||
| 52 | 52 | ||
| 53 | -- | 53 | -- |
| 54 | 54 | ||
| 55 | if something = 10 | 55 | if something := 10 |
| 56 | print something | 56 | print something |
| 57 | else | 57 | else |
| 58 | print "else" | 58 | print "else" |
| 59 | 59 | ||
| 60 | hello = if something = 10 | 60 | hello = if something := 10 |
| 61 | print something | 61 | print something |
| 62 | else | 62 | else |
| 63 | print "else" | 63 | print "else" |
| 64 | 64 | ||
| 65 | 65 | ||
| 66 | hello = 5 + if something = 10 | 66 | hello = 5 + if something := 10 |
| 67 | print something | 67 | print something |
| 68 | 68 | ||
| 69 | --- | 69 | --- |
| @@ -72,9 +72,9 @@ z = false | |||
| 72 | 72 | ||
| 73 | _ = if false | 73 | _ = if false |
| 74 | one | 74 | one |
| 75 | elseif x = true | 75 | elseif x := true |
| 76 | two | 76 | two |
| 77 | elseif z = true | 77 | elseif z := true |
| 78 | three | 78 | three |
| 79 | else | 79 | else |
| 80 | four | 80 | four |
| @@ -82,17 +82,17 @@ else | |||
| 82 | 82 | ||
| 83 | out = if false | 83 | out = if false |
| 84 | one | 84 | one |
| 85 | elseif x = true | 85 | elseif x := true |
| 86 | two | 86 | two |
| 87 | elseif z = true | 87 | elseif z := true |
| 88 | three | 88 | three |
| 89 | else | 89 | else |
| 90 | four | 90 | four |
| 91 | 91 | ||
| 92 | kzy = -> | 92 | kzy = -> |
| 93 | if something = true | 93 | if something := true |
| 94 | 1 | 94 | 1 |
| 95 | elseif another = false | 95 | elseif another := false |
| 96 | 2 | 96 | 2 |
| 97 | 97 | ||
| 98 | --- | 98 | --- |
| @@ -152,7 +152,7 @@ dddd = {1,2,3} unless value | |||
| 152 | 152 | ||
| 153 | do | 153 | do |
| 154 | j = 100 | 154 | j = 100 |
| 155 | unless j = hi! | 155 | unless j := hi! |
| 156 | error "not j!" | 156 | error "not j!" |
| 157 | 157 | ||
| 158 | ---------------- | 158 | ---------------- |
| @@ -200,22 +200,22 @@ do | |||
| 200 | elseif c | 200 | elseif c |
| 201 | d: e = tb | 201 | d: e = tb |
| 202 | 202 | ||
| 203 | if :pi = math | 203 | if :pi := math |
| 204 | print pi | 204 | print pi |
| 205 | 205 | ||
| 206 | do | 206 | do |
| 207 | local math | 207 | local math |
| 208 | if :pi = math | 208 | if :pi := math |
| 209 | print pi | 209 | print pi |
| 210 | 210 | ||
| 211 | do | 211 | do |
| 212 | if _M = {} | 212 | if _M := {} |
| 213 | :Thing = _M | 213 | :Thing = _M |
| 214 | :a, :b = _M | 214 | :a, :b = _M |
| 215 | 215 | ||
| 216 | do | 216 | do |
| 217 | global _M | 217 | global _M |
| 218 | if _M = {} | 218 | if _M := {} |
| 219 | :Thing = _M | 219 | :Thing = _M |
| 220 | :a, :b = _M | 220 | :a, :b = _M |
| 221 | 221 | ||
diff --git a/spec/inputs/destructure.yue b/spec/inputs/destructure.yue index 73e4d33..5017ee1 100644 --- a/spec/inputs/destructure.yue +++ b/spec/inputs/destructure.yue | |||
| @@ -94,18 +94,18 @@ do | |||
| 94 | 94 | ||
| 95 | do | 95 | do |
| 96 | thing = nil | 96 | thing = nil |
| 97 | if {a} = thing | 97 | if {a} := thing |
| 98 | print a | 98 | print a |
| 99 | else | 99 | else |
| 100 | print "nothing" | 100 | print "nothing" |
| 101 | 101 | ||
| 102 | thang = {1,2} | 102 | thang = {1,2} |
| 103 | if {a,b} = thang | 103 | if {a,b} := thang |
| 104 | print a,b | 104 | print a,b |
| 105 | 105 | ||
| 106 | if {a,b} = thing | 106 | if {a,b} := thing |
| 107 | print a,b | 107 | print a,b |
| 108 | elseif {c,d} = thang | 108 | elseif {c,d} := thang |
| 109 | print c,d | 109 | print c,d |
| 110 | else | 110 | else |
| 111 | print "NO" | 111 | print "NO" |
diff --git a/spec/inputs/existential.yue b/spec/inputs/existential.yue index 27891dc..ec38897 100644 --- a/spec/inputs/existential.yue +++ b/spec/inputs/existential.yue | |||
| @@ -16,7 +16,7 @@ with abc?!\func?! | |||
| 16 | if \p? "abc" | 16 | if \p? "abc" |
| 17 | return 123 | 17 | return 123 |
| 18 | 18 | ||
| 19 | if {:x} = a?.if?\then?(123)? @?\function 998 | 19 | if {:x} := a?.if?\then?(123)? @?\function 998 |
| 20 | print x | 20 | print x |
| 21 | 21 | ||
| 22 | res = b.function\do!\while?("OK")\if("def",998)\f? | 22 | res = b.function\do!\while?("OK")\if("def",998)\f? |
diff --git a/spec/inputs/macro_teal.yue b/spec/inputs/macro_teal.yue index a443614..0cfd862 100644 --- a/spec/inputs/macro_teal.yue +++ b/spec/inputs/macro_teal.yue | |||
| @@ -8,7 +8,7 @@ macro to_lua = (code)-> | |||
| 8 | "require('yue').to_lua(#{code}, reserve_line_number:false, same_module:true)" | 8 | "require('yue').to_lua(#{code}, reserve_line_number:false, same_module:true)" |
| 9 | 9 | ||
| 10 | macro trim = (name)-> | 10 | macro trim = (name)-> |
| 11 | "if result = #{name}\\match '[\\'\"](.*)[\\'\"]' then result else #{name}" | 11 | "if result := #{name}\\match '[\\'\"](.*)[\\'\"]' then result else #{name}" |
| 12 | 12 | ||
| 13 | export macro local = (decl, value = nil)-> | 13 | export macro local = (decl, value = nil)-> |
| 14 | import "yue" as {options:{:tl_enabled}} | 14 | import "yue" as {options:{:tl_enabled}} |
diff --git a/spec/inputs/pipe.yue b/spec/inputs/pipe.yue index 02f87a3..b5bae1d 100644 --- a/spec/inputs/pipe.yue +++ b/spec/inputs/pipe.yue | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | b = 1 + 2 + (4 |> tostring |> print(1) or 123) | 12 | b = 1 + 2 + (4 |> tostring |> print(1) or 123) |
| 13 | 13 | ||
| 14 | if x = 233 |> math.max 998 | 14 | if x := 233 |> math.max 998 |
| 15 | print x | 15 | print x |
| 16 | 16 | ||
| 17 | with b |> create? "new" | 17 | with b |> create? "new" |
diff --git a/spec/inputs/plus.yue b/spec/inputs/plus.yue index e387090..9c500a4 100644 --- a/spec/inputs/plus.yue +++ b/spec/inputs/plus.yue | |||
| @@ -8,13 +8,13 @@ c.repeat.if\then("xyz")\else res | |||
| 8 | 8 | ||
| 9 | print @for,@@function 123 | 9 | print @for,@@function 123 |
| 10 | 10 | ||
| 11 | if fcolor = message\match "<%w*>" then message = message\gsub "<%->", fcolor | 11 | if fcolor := message\match "<%w*>" then message = message\gsub "<%->", fcolor |
| 12 | 12 | ||
| 13 | message = message\gsub "<%->", fcolor if fcolor = message\match "<%w*>" | 13 | message = message\gsub "<%->", fcolor if fcolor := message\match "<%w*>" |
| 14 | 14 | ||
| 15 | valA = func! if func = getfunc! | 15 | valA = func! if func := getfunc! |
| 16 | 16 | ||
| 17 | local valA = func! if func = getfunc! | 17 | local valA = func! if func := getfunc! |
| 18 | 18 | ||
| 19 | valB = do | 19 | valB = do |
| 20 | func = getfunc! | 20 | func = getfunc! |
diff --git a/spec/inputs/try_catch.yue b/spec/inputs/try_catch.yue index 96a87fc..ccb3f52 100644 --- a/spec/inputs/try_catch.yue +++ b/spec/inputs/try_catch.yue | |||
| @@ -39,14 +39,14 @@ catch err | |||
| 39 | print "OK" | 39 | print "OK" |
| 40 | 40 | ||
| 41 | do | 41 | do |
| 42 | if success, result = try func "abc", 123 | 42 | if success, result := try func "abc", 123 |
| 43 | print result | 43 | print result |
| 44 | 44 | ||
| 45 | success, result = try func "abc", 123 | 45 | success, result = try func "abc", 123 |
| 46 | catch err | 46 | catch err |
| 47 | print err | 47 | print err |
| 48 | 48 | ||
| 49 | print result if success, result = try func "abc", 123 | 49 | print result if success, result := try func "abc", 123 |
| 50 | catch err | 50 | catch err |
| 51 | print err | 51 | print err |
| 52 | 52 | ||
diff --git a/spec/inputs/unicode/assign.yue b/spec/inputs/unicode/assign.yue index 5392a92..6c03f86 100644 --- a/spec/inputs/unicode/assign.yue +++ b/spec/inputs/unicode/assign.yue | |||
| @@ -30,7 +30,7 @@ else | |||
| 30 | 30 | ||
| 31 | 变量x = (do | 31 | 变量x = (do |
| 32 | 函数! | 32 | 函数! |
| 33 | 123) if 函数 = 获取处理函数! | 33 | 123) if 函数 := 获取处理函数! |
| 34 | 34 | ||
| 35 | (using nil) <- _无效变量 | 35 | (using nil) <- _无效变量 |
| 36 | 36 | ||
diff --git a/spec/inputs/unicode/cond.yue b/spec/inputs/unicode/cond.yue index fca6d60..dde5c99 100644 --- a/spec/inputs/unicode/cond.yue +++ b/spec/inputs/unicode/cond.yue | |||
| @@ -52,18 +52,18 @@ elseif "只有我们" | |||
| 52 | 52 | ||
| 53 | -- | 53 | -- |
| 54 | 54 | ||
| 55 | if 某东西 = 10 | 55 | if 某东西 := 10 |
| 56 | 打印 某东西 | 56 | 打印 某东西 |
| 57 | else | 57 | else |
| 58 | 打印 "其它" | 58 | 打印 "其它" |
| 59 | 59 | ||
| 60 | 你好 = if 某东西 = 10 | 60 | 你好 = if 某东西 := 10 |
| 61 | 打印 某东西 | 61 | 打印 某东西 |
| 62 | else | 62 | else |
| 63 | 打印 "其它" | 63 | 打印 "其它" |
| 64 | 64 | ||
| 65 | 65 | ||
| 66 | 你好 = 5 + if 某东西 = 10 | 66 | 你好 = 5 + if 某东西 := 10 |
| 67 | 打印 某东西 | 67 | 打印 某东西 |
| 68 | 68 | ||
| 69 | --- | 69 | --- |
| @@ -72,9 +72,9 @@ z变量 = false | |||
| 72 | 72 | ||
| 73 | _无效变量 = if false | 73 | _无效变量 = if false |
| 74 | 一 | 74 | 一 |
| 75 | elseif 条件x = true | 75 | elseif 条件x := true |
| 76 | 二 | 76 | 二 |
| 77 | elseif 条件z = true | 77 | elseif 条件z := true |
| 78 | 三 | 78 | 三 |
| 79 | else | 79 | else |
| 80 | 四 | 80 | 四 |
| @@ -82,17 +82,17 @@ else | |||
| 82 | 82 | ||
| 83 | 输出 = if false | 83 | 输出 = if false |
| 84 | 一 | 84 | 一 |
| 85 | elseif 条件x = true | 85 | elseif 条件x := true |
| 86 | 二 | 86 | 二 |
| 87 | elseif 条件z = true | 87 | elseif 条件z := true |
| 88 | 三 | 88 | 三 |
| 89 | else | 89 | else |
| 90 | 四 | 90 | 四 |
| 91 | 91 | ||
| 92 | 变量 = -> | 92 | 变量 = -> |
| 93 | if 某东西 = true | 93 | if 某东西 := true |
| 94 | 1 | 94 | 1 |
| 95 | elseif 另一个 = false | 95 | elseif 另一个 := false |
| 96 | 2 | 96 | 2 |
| 97 | 97 | ||
| 98 | --- | 98 | --- |
| @@ -152,7 +152,7 @@ else | |||
| 152 | 152 | ||
| 153 | do | 153 | do |
| 154 | j变量 = 100 | 154 | j变量 = 100 |
| 155 | unless j变量 = 嗨! | 155 | unless j变量 := 嗨! |
| 156 | 错误 "不是 j变量!" | 156 | 错误 "不是 j变量!" |
| 157 | 157 | ||
| 158 | ---------------- | 158 | ---------------- |
| @@ -200,22 +200,22 @@ do | |||
| 200 | elseif 条件c | 200 | elseif 条件c |
| 201 | 字段d: 变量e = 变量tb | 201 | 字段d: 变量e = 变量tb |
| 202 | 202 | ||
| 203 | if :派 = 数学库 | 203 | if :派 := 数学库 |
| 204 | 打印 派 | 204 | 打印 派 |
| 205 | 205 | ||
| 206 | do | 206 | do |
| 207 | local 数学库 | 207 | local 数学库 |
| 208 | if :派 = 数学库 | 208 | if :派 := 数学库 |
| 209 | 打印 派 | 209 | 打印 派 |
| 210 | 210 | ||
| 211 | do | 211 | do |
| 212 | if _模块 = {} | 212 | if _模块 := {} |
| 213 | :东西 = _模块 | 213 | :东西 = _模块 |
| 214 | :a功能, :b功能 = _模块 | 214 | :a功能, :b功能 = _模块 |
| 215 | 215 | ||
| 216 | do | 216 | do |
| 217 | global _模块 | 217 | global _模块 |
| 218 | if _模块 = {} | 218 | if _模块 := {} |
| 219 | :东西 = _模块 | 219 | :东西 = _模块 |
| 220 | :a功能, :b功能 = _模块 | 220 | :a功能, :b功能 = _模块 |
| 221 | 221 | ||
diff --git a/spec/inputs/unicode/destructure.yue b/spec/inputs/unicode/destructure.yue index 5efdf82..3c3a369 100644 --- a/spec/inputs/unicode/destructure.yue +++ b/spec/inputs/unicode/destructure.yue | |||
| @@ -92,18 +92,18 @@ do | |||
| 92 | 92 | ||
| 93 | do | 93 | do |
| 94 | 东西 = nil | 94 | 东西 = nil |
| 95 | if {元素a} = 东西 | 95 | if {元素a} := 东西 |
| 96 | 打印 元素a | 96 | 打印 元素a |
| 97 | else | 97 | else |
| 98 | 打印 "没东西" | 98 | 打印 "没东西" |
| 99 | 99 | ||
| 100 | 东东 = {1,2} | 100 | 东东 = {1,2} |
| 101 | if {元素a,元素b} = 东东 | 101 | if {元素a,元素b} := 东东 |
| 102 | 打印 元素a,元素b | 102 | 打印 元素a,元素b |
| 103 | 103 | ||
| 104 | if {元素a,元素b} = 东西 | 104 | if {元素a,元素b} := 东西 |
| 105 | 打印 元素a,元素b | 105 | 打印 元素a,元素b |
| 106 | elseif {元素c,元素d} = 东东 | 106 | elseif {元素c,元素d} := 东东 |
| 107 | 打印 元素c,元素d | 107 | 打印 元素c,元素d |
| 108 | else | 108 | else |
| 109 | 打印 "不" | 109 | 打印 "不" |
diff --git a/spec/inputs/unicode/existential.yue b/spec/inputs/unicode/existential.yue index 0e35a39..de65027 100644 --- a/spec/inputs/unicode/existential.yue +++ b/spec/inputs/unicode/existential.yue | |||
| @@ -16,7 +16,7 @@ with 对象abc?!\函数?! | |||
| 16 | if \函数p? "abc" | 16 | if \函数p? "abc" |
| 17 | return 123 | 17 | return 123 |
| 18 | 18 | ||
| 19 | if {:x字段} = 对象a?.如果?\然后?(123)? @?\方法 998 | 19 | if {:x字段} := 对象a?.如果?\然后?(123)? @?\方法 998 |
| 20 | 打印 x字段 | 20 | 打印 x字段 |
| 21 | 21 | ||
| 22 | 结果 = 对象b.方法\执行!\当?("没问题")\如果("默认",998)\函数? | 22 | 结果 = 对象b.方法\执行!\当?("没问题")\如果("默认",998)\函数? |
diff --git a/spec/inputs/unicode/pipe.yue b/spec/inputs/unicode/pipe.yue index 2cd41ee..085a2cf 100644 --- a/spec/inputs/unicode/pipe.yue +++ b/spec/inputs/unicode/pipe.yue | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | 11 | ||
| 12 | 变量b = 1 + 2 + (4 |> tostring |> 打印(1) or 123) | 12 | 变量b = 1 + 2 + (4 |> tostring |> 打印(1) or 123) |
| 13 | 13 | ||
| 14 | if 变量x = 233 |> math.max 998 | 14 | if 变量x := 233 |> math.max 998 |
| 15 | 打印 变量x | 15 | 打印 变量x |
| 16 | 16 | ||
| 17 | with 变量b |> 创建? "new" | 17 | with 变量b |> 创建? "new" |
diff --git a/spec/inputs/unicode/plus.yue b/spec/inputs/unicode/plus.yue index b08974f..70b57bb 100644 --- a/spec/inputs/unicode/plus.yue +++ b/spec/inputs/unicode/plus.yue | |||
| @@ -8,13 +8,13 @@ | |||
| 8 | 8 | ||
| 9 | 打印 @循环, @@函数 123 | 9 | 打印 @循环, @@函数 123 |
| 10 | 10 | ||
| 11 | if 颜色 = 消息\匹配 "<%w*>" then 消息 = 消息\替换 "<%->", 颜色 | 11 | if 颜色 := 消息\匹配 "<%w*>" then 消息 = 消息\替换 "<%->", 颜色 |
| 12 | 12 | ||
| 13 | 消息 = 消息\替换 "<%->", 颜色 if 颜色 = 消息\匹配 "<%w*>" | 13 | 消息 = 消息\替换 "<%->", 颜色 if 颜色 := 消息\匹配 "<%w*>" |
| 14 | 14 | ||
| 15 | 数值A = 方法! if 方法 = 获取方法! | 15 | 数值A = 方法! if 方法 := 获取方法! |
| 16 | 16 | ||
| 17 | local 数值A = 方法! if 方法 = 获取方法! | 17 | local 数值A = 方法! if 方法 := 获取方法! |
| 18 | 18 | ||
| 19 | 数值B = do | 19 | 数值B = do |
| 20 | 方法 = 获取方法! | 20 | 方法 = 获取方法! |
diff --git a/spec/inputs/unicode/try_catch.yue b/spec/inputs/unicode/try_catch.yue index 71e03ee..1156d8e 100644 --- a/spec/inputs/unicode/try_catch.yue +++ b/spec/inputs/unicode/try_catch.yue | |||
| @@ -39,14 +39,14 @@ catch 错误 | |||
| 39 | 打印 "好的" | 39 | 打印 "好的" |
| 40 | 40 | ||
| 41 | do | 41 | do |
| 42 | if 成功, 结果 = try 函数 "abc", 123 | 42 | if 成功, 结果 := try 函数 "abc", 123 |
| 43 | 打印 结果 | 43 | 打印 结果 |
| 44 | 44 | ||
| 45 | 成功, 结果 = try 函数 "abc", 123 | 45 | 成功, 结果 = try 函数 "abc", 123 |
| 46 | catch 错误 | 46 | catch 错误 |
| 47 | 打印 错误 | 47 | 打印 错误 |
| 48 | 48 | ||
| 49 | 打印 结果 if 成功, 结果 = try 函数 "abc", 123 | 49 | 打印 结果 if 成功, 结果 := try 函数 "abc", 123 |
| 50 | catch 错误 | 50 | catch 错误 |
| 51 | 打印 错误 | 51 | 打印 错误 |
| 52 | 52 | ||
