bat/tests/syntax-tests/highlighted/LiveScript/livescript-demo.ls

84 lines
15 KiB
Text
Raw Normal View History

a = -> 1
const b = --> 2
var c = ~> 3
d = ~~>
e = (a) -> (b) ~> (c) --> (d, e) ~~> 5
dashes-identifiers = ->
 a - a
 b -- c
 1-1 1- -1
 a- a
 a -a
//abc #eaze #@ //
//
a #baze
//
publi
if it is \abc and ($-y = !(a,) ->) ~= map //a#//
then match that | _ | otherwise => implements $("#abc #@a")
switch |a=>b
| a then b
if a => b else c
underscores_i$d = ->
/regexp1/ and //regexp2//g
'strings' and "strings" and \strings
([2 til 10] or [1 to 50])
 |> map (* 2)
 |> filter (> 5)
 |> fold (+)
setTimeout _, 3000 <| do-stuff
_.map; _abc; __
class Class extends Anc-est-or
 (args) ->
copy = (from, to, callback) -->
 error, data <- read file
 return callback error if error?
 error <~ write file, data
 return callback error if error?
 callback()
$(\#gafBr).text $t.fmtFloat(efb.gaf)
->
~>
~~>
-->
# Comment
/* Comment */
# error, data <- read file
 /* error, data <- read file */
add = (a=1, b=2) --> a + b
add 1 2
do-stuff!
do-stuff? #
do-stuff? 1
do-stuff + 1
@do-stuff +1
@do-stuff /1
a b c |> d <| e f(g)
'cats' is 'cats'
'cats' `_.is-insensitive` 'CATS'
setTimeout _, 1000 <| !-> console.log 'Who summoned me'
private-list = yield @get-private-list!
switch | true => "#@@spaghetti"
~function add a=1, b=2 => a + b
row.0._id
new Spaghetti
(++a++) (++ 2 ++)
(.cool.) (+ a -) (/ 2 *)
(ina -a in) (-> a)
(ina in$a)
(a is-in)
(in)
((((((+ a((a))))))))