Skip to content

Commit

Permalink
LiveScript
Browse files Browse the repository at this point in the history
  • Loading branch information
boyter committed Oct 1, 2024
1 parent f5dd53f commit c652b87
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 4 deletions.
1 change: 1 addition & 0 deletions LANGUAGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ LESS (less)
LEX (l)
License (license,licence,copying,copying3,unlicense,unlicence,license-mit,licence-mit,copyright)
Lisp (lisp,lsp)
LiveScript (ls)
LLVM IR (ll)
LOLCODE (lol,lols)
Lua (lua,luau)
Expand Down
6 changes: 3 additions & 3 deletions SCC-OUTPUT-REPORT.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<th>447</th>
<th>7659</th>
<th>1529</th>
<th>254284</th>
<th>254324</th>
<th>4067</th>
</tr><tr>
<td>processor/formatters.go</td>
Expand Down Expand Up @@ -288,7 +288,7 @@
<td>0</td>
<td>4</td>
<td>0</td>
<td>21945</td>
<td>21985</td>
<td>5</td>
</tr></tbody>
<tfoot><tr>
Expand All @@ -299,7 +299,7 @@
<th>447</th>
<th>7659</th>
<th>1529</th>
<th>254284</th>
<th>254324</th>
<th>4067</th>
</tr>
<tr>
Expand Down
52 changes: 52 additions & 0 deletions examples/language/livescript.ls
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Easy listing of implicit objects
table1 =
* id: 1
name: 'george'
* id: 2
name: 'mike'
* id: 3
name: 'donald'





table2 =
* id: 2
age: 21
* id: 1
age: 20
* id: 3
age: 26




# Implicit access, accessignment
up-case-name = (.name .= to-upper-case!)

# List comprehensions, destructuring, piping
[{id:id1, name, age} for {id:id1, name} in table1
for {id:id2, age} in table2
when id1 is id2]
|> sort-by (.id) # using 'sort-by' from prelude.ls
|> each up-case-name # using 'each' from prelude.ls
|> JSON.stringify
#=>
#[{"id":1,"name":"GEORGE","age":20},
# {"id":2,"name":"MIKE", "age":21},
# {"id":3,"name":"DONALD","age":26}]











# operators as functions, piping
map (.age), table2 |> fold1 (+)
#=> 67 ('fold1' and 'map' from prelude.ls)
39 changes: 39 additions & 0 deletions languages.json
Original file line number Diff line number Diff line change
Expand Up @@ -3068,6 +3068,45 @@
],
"shebangs": ["node"]
},
"LiveScript": {
"complexitychecks": [
"for ",
"for(",
"if ",
"if(",
"switch ",
"case ",
"while ",
"when ",
"else ",
"|| ",
"&& ",
"!= ",
"!== ",
"xor ",
"and ",
"or ",
"|> ",
"<< ",
"<<< ",
"<<<< ",
">> ",
"== "
],
"extensions": ["ls"],
"line_comment": ["#"],
"multi_line": [["/*", "*/"]],
"quotes": [
{
"end": "\"",
"start": "\""
},
{
"end": "'",
"start": "'"
}
]
},
"JavaServer Pages": {
"complexitychecks": [
"for ",
Expand Down
2 changes: 1 addition & 1 deletion processor/constants.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,7 @@ specificLanguages=(
'Korn Shell '
'LALRPOP '
'License '
'LiveScript '
'LLVM IR '
'Luna '
'Makefile '
Expand Down

0 comments on commit c652b87

Please sign in to comment.