summaryrefslogtreecommitdiffstats
path: root/tests/syntax-tests
diff options
context:
space:
mode:
authorMartin Nordholts <enselic@gmail.com>2021-10-23 11:27:59 +0200
committerMartin Nordholts <enselic@gmail.com>2021-10-23 13:35:32 +0200
commit6eb2cc9caccbf45bb1d3b4f404ff4ee825ec4dcf (patch)
treebffae0fa13c6ac199f9346d50c7bb4c31fe6ce93 /tests/syntax-tests
parentf28d9db3d0903dfa6ecbaf9fae6e3e4605c6f33d (diff)
Add LiveScript syntax
The file `LiveScript.sublime-syntax` is a pure export from a licenced version of Sublime Text, Version 3.1.1, Build 3176 with assets/syntaxes/02_Extra/LiveScript/Syntaxes/LiveScript.tmLanguage as the source file.
Diffstat (limited to 'tests/syntax-tests')
-rw-r--r--tests/syntax-tests/highlighted/LiveScript/livescript-demo.ls83
-rw-r--r--tests/syntax-tests/source/LiveScript/LICENSE.md23
-rw-r--r--tests/syntax-tests/source/LiveScript/livescript-demo.ls83
3 files changed, 189 insertions, 0 deletions
diff --git a/tests/syntax-tests/highlighted/LiveScript/livescript-demo.ls b/tests/syntax-tests/highlighted/LiveScript/livescript-demo.ls
new file mode 100644
index 00000000..f6aba10c
--- /dev/null
+++ b/tests/syntax-tests/highlighted/LiveScript/livescript-demo.ls
@@ -0,0 +1,83 @@
+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))))))))
diff --git a/tests/syntax-tests/source/LiveScript/LICENSE.md b/tests/syntax-tests/source/LiveScript/LICENSE.md
new file mode 100644
index 00000000..5c436445
--- /dev/null
+++ b/tests/syntax-tests/source/LiveScript/LICENSE.md
@@ -0,0 +1,23 @@
+The `livescript-demo.ls` file has been added from https://github.com/paulmillr/LiveScript.tmbundle under the following license:
+
+The MIT License (MIT)
+
+Copyright (c) 2012 Paul Miller (http://paulmillr.com/), Jeremy Ashkenas
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/tests/syntax-tests/source/LiveScript/livescript-demo.ls b/tests/syntax-tests/source/LiveScript/livescript-demo.ls
new file mode 100644
index 00000000..dc34f8cf
--- /dev/null
+++ b/tests/syntax-tests/source/LiveScript/livescript-demo.ls
@@ -0,0 +1,83 @@
+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))))))))