on 747b154 help sign in
bat/tests/syntax-tests/source/LiveScript/livescript-demo.ls
83 lines 1.4 kB history raw
1a = -> 1
2const b = --> 2
3var c = ~> 3
4d = ~~>
5e = (a) -> (b) ~> (c) --> (d, e) ~~> 5
6dashes-identifiers = ->
7 a - a
8 b -- c
9 1-1 1- -1
10 a- a
11 a -a
13//abc #eaze #@ //
14//
15a #baze
16//
18publi
19if it is \abc and ($-y = !(a,) ->) ~= map //a#//
20then match that | _ | otherwise => implements $("#abc #@a")
22switch |a=>b
23| a then b
25if a => b else c
27underscores_i$d = ->
28/regexp1/ and //regexp2//g
29'strings' and "strings" and \strings
30([2 til 10] or [1 to 50])
31 |> map (* 2)
32 |> filter (> 5)
33 |> fold (+)
35setTimeout _, 3000 <| do-stuff
36_.map; _abc; __
39class Class extends Anc-est-or
40 (args) ->
42copy = (from, to, callback) -->
43 error, data <- read file
44 return callback error if error?
45 error <~ write file, data
46 return callback error if error?
47 callback()
49$(\#gafBr).text $t.fmtFloat(efb.gaf)
51->
52~>
53~~>
54-->
55# Comment
56/* Comment */
57# error, data <- read file
58 /* error, data <- read file */
60add = (a=1, b=2) --> a + b
61add 1 2
62do-stuff!
63do-stuff? #
64do-stuff? 1
65do-stuff + 1
66@do-stuff +1
67@do-stuff /1
68a b c |> d <| e f(g)
69'cats' is 'cats'
70'cats' `_.is-insensitive` 'CATS'
71setTimeout _, 1000 <| !-> console.log 'Who summoned me'
72private-list = yield @get-private-list!
73switch | true => "#@@spaghetti"
74~function add a=1, b=2 => a + b
75row.0._id
76new Spaghetti
77(++a++) (++ 2 ++)
78(.cool.) (+ a -) (/ 2 *)
79(ina -a in) (-> a)
80(ina in$a)
81(a is-in)
82(in)
83((((((+ a((a))))))))