From 6ed33835b12d715c4dcb6c8a0e6670c6ada34c86 Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Tue, 26 Jun 2012 18:40:19 +0300 Subject: Add LiveScript support and fix coffeescript. --- tests/examplefiles/livescript-demo.ls | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/examplefiles/livescript-demo.ls (limited to 'tests/examplefiles') diff --git a/tests/examplefiles/livescript-demo.ls b/tests/examplefiles/livescript-demo.ls new file mode 100644 index 00000000..22a58628 --- /dev/null +++ b/tests/examplefiles/livescript-demo.ls @@ -0,0 +1,35 @@ +a = -> 1 +const b = --> 2 +var c = ~> 3 +d = ~~> 10_000_000km * 500ms +e = (a) -> (b) ~> (c) --> (d, e) ~~> 5 +dashes-identifiers = -> + a - a + b -- c + 1-1 1- -1 + a- a + a -a +underscores_i$d = -> +/regexp1/ and //regexp2//g +'strings' and "strings" and \strings +([2 til 10] or [1 to 50]) + |> map (* 2) + |> filter (> 5) + |> fold (+) + +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() + +-> +~> +~~> +--> +# Comment +/* Comment */ -- cgit v1.2.1 From f478863db22c67e92549fad4fb449593aca1f009 Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Tue, 26 Jun 2012 22:40:04 +0300 Subject: Add support for word arrays and !-> funcs in livescript. --- tests/examplefiles/livescript-demo.ls | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'tests/examplefiles') diff --git a/tests/examplefiles/livescript-demo.ls b/tests/examplefiles/livescript-demo.ls index 22a58628..a82a97f2 100644 --- a/tests/examplefiles/livescript-demo.ls +++ b/tests/examplefiles/livescript-demo.ls @@ -1,24 +1,24 @@ -a = -> 1 -const b = --> 2 -var c = ~> 3 -d = ~~> 10_000_000km * 500ms -e = (a) -> (b) ~> (c) --> (d, e) ~~> 5 +a = -> [1 to 50] +const b = --> [2 til 5] +var c = ~~> 10_000_000km * 500ms +e = (a) -> (b) ~> (c) --> (d, e) ~~> <[list of words]> dashes-identifiers = -> - a - a - b -- c - 1-1 1- -1 - a- a - a -a + a - a b -- c 1-1 1- -1 a- a a -a underscores_i$d = -> -/regexp1/ and //regexp2//g -'strings' and "strings" and \strings -([2 til 10] or [1 to 50]) + /regexp1/ + //regexp2//g + 'strings' and "strings" and \strings + +[2 til 10] |> map (* 2) |> filter (> 5) |> fold (+) class Class extends Anc-est-or (args) -> + -> ~> !-> !~> !--> !~~> + <-! # Comment + <~! /* Comment */ copy = (from, to, callback) --> error, data <- read file @@ -26,10 +26,3 @@ copy = (from, to, callback) --> error <~ write file, data return callback error if error? callback() - --> -~> -~~> ---> -# Comment -/* Comment */ -- cgit v1.2.1 From 0fcb5d84dfb661fe8c0aebb4246880c15241e3b4 Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Tue, 7 Aug 2012 13:55:09 +0300 Subject: Fix coffee / ls stuff. --- tests/examplefiles/livescript-demo.ls | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'tests/examplefiles') diff --git a/tests/examplefiles/livescript-demo.ls b/tests/examplefiles/livescript-demo.ls index a82a97f2..2ff68c63 100644 --- a/tests/examplefiles/livescript-demo.ls +++ b/tests/examplefiles/livescript-demo.ls @@ -1,6 +1,6 @@ a = -> [1 to 50] const b = --> [2 til 5] -var c = ~~> 10_000_000km * 500ms +var c = ~~> 10_000_000km * 500ms - 16~ff / 32~lol e = (a) -> (b) ~> (c) --> (d, e) ~~> <[list of words]> dashes-identifiers = -> a - a b -- c 1-1 1- -1 a- a a -a @@ -14,11 +14,19 @@ underscores_i$d = -> |> filter (> 5) |> fold (+) +obj = + prop1: 1 + prop2: 2 + class Class extends Anc-est-or (args) -> - -> ~> !-> !~> !--> !~~> - <-! # Comment - <~! /* Comment */ + <- # Comment + <~ /* Comment */ + void undefined yes no on off + a.void b.undefined c.off d.if f.no g.not + avoid bundefined coff dif fno gnot + "inter #{2 + 2} #variable" + '''HELLO 'world' ''' copy = (from, to, callback) --> error, data <- read file @@ -26,3 +34,8 @@ copy = (from, to, callback) --> error <~ write file, data return callback error if error? callback() + +take(n, [x, ...xs]:list) = + | n <= 0 => [] + | empty list => [] + | otherwise => [x] +++ take n - 1, xs -- cgit v1.2.1