diff options
| author | Li Jin <dragon-fly@qq.com> | 2020-01-28 00:41:53 +0800 |
|---|---|---|
| committer | Li Jin <dragon-fly@qq.com> | 2020-01-28 01:10:31 +0800 |
| commit | fb47c11bd942c83317f1f9a2e255535649401cbf (patch) | |
| tree | 3fb35b9b23911a37c4e4499cf650792ba2b8b21c /spec | |
| parent | 27717564cb1ab72c88c10a8392b6795ddea7a0ef (diff) | |
| download | yuescript-fb47c11bd942c83317f1f9a2e255535649401cbf.tar.gz yuescript-fb47c11bd942c83317f1f9a2e255535649401cbf.tar.bz2 yuescript-fb47c11bd942c83317f1f9a2e255535649401cbf.zip | |
Add multi-line comment support. Add escape new line symbol. Add back call syntax.
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/inputs/backcall.moon | 46 | ||||
| -rw-r--r-- | spec/inputs/syntax.moon | 10 |
2 files changed, 56 insertions, 0 deletions
diff --git a/spec/inputs/backcall.moon b/spec/inputs/backcall.moon new file mode 100644 index 0000000..407a5a7 --- /dev/null +++ b/spec/inputs/backcall.moon | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | |||
| 2 | {"abc", 123, 998} |> foreach print | ||
| 3 | |||
| 4 | {1,2,3} \ | ||
| 5 | |> map((x)-> x * 2) \ | ||
| 6 | |> filter((x)-> x > 4) \ | ||
| 7 | |> reduce(0, (a,b)-> a + b) \ | ||
| 8 | |||
| 9 | |||
| 10 | [i |> tostring for i = 0,10] |> table.concat(",") |> print | ||
| 11 | |||
| 12 | b = 1 + 2 + (4 |> tostring |> print(1) or 123) | ||
| 13 | |||
| 14 | if x = 233 |> math.max 998 | ||
| 15 | print x | ||
| 16 | |||
| 17 | 998 |> func2 "abc", 233 |> func0 |> func1 | ||
| 18 | 998 |> func0("abc", 233) |> func1 |> func2 | ||
| 19 | |||
| 20 | do | ||
| 21 | (data) <- http?.get "ajaxtest" | ||
| 22 | body[".result"]\html data | ||
| 23 | (processed) <- http.get "ajaxprocess", data | ||
| 24 | body[".result"]\append processed | ||
| 25 | <- setTimeout 1000 | ||
| 26 | print "done" | ||
| 27 | |||
| 28 | do | ||
| 29 | <- syncStatus | ||
| 30 | (err,data="nil") <- loadAsync "file.moon" | ||
| 31 | print err if err | ||
| 32 | (codes) <- compileAsync data | ||
| 33 | func = loadstring codes | ||
| 34 | func! | ||
| 35 | |||
| 36 | do | ||
| 37 | <- f1 | ||
| 38 | <- f2 | ||
| 39 | do | ||
| 40 | <- f3 | ||
| 41 | <- f4 | ||
| 42 | <- f5 | ||
| 43 | <- f6 | ||
| 44 | f7! | ||
| 45 | |||
| 46 | alert "hi" | ||
diff --git a/spec/inputs/syntax.moon b/spec/inputs/syntax.moon index bf0cf04..3ac9991 100644 --- a/spec/inputs/syntax.moon +++ b/spec/inputs/syntax.moon | |||
| @@ -270,3 +270,13 @@ z = a- b | |||
| 270 | 270 | ||
| 271 | 271 | ||
| 272 | -- cooool | 272 | -- cooool |
| 273 | |||
| 274 | str = --[[ | ||
| 275 | This is a multi line comment. | ||
| 276 | It's OK. | ||
| 277 | ]] strA \ -- comment 1 | ||
| 278 | .. strB \ -- comment 2 | ||
| 279 | .. strC | ||
| 280 | |||
| 281 | func --[[port]] 3000, --[[ip]] "192.168.1.1" | ||
| 282 | |||
