1
1
# LightScript
2
2
3
- ### JavaScript, with cleaned-up syntax and a few conveniences.
4
-
5
- A superset of ES7 with JSX and Flow,
6
- implemented as a fork of Babel’s parser wrapped in a Babel plugin. Built to make programmers a little more productive.
3
+ * A close superset of ES7 with JSX and Flow, built with Babel. Designed to make programmers a little more productive.*
7
4
8
5
See [ lightscript.org] ( http://lightscript.org ) for example code
9
6
and language reference documentation. A quick taste:
10
7
11
8
``` coffee
12
- fizzBuzz (n = 100 ) ->
13
- [for i from 1 thru n :
14
- if i % 3 == 0 and i % 5 == 0 :
15
- " fizzbuzz"
16
- elif i % 3 == 0 :
17
- " fizz"
18
- elif i % 5 == 0 :
19
- " buzz"
9
+ Item ({ item, isActive, onClick }) =>
10
+ className = if isActive : ' active' else : ' inactive'
11
+
12
+ <li onClick = {onClick} className = {className}>
13
+ {item}
14
+ </li >
15
+
16
+ class List extends React.Component :
17
+
18
+ activateItem (itemId): void =>
19
+ if this .state .activeItem == itemId :
20
+ this .setState ({ activeItem : null })
20
21
else :
21
- i
22
- ]
22
+ this .setState ({ activeItem : itemId })
23
+
24
+ render () ->
25
+ { items , activeItem } = this .state
26
+
27
+ <div >
28
+ {if activeItem :
29
+ <p >You have selected : {activeItem}</p >
30
+ else :
31
+ <p >Click an item to select one! </p >
32
+ }
33
+
34
+ <ul >
35
+ {items .map ((item , i ) =>
36
+ isActive = activeItem == item .id
37
+
38
+ if not item .hidden :
39
+ <Item
40
+ key = {i}
41
+ item = {item}
42
+ isActive = {isActive}
43
+ onClick = {() => this .activateItem (item .id )}
44
+ />
45
+ )}
46
+ </ul >
47
+ </div >
23
48
```
24
49
50
+ Come hang out in [ the gitter chatroom] ( https://gitter.im/lightscript/Lobby ) , where contributors can help you get started and answer any questions.
25
51
26
52
### Language Features
27
53
@@ -40,7 +66,7 @@ In addition to all all ES7, JSX, and Flow features:
40
66
- Array Comprehensions
41
67
- Object Comprehensions
42
68
- Array-based for-loops
43
- - Range -based for-loops
69
+ - Object -based for-loops
44
70
- a few others
45
71
46
72
Reference documentation is available at [ lightscript.org] ( http://lightscript.org ) ,
@@ -55,7 +81,6 @@ and [here](https://github.com/lightscript/babel-plugin-lightscript/tree/master/t
55
81
56
82
- ** The Parser** : [ babylon-lightscript] ( https://github.com/lightscript/babylon-lightscript )
57
83
- The core of most of the language.
58
- - Because it is a fork, the repo would not be easily pulled into a monorepo.
59
84
- ** The Babel Plugin** : [ babel-plugin-lightscript] ( https://github.com/lightscript/babel-plugin-lightscript )
60
85
- Rewrites a "LightScript AST" into a "JavaScript AST".
61
86
- The core of what you need to use LightScript.
@@ -71,7 +96,6 @@ and [here](https://github.com/lightscript/babel-plugin-lightscript/tree/master/t
71
96
- Based on the Sublime Package.
72
97
- Available now on the [ VS Code Extension Marketplace] ( https://marketplace.visualstudio.com/items?itemName=lightscript.lsc ) .
73
98
- ** The Website** : [ lightscript.org] ( https://github.com/lightscript/lightscript.org )
74
- - In addition to powering lightscript.org, it's also the best example of LightScript code in use.
75
- Hopefully that changes soon.
99
+ - In addition to powering lightscript.org, it's also an example of LightScript code in use.
76
100
77
101
For now, the issue tracker on this repo should be used for bug reports and feature requests.
0 commit comments