diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/inputs/ambiguous.yue (renamed from spec/inputs/ambiguous.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/assign.yue (renamed from spec/inputs/assign.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/attrib.yue (renamed from spec/inputs/attrib.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/backcall.yue (renamed from spec/inputs/backcall.mp) | 14 | ||||
-rw-r--r-- | spec/inputs/bubbling.yue (renamed from spec/inputs/bubbling.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/class.yue (renamed from spec/inputs/class.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/comprehension.yue (renamed from spec/inputs/comprehension.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/cond.yue (renamed from spec/inputs/cond.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/destructure.yue (renamed from spec/inputs/destructure.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/do.yue (renamed from spec/inputs/do.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/existential.yue (renamed from spec/inputs/existential.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/export.yue (renamed from spec/inputs/export.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/export_default.yue (renamed from spec/inputs/export_default.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/funcs.yue (renamed from spec/inputs/funcs.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/global.yue (renamed from spec/inputs/global.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/goto.yue (renamed from spec/inputs/goto.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/import.yue (renamed from spec/inputs/import.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/lists.yue (renamed from spec/inputs/lists.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/literals.yue (renamed from spec/inputs/literals.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/local.yue (renamed from spec/inputs/local.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/loops.yue (renamed from spec/inputs/loops.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/macro-export.yue (renamed from spec/inputs/macro-export.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/macro-teal.yue (renamed from spec/inputs/macro-teal.mp) | 12 | ||||
-rw-r--r-- | spec/inputs/macro.yue (renamed from spec/inputs/macro.mp) | 2 | ||||
-rw-r--r-- | spec/inputs/multiline_chain.yue (renamed from spec/inputs/multiline_chain.mp) | 37 | ||||
-rw-r--r-- | spec/inputs/operators.yue (renamed from spec/inputs/operators.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/plus.yue (renamed from spec/inputs/plus.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/return.yue (renamed from spec/inputs/return.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/string.yue (renamed from spec/inputs/string.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/stub.yue (renamed from spec/inputs/stub.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/switch.yue (renamed from spec/inputs/switch.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/syntax.yue (renamed from spec/inputs/syntax.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/tables.yue (renamed from spec/inputs/tables.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/teal-lang.yue (renamed from spec/inputs/teal-lang.mp) | 2 | ||||
-rw-r--r-- | spec/inputs/unless_else.yue (renamed from spec/inputs/unless_else.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/using.yue (renamed from spec/inputs/using.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/whitespace.yue (renamed from spec/inputs/whitespace.mp) | 0 | ||||
-rw-r--r-- | spec/inputs/with.yue (renamed from spec/inputs/with.mp) | 0 |
38 files changed, 56 insertions, 11 deletions
diff --git a/spec/inputs/ambiguous.mp b/spec/inputs/ambiguous.yue index d147e8e..d147e8e 100644 --- a/spec/inputs/ambiguous.mp +++ b/spec/inputs/ambiguous.yue | |||
diff --git a/spec/inputs/assign.mp b/spec/inputs/assign.yue index dac2ba3..dac2ba3 100644 --- a/spec/inputs/assign.mp +++ b/spec/inputs/assign.yue | |||
diff --git a/spec/inputs/attrib.mp b/spec/inputs/attrib.yue index 7e9a42c..7e9a42c 100644 --- a/spec/inputs/attrib.mp +++ b/spec/inputs/attrib.yue | |||
diff --git a/spec/inputs/backcall.mp b/spec/inputs/backcall.yue index 0d52f3f..bad3a56 100644 --- a/spec/inputs/backcall.mp +++ b/spec/inputs/backcall.yue | |||
@@ -36,6 +36,20 @@ arr[3] |> f 1, 2, _, 4, 5 | |||
36 | 36 | ||
37 | a = {"1","2","3"} |> table.concat("") |> tonumber |> f1(1, 2, 3, _) |> f2(1, _, 3) | 37 | a = {"1","2","3"} |> table.concat("") |> tonumber |> f1(1, 2, 3, _) |> f2(1, _, 3) |
38 | 38 | ||
39 | readFile("example.txt") |> | ||
40 | extract(_, language, {}) |> | ||
41 | parse(_, language) |> | ||
42 | emit |> | ||
43 | render |> | ||
44 | |||
45 | |||
46 | readFile("example.txt") \ | ||
47 | |> extract(_, language, {}) \ | ||
48 | |> parse(_, language) \ | ||
49 | |> emit \ | ||
50 | |> render \ | ||
51 | |||
52 | |||
39 | readFile "example.txt" | 53 | readFile "example.txt" |
40 | |> extract _, language, {} | 54 | |> extract _, language, {} |
41 | |> parse _, language | 55 | |> parse _, language |
diff --git a/spec/inputs/bubbling.mp b/spec/inputs/bubbling.yue index 23a85d4..23a85d4 100644 --- a/spec/inputs/bubbling.mp +++ b/spec/inputs/bubbling.yue | |||
diff --git a/spec/inputs/class.mp b/spec/inputs/class.yue index ca8b58c..ca8b58c 100644 --- a/spec/inputs/class.mp +++ b/spec/inputs/class.yue | |||
diff --git a/spec/inputs/comprehension.mp b/spec/inputs/comprehension.yue index b6adb94..b6adb94 100644 --- a/spec/inputs/comprehension.mp +++ b/spec/inputs/comprehension.yue | |||
diff --git a/spec/inputs/cond.mp b/spec/inputs/cond.yue index 3dee99b..3dee99b 100644 --- a/spec/inputs/cond.mp +++ b/spec/inputs/cond.yue | |||
diff --git a/spec/inputs/destructure.mp b/spec/inputs/destructure.yue index 49e6393..49e6393 100644 --- a/spec/inputs/destructure.mp +++ b/spec/inputs/destructure.yue | |||
diff --git a/spec/inputs/do.mp b/spec/inputs/do.yue index 2fbcbb9..2fbcbb9 100644 --- a/spec/inputs/do.mp +++ b/spec/inputs/do.yue | |||
diff --git a/spec/inputs/existential.mp b/spec/inputs/existential.yue index 3055705..3055705 100644 --- a/spec/inputs/existential.mp +++ b/spec/inputs/existential.yue | |||
diff --git a/spec/inputs/export.mp b/spec/inputs/export.yue index 085510e..085510e 100644 --- a/spec/inputs/export.mp +++ b/spec/inputs/export.yue | |||
diff --git a/spec/inputs/export_default.mp b/spec/inputs/export_default.yue index 73f43ac..73f43ac 100644 --- a/spec/inputs/export_default.mp +++ b/spec/inputs/export_default.yue | |||
diff --git a/spec/inputs/funcs.mp b/spec/inputs/funcs.yue index 0e45ff1..0e45ff1 100644 --- a/spec/inputs/funcs.mp +++ b/spec/inputs/funcs.yue | |||
diff --git a/spec/inputs/global.mp b/spec/inputs/global.yue index 7d6cfde..7d6cfde 100644 --- a/spec/inputs/global.mp +++ b/spec/inputs/global.yue | |||
diff --git a/spec/inputs/goto.mp b/spec/inputs/goto.yue index 1197251..1197251 100644 --- a/spec/inputs/goto.mp +++ b/spec/inputs/goto.yue | |||
diff --git a/spec/inputs/import.mp b/spec/inputs/import.yue index e075404..e075404 100644 --- a/spec/inputs/import.mp +++ b/spec/inputs/import.yue | |||
diff --git a/spec/inputs/lists.mp b/spec/inputs/lists.yue index 15eb9ab..15eb9ab 100644 --- a/spec/inputs/lists.mp +++ b/spec/inputs/lists.yue | |||
diff --git a/spec/inputs/literals.mp b/spec/inputs/literals.yue index d4b0326..d4b0326 100644 --- a/spec/inputs/literals.mp +++ b/spec/inputs/literals.yue | |||
diff --git a/spec/inputs/local.mp b/spec/inputs/local.yue index 33251a9..33251a9 100644 --- a/spec/inputs/local.mp +++ b/spec/inputs/local.yue | |||
diff --git a/spec/inputs/loops.mp b/spec/inputs/loops.yue index 8946a2f..8946a2f 100644 --- a/spec/inputs/loops.mp +++ b/spec/inputs/loops.yue | |||
diff --git a/spec/inputs/macro-export.mp b/spec/inputs/macro-export.yue index d669975..d669975 100644 --- a/spec/inputs/macro-export.mp +++ b/spec/inputs/macro-export.yue | |||
diff --git a/spec/inputs/macro-teal.mp b/spec/inputs/macro-teal.yue index 37cde1c..3a9bb2b 100644 --- a/spec/inputs/macro-teal.mp +++ b/spec/inputs/macro-teal.yue | |||
@@ -1,17 +1,17 @@ | |||
1 | $ -> | 1 | $ -> |
2 | import "moonp" as {:options} | 2 | import "yue" as {:options} |
3 | if options.tl_enabled | 3 | if options.tl_enabled |
4 | options.target_extension = "tl" | 4 | options.target_extension = "tl" |
5 | package.path ..= "?.lua;./spec/lib/?.lua" | 5 | package.path ..= "?.lua;./spec/lib/?.lua" |
6 | 6 | ||
7 | macro to_lua = (codes)-> | 7 | macro to_lua = (codes)-> |
8 | "require('moonp').to_lua(#{codes}, reserve_line_number:false, same_module:true)" | 8 | "require('yue').to_lua(#{codes}, 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 "moonp" as {options:{:tl_enabled}} | 14 | import "yue" as {options:{:tl_enabled}} |
15 | name, type = ($trim decl)\match "(.-):(.*)" | 15 | name, type = ($trim decl)\match "(.-):(.*)" |
16 | if not (name and type) | 16 | if not (name and type) |
17 | error "invalid local varaible declaration for \"#{decl}\"" | 17 | error "invalid local varaible declaration for \"#{decl}\"" |
@@ -27,7 +27,7 @@ export macro local = (decl, value = nil)-> | |||
27 | } | 27 | } |
28 | 28 | ||
29 | export macro function = (decl, value)-> | 29 | export macro function = (decl, value)-> |
30 | import "moonp" as {options:{:tl_enabled}} | 30 | import "yue" as {options:{:tl_enabled}} |
31 | import "tl" | 31 | import "tl" |
32 | decl = $trim decl | 32 | decl = $trim decl |
33 | name, type = decl\match "(.-)(%(.*)" | 33 | name, type = decl\match "(.-)(%(.*)" |
@@ -50,7 +50,7 @@ export macro function = (decl, value)-> | |||
50 | } | 50 | } |
51 | 51 | ||
52 | export macro record = (name, decl)-> | 52 | export macro record = (name, decl)-> |
53 | import "moonp" as {options:{:tl_enabled}} | 53 | import "yue" as {options:{:tl_enabled}} |
54 | codes = if tl_enabled | 54 | codes = if tl_enabled |
55 | "local record #{name} | 55 | "local record #{name} |
56 | #{decl} | 56 | #{decl} |
@@ -64,7 +64,7 @@ end" | |||
64 | } | 64 | } |
65 | 65 | ||
66 | export macro method = (decl, value)-> | 66 | export macro method = (decl, value)-> |
67 | import "moonp" as {options:{:tl_enabled}} | 67 | import "yue" as {options:{:tl_enabled}} |
68 | import "tl" | 68 | import "tl" |
69 | decl = $trim decl | 69 | decl = $trim decl |
70 | tab, sym, func, type = decl\match "(.-)([%.:])(.-)(%(.*)" | 70 | tab, sym, func, type = decl\match "(.-)([%.:])(.-)(%(.*)" |
diff --git a/spec/inputs/macro.mp b/spec/inputs/macro.yue index f0292c7..eb3cf75 100644 --- a/spec/inputs/macro.mp +++ b/spec/inputs/macro.yue | |||
@@ -1,5 +1,5 @@ | |||
1 | $ -> | 1 | $ -> |
2 | package.moonpath = "?.mp;./spec/inputs/?.mp" | 2 | package.yuepath = "?.yue;./spec/inputs/?.yue" |
3 | 3 | ||
4 | import "macro-export" as { | 4 | import "macro-export" as { |
5 | $, -- import all macros | 5 | $, -- import all macros |
diff --git a/spec/inputs/multiline_chain.mp b/spec/inputs/multiline_chain.yue index e1e363f..d582ed0 100644 --- a/spec/inputs/multiline_chain.mp +++ b/spec/inputs/multiline_chain.yue | |||
@@ -1,15 +1,44 @@ | |||
1 | x = a | 1 | x = a |
2 | .b | 2 | .b |
3 | .c | ||
4 | --[[chain item]] .d | ||
3 | 5 | ||
4 | x | 6 | x |
5 | .y = a | 7 | .y = a |
6 | \b! | 8 | .b |
9 | \c! | ||
7 | 10 | ||
8 | func 1, arg2 | 11 | func 1, arg2 |
9 | .value | 12 | .value |
10 | \get!, arg3 | 13 | \get!, arg3 |
11 | .value | 14 | .value |
12 | \get! | 15 | \get! |
16 | * 1 | ||
17 | * x? | ||
18 | .y? | ||
19 | .z? | ||
20 | * 3 | ||
21 | |||
22 | tbb = | ||
23 | k1: a | ||
24 | \b 123 | ||
25 | .c! | ||
26 | k2: | ||
27 | w1: a! | ||
28 | .b | ||
29 | \c! | ||
30 | |||
31 | tb = f1{} | ||
32 | .a | ||
33 | |> f2? "abc", _ | ||
34 | |||
35 | f = -> [a | ||
36 | .b | ||
37 | \c 123 for {a} in *vals] | ||
38 | |||
39 | f1 = -> x, a | ||
40 | \b 123 | ||
41 | .c "abc" | ||
13 | 42 | ||
14 | result = origin | 43 | result = origin |
15 | .transform.root | 44 | .transform.root |
@@ -33,9 +62,8 @@ origin.transform.root.gameObject | |||
33 | \Where (x)-> x.name\EndsWith "(Clone)" | 62 | \Where (x)-> x.name\EndsWith "(Clone)" |
34 | \Destroy! | 63 | \Destroy! |
35 | 64 | ||
36 | with item() | 65 | with item |
37 | .itemFieldA = 123 | 66 | .itemFieldA = 123 |
38 | item = x | ||
39 | 67 | ||
40 | \callMethod!\chainCall! | 68 | \callMethod!\chainCall! |
41 | 69 | ||
@@ -59,6 +87,9 @@ with item() | |||
59 | for v in *values | 87 | for v in *values |
60 | \itemMethodC v | 88 | \itemMethodC v |
61 | 89 | ||
90 | for i = 1, counter | ||
91 | \itemMethodC i | ||
92 | |||
62 | unless .b | 93 | unless .b |
63 | .c = while .itemFieldD | 94 | .c = while .itemFieldD |
64 | \itemNext! | 95 | \itemNext! |
diff --git a/spec/inputs/operators.mp b/spec/inputs/operators.yue index 57e58d6..57e58d6 100644 --- a/spec/inputs/operators.mp +++ b/spec/inputs/operators.yue | |||
diff --git a/spec/inputs/plus.mp b/spec/inputs/plus.yue index e387090..e387090 100644 --- a/spec/inputs/plus.mp +++ b/spec/inputs/plus.yue | |||
diff --git a/spec/inputs/return.mp b/spec/inputs/return.yue index f170ffd..f170ffd 100644 --- a/spec/inputs/return.mp +++ b/spec/inputs/return.yue | |||
diff --git a/spec/inputs/string.mp b/spec/inputs/string.yue index 5d8f772..5d8f772 100644 --- a/spec/inputs/string.mp +++ b/spec/inputs/string.yue | |||
diff --git a/spec/inputs/stub.mp b/spec/inputs/stub.yue index 60347e7..60347e7 100644 --- a/spec/inputs/stub.mp +++ b/spec/inputs/stub.yue | |||
diff --git a/spec/inputs/switch.mp b/spec/inputs/switch.yue index ac3dbea..ac3dbea 100644 --- a/spec/inputs/switch.mp +++ b/spec/inputs/switch.yue | |||
diff --git a/spec/inputs/syntax.mp b/spec/inputs/syntax.yue index 4df5785..4df5785 100644 --- a/spec/inputs/syntax.mp +++ b/spec/inputs/syntax.yue | |||
diff --git a/spec/inputs/tables.mp b/spec/inputs/tables.yue index 2c6dff9..2c6dff9 100644 --- a/spec/inputs/tables.mp +++ b/spec/inputs/tables.yue | |||
diff --git a/spec/inputs/teal-lang.mp b/spec/inputs/teal-lang.yue index 3368b95..1993203 100644 --- a/spec/inputs/teal-lang.mp +++ b/spec/inputs/teal-lang.yue | |||
@@ -1,5 +1,5 @@ | |||
1 | $ -> | 1 | $ -> |
2 | package.moonpath = "?.mp;./spec/inputs/?.mp" | 2 | package.yuepath = "?.yue;./spec/inputs/?.yue" |
3 | 3 | ||
4 | import "macro-teal" as {$} | 4 | import "macro-teal" as {$} |
5 | 5 | ||
diff --git a/spec/inputs/unless_else.mp b/spec/inputs/unless_else.yue index b421d4d..b421d4d 100644 --- a/spec/inputs/unless_else.mp +++ b/spec/inputs/unless_else.yue | |||
diff --git a/spec/inputs/using.mp b/spec/inputs/using.yue index fe0a433..fe0a433 100644 --- a/spec/inputs/using.mp +++ b/spec/inputs/using.yue | |||
diff --git a/spec/inputs/whitespace.mp b/spec/inputs/whitespace.yue index 329280f..329280f 100644 --- a/spec/inputs/whitespace.mp +++ b/spec/inputs/whitespace.yue | |||
diff --git a/spec/inputs/with.mp b/spec/inputs/with.yue index d88e109..d88e109 100644 --- a/spec/inputs/with.mp +++ b/spec/inputs/with.yue | |||