Skip to content

Commit 4c7970f

Browse files
authored
LiveScript (#525)
1 parent f5dd53f commit 4c7970f

File tree

6 files changed

+97
-4
lines changed

6 files changed

+97
-4
lines changed

LANGUAGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ LESS (less)
159159
LEX (l)
160160
License (license,licence,copying,copying3,unlicense,unlicence,license-mit,licence-mit,copyright)
161161
Lisp (lisp,lsp)
162+
LiveScript (ls)
162163
LLVM IR (ll)
163164
LOLCODE (lol,lols)
164165
Lua (lua,luau)

SCC-OUTPUT-REPORT.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<th>447</th>
1919
<th>7659</th>
2020
<th>1529</th>
21-
<th>254284</th>
21+
<th>254324</th>
2222
<th>4067</th>
2323
</tr><tr>
2424
<td>processor/formatters.go</td>
@@ -288,7 +288,7 @@
288288
<td>0</td>
289289
<td>4</td>
290290
<td>0</td>
291-
<td>21945</td>
291+
<td>21985</td>
292292
<td>5</td>
293293
</tr></tbody>
294294
<tfoot><tr>
@@ -299,7 +299,7 @@
299299
<th>447</th>
300300
<th>7659</th>
301301
<th>1529</th>
302-
<th>254284</th>
302+
<th>254324</th>
303303
<th>4067</th>
304304
</tr>
305305
<tr>

examples/language/livescript.ls

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Easy listing of implicit objects
2+
table1 =
3+
* id: 1
4+
name: 'george'
5+
* id: 2
6+
name: 'mike'
7+
* id: 3
8+
name: 'donald'
9+
10+
11+
12+
13+
14+
table2 =
15+
* id: 2
16+
age: 21
17+
* id: 1
18+
age: 20
19+
* id: 3
20+
age: 26
21+
22+
23+
24+
25+
# Implicit access, accessignment
26+
up-case-name = (.name .= to-upper-case!)
27+
28+
# List comprehensions, destructuring, piping
29+
[{id:id1, name, age} for {id:id1, name} in table1
30+
for {id:id2, age} in table2
31+
when id1 is id2]
32+
|> sort-by (.id) # using 'sort-by' from prelude.ls
33+
|> each up-case-name # using 'each' from prelude.ls
34+
|> JSON.stringify
35+
#=>
36+
#[{"id":1,"name":"GEORGE","age":20},
37+
# {"id":2,"name":"MIKE", "age":21},
38+
# {"id":3,"name":"DONALD","age":26}]
39+
40+
41+
42+
43+
44+
45+
46+
47+
48+
49+
50+
# operators as functions, piping
51+
map (.age), table2 |> fold1 (+)
52+
#=> 67 ('fold1' and 'map' from prelude.ls)

languages.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3068,6 +3068,45 @@
30683068
],
30693069
"shebangs": ["node"]
30703070
},
3071+
"LiveScript": {
3072+
"complexitychecks": [
3073+
"for ",
3074+
"for(",
3075+
"if ",
3076+
"if(",
3077+
"switch ",
3078+
"case ",
3079+
"while ",
3080+
"when ",
3081+
"else ",
3082+
"|| ",
3083+
"&& ",
3084+
"!= ",
3085+
"!== ",
3086+
"xor ",
3087+
"and ",
3088+
"or ",
3089+
"|> ",
3090+
"<< ",
3091+
"<<< ",
3092+
"<<<< ",
3093+
">> ",
3094+
"== "
3095+
],
3096+
"extensions": ["ls"],
3097+
"line_comment": ["#"],
3098+
"multi_line": [["/*", "*/"]],
3099+
"quotes": [
3100+
{
3101+
"end": "\"",
3102+
"start": "\""
3103+
},
3104+
{
3105+
"end": "'",
3106+
"start": "'"
3107+
}
3108+
]
3109+
},
30713110
"JavaServer Pages": {
30723111
"complexitychecks": [
30733112
"for ",

processor/constants.go

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

test-all.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,7 @@ specificLanguages=(
962962
'Korn Shell '
963963
'LALRPOP '
964964
'License '
965+
'LiveScript '
965966
'LLVM IR '
966967
'Luna '
967968
'Makefile '

0 commit comments

Comments
 (0)