diff options
author | Li Jin <dragon-fly@qq.com> | 2020-10-08 13:01:18 +0800 |
---|---|---|
committer | Li Jin <dragon-fly@qq.com> | 2020-10-08 13:01:18 +0800 |
commit | 97bbe98289fb74c7cf2d9793b80a1a27b4146045 (patch) | |
tree | 4bee0dded55bad28f6822b6e2dd3ea5251c66ae2 /spec | |
parent | 5b656d2913e4f9f0017698ec835ce4ddda1dc81f (diff) | |
download | yuescript-97bbe98289fb74c7cf2d9793b80a1a27b4146045.tar.gz yuescript-97bbe98289fb74c7cf2d9793b80a1a27b4146045.tar.bz2 yuescript-97bbe98289fb74c7cf2d9793b80a1a27b4146045.zip |
change file extension moonp.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/inputs/ambiguous.mp (renamed from spec/inputs/ambiguous.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/assign.mp (renamed from spec/inputs/assign.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/attrib.mp (renamed from spec/inputs/attrib.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/backcall.mp (renamed from spec/inputs/backcall.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/bubbling.mp (renamed from spec/inputs/bubbling.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/class.mp (renamed from spec/inputs/class.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/comprehension.mp (renamed from spec/inputs/comprehension.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/cond.mp (renamed from spec/inputs/cond.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/destructure.mp (renamed from spec/inputs/destructure.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/do.mp (renamed from spec/inputs/do.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/existential.mp (renamed from spec/inputs/existential.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/export.mp (renamed from spec/inputs/export.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/export_default.mp (renamed from spec/inputs/export_default.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/funcs.mp (renamed from spec/inputs/funcs.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/global.mp (renamed from spec/inputs/global.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/goto.mp (renamed from spec/inputs/goto.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/import.mp (renamed from spec/inputs/import.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/lists.mp (renamed from spec/inputs/lists.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/literals.mp (renamed from spec/inputs/literals.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/local.mp (renamed from spec/inputs/local.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/loops.mp (renamed from spec/inputs/loops.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/macro.mp (renamed from spec/inputs/macro.moon) | 16 | ||||
-rw-r--r-- | spec/inputs/macro_export.mp (renamed from spec/inputs/macro_export.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/operators.mp (renamed from spec/inputs/operators.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/plus.mp (renamed from spec/inputs/plus.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/return.mp (renamed from spec/inputs/return.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/string.mp (renamed from spec/inputs/string.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/stub.mp (renamed from spec/inputs/stub.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/switch.mp (renamed from spec/inputs/switch.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/syntax.mp (renamed from spec/inputs/syntax.moon) | 8 | ||||
-rw-r--r-- | spec/inputs/tables.mp (renamed from spec/inputs/tables.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/unless_else.mp (renamed from spec/inputs/unless_else.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/using.mp (renamed from spec/inputs/using.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/whitespace.mp (renamed from spec/inputs/whitespace.moon) | 0 | ||||
-rw-r--r-- | spec/inputs/with.mp (renamed from spec/inputs/with.moon) | 0 |
35 files changed, 13 insertions, 11 deletions
diff --git a/spec/inputs/ambiguous.moon b/spec/inputs/ambiguous.mp index a5980db..a5980db 100644 --- a/spec/inputs/ambiguous.moon +++ b/spec/inputs/ambiguous.mp | |||
diff --git a/spec/inputs/assign.moon b/spec/inputs/assign.mp index dac2ba3..dac2ba3 100644 --- a/spec/inputs/assign.moon +++ b/spec/inputs/assign.mp | |||
diff --git a/spec/inputs/attrib.moon b/spec/inputs/attrib.mp index bc1e67e..bc1e67e 100644 --- a/spec/inputs/attrib.moon +++ b/spec/inputs/attrib.mp | |||
diff --git a/spec/inputs/backcall.moon b/spec/inputs/backcall.mp index a648b16..a648b16 100644 --- a/spec/inputs/backcall.moon +++ b/spec/inputs/backcall.mp | |||
diff --git a/spec/inputs/bubbling.moon b/spec/inputs/bubbling.mp index 23a85d4..23a85d4 100644 --- a/spec/inputs/bubbling.moon +++ b/spec/inputs/bubbling.mp | |||
diff --git a/spec/inputs/class.moon b/spec/inputs/class.mp index ca8b58c..ca8b58c 100644 --- a/spec/inputs/class.moon +++ b/spec/inputs/class.mp | |||
diff --git a/spec/inputs/comprehension.moon b/spec/inputs/comprehension.mp index b6adb94..b6adb94 100644 --- a/spec/inputs/comprehension.moon +++ b/spec/inputs/comprehension.mp | |||
diff --git a/spec/inputs/cond.moon b/spec/inputs/cond.mp index 3dee99b..3dee99b 100644 --- a/spec/inputs/cond.moon +++ b/spec/inputs/cond.mp | |||
diff --git a/spec/inputs/destructure.moon b/spec/inputs/destructure.mp index 49e6393..49e6393 100644 --- a/spec/inputs/destructure.moon +++ b/spec/inputs/destructure.mp | |||
diff --git a/spec/inputs/do.moon b/spec/inputs/do.mp index 2fbcbb9..2fbcbb9 100644 --- a/spec/inputs/do.moon +++ b/spec/inputs/do.mp | |||
diff --git a/spec/inputs/existential.moon b/spec/inputs/existential.mp index 3055705..3055705 100644 --- a/spec/inputs/existential.moon +++ b/spec/inputs/existential.mp | |||
diff --git a/spec/inputs/export.moon b/spec/inputs/export.mp index 9a494d9..9a494d9 100644 --- a/spec/inputs/export.moon +++ b/spec/inputs/export.mp | |||
diff --git a/spec/inputs/export_default.moon b/spec/inputs/export_default.mp index 73f43ac..73f43ac 100644 --- a/spec/inputs/export_default.moon +++ b/spec/inputs/export_default.mp | |||
diff --git a/spec/inputs/funcs.moon b/spec/inputs/funcs.mp index 4176e33..4176e33 100644 --- a/spec/inputs/funcs.moon +++ b/spec/inputs/funcs.mp | |||
diff --git a/spec/inputs/global.moon b/spec/inputs/global.mp index 7d6cfde..7d6cfde 100644 --- a/spec/inputs/global.moon +++ b/spec/inputs/global.mp | |||
diff --git a/spec/inputs/goto.moon b/spec/inputs/goto.mp index 3410ca3..3410ca3 100644 --- a/spec/inputs/goto.moon +++ b/spec/inputs/goto.mp | |||
diff --git a/spec/inputs/import.moon b/spec/inputs/import.mp index 99981f8..99981f8 100644 --- a/spec/inputs/import.moon +++ b/spec/inputs/import.mp | |||
diff --git a/spec/inputs/lists.moon b/spec/inputs/lists.mp index 15eb9ab..15eb9ab 100644 --- a/spec/inputs/lists.moon +++ b/spec/inputs/lists.mp | |||
diff --git a/spec/inputs/literals.moon b/spec/inputs/literals.mp index d4b0326..d4b0326 100644 --- a/spec/inputs/literals.moon +++ b/spec/inputs/literals.mp | |||
diff --git a/spec/inputs/local.moon b/spec/inputs/local.mp index 33251a9..33251a9 100644 --- a/spec/inputs/local.moon +++ b/spec/inputs/local.mp | |||
diff --git a/spec/inputs/loops.moon b/spec/inputs/loops.mp index 24d960f..24d960f 100644 --- a/spec/inputs/loops.moon +++ b/spec/inputs/loops.mp | |||
diff --git a/spec/inputs/macro.moon b/spec/inputs/macro.mp index aa8356c..c7ec79c 100644 --- a/spec/inputs/macro.moon +++ b/spec/inputs/macro.mp | |||
@@ -1,6 +1,6 @@ | |||
1 | macro block init = -> | 1 | macro block init = -> |
2 | with require "moonp" | 2 | with require "moonp" |
3 | package.moonpath = "?.moon;./spec/inputs/?.moon" | 3 | package.moonpath = "?.mp;./spec/inputs/?.mp" |
4 | "" | 4 | "" |
5 | 5 | ||
6 | $init! | 6 | $init! |
@@ -25,7 +25,7 @@ if $and f1!, f2!, f3! | |||
25 | 25 | ||
26 | macro expr in = (target, ...)-> | 26 | macro expr in = (target, ...)-> |
27 | values = [value for value in *{...}] | 27 | values = [value for value in *{...}] |
28 | $showMacro "in", "#{ table.concat ["#{target} == #{item}" for item in *values], " or " }" | 28 | $showMacro "in", table.concat ["#{target} == #{item}" for item in *values], " or " |
29 | 29 | ||
30 | if x |> $in "Apple", "Pig", "Dog" | 30 | if x |> $in "Apple", "Pig", "Dog" |
31 | print "exist" | 31 | print "exist" |
@@ -55,7 +55,7 @@ macro expr pipe = (...)-> | |||
55 | when 1 then return ... | 55 | when 1 then return ... |
56 | ops = {...} | 56 | ops = {...} |
57 | last = ops[1] | 57 | last = ops[1] |
58 | stmts = for i = 2,#ops | 58 | stmts = for i = 2, #ops |
59 | stmt = "\tlocal _#{i} = #{last} |> #{ops[i]}" | 59 | stmt = "\tlocal _#{i} = #{last} |> #{ops[i]}" |
60 | last = "_#{i}" | 60 | last = "_#{i}" |
61 | stmt | 61 | stmt |
@@ -164,15 +164,17 @@ macro block chainB = (...)-> | |||
164 | last = nil | 164 | last = nil |
165 | stmts = for i = 1,#items | 165 | stmts = for i = 1,#items |
166 | stmt = if i == #items | 166 | stmt = if i == #items |
167 | "\t#{last and "#{last}\\" or ""}#{items[i]}" | 167 | lastStr = last and "#{last}\\" or "" |
168 | "\t#{lastStr}#{items[i]}" | ||
168 | else | 169 | else |
169 | "\tlocal _#{i} = #{last and "#{last}\\" or ""}#{items[i]}" | 170 | lastStr = last and "#{last}\\" or "" |
171 | "\tlocal _#{i} = #{lastStr}#{items[i]}" | ||
170 | last = "_#{i}" | 172 | last = "_#{i}" |
171 | stmt | 173 | stmt |
172 | res = "do | 174 | res = "do |
173 | #{table.concat stmts, "\n"} | 175 | #{table.concat stmts, '\n'} |
174 | " | 176 | " |
175 | $showMacro "chainB",res | 177 | $showMacro "chainB", res |
176 | 178 | ||
177 | $chainB( | 179 | $chainB( |
178 | _{1, 2, 3, 4, -2, 3} | 180 | _{1, 2, 3, 4, -2, 3} |
diff --git a/spec/inputs/macro_export.moon b/spec/inputs/macro_export.mp index 759c6d1..759c6d1 100644 --- a/spec/inputs/macro_export.moon +++ b/spec/inputs/macro_export.mp | |||
diff --git a/spec/inputs/operators.moon b/spec/inputs/operators.mp index 57e58d6..57e58d6 100644 --- a/spec/inputs/operators.moon +++ b/spec/inputs/operators.mp | |||
diff --git a/spec/inputs/plus.moon b/spec/inputs/plus.mp index ca03499..ca03499 100644 --- a/spec/inputs/plus.moon +++ b/spec/inputs/plus.mp | |||
diff --git a/spec/inputs/return.moon b/spec/inputs/return.mp index f170ffd..f170ffd 100644 --- a/spec/inputs/return.moon +++ b/spec/inputs/return.mp | |||
diff --git a/spec/inputs/string.moon b/spec/inputs/string.mp index 5d8f772..5d8f772 100644 --- a/spec/inputs/string.moon +++ b/spec/inputs/string.mp | |||
diff --git a/spec/inputs/stub.moon b/spec/inputs/stub.mp index 60347e7..60347e7 100644 --- a/spec/inputs/stub.moon +++ b/spec/inputs/stub.mp | |||
diff --git a/spec/inputs/switch.moon b/spec/inputs/switch.mp index ac3dbea..ac3dbea 100644 --- a/spec/inputs/switch.moon +++ b/spec/inputs/switch.mp | |||
diff --git a/spec/inputs/syntax.moon b/spec/inputs/syntax.mp index af72f73..1bb962f 100644 --- a/spec/inputs/syntax.moon +++ b/spec/inputs/syntax.mp | |||
@@ -233,12 +233,12 @@ yeah | |||
233 | sure: sir | 233 | sure: sir |
234 | 234 | ||
235 | hello "no comma" | 235 | hello "no comma" |
236 | yeah: dada | 236 | yeah: dada |
237 | another: world | 237 | another: world |
238 | 238 | ||
239 | hello "comma", | 239 | hello "comma", |
240 | something: hello_world | 240 | something: hello_world |
241 | frick: you | 241 | frick: you |
242 | 242 | ||
243 | -- creates one table | 243 | -- creates one table |
244 | another hello, one, | 244 | another hello, one, |
diff --git a/spec/inputs/tables.moon b/spec/inputs/tables.mp index e816003..e816003 100644 --- a/spec/inputs/tables.moon +++ b/spec/inputs/tables.mp | |||
diff --git a/spec/inputs/unless_else.moon b/spec/inputs/unless_else.mp index b421d4d..b421d4d 100644 --- a/spec/inputs/unless_else.moon +++ b/spec/inputs/unless_else.mp | |||
diff --git a/spec/inputs/using.moon b/spec/inputs/using.mp index fe0a433..fe0a433 100644 --- a/spec/inputs/using.moon +++ b/spec/inputs/using.mp | |||
diff --git a/spec/inputs/whitespace.moon b/spec/inputs/whitespace.mp index 329280f..329280f 100644 --- a/spec/inputs/whitespace.moon +++ b/spec/inputs/whitespace.mp | |||
diff --git a/spec/inputs/with.moon b/spec/inputs/with.mp index 704c494..704c494 100644 --- a/spec/inputs/with.moon +++ b/spec/inputs/with.mp | |||