-
-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathsource.livescript.js
More file actions
104 lines (102 loc) · 2.57 KB
/
source.livescript.js
File metadata and controls
104 lines (102 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is developed at
// <https://github.com/sharktide/livescript-vscode>
// and licensed `apache-2.0`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
extensions: ['.ls', '._ls'],
names: ['livescript', 'live-script', 'ls'],
patterns: [
{include: '#storage'},
{include: '#keywords'},
{include: '#functions'},
{include: '#variables'},
{include: '#numbers'},
{include: '#strings'},
{include: '#comments'},
{include: '#braces'},
{include: '#parentheses'}
],
repository: {
braces: {
patterns: [
{match: '[{}]', name: 'punctuation.definition.block.livescript'}
]
},
comments: {
patterns: [
{begin: '#', end: '$', name: 'comment.line.livescript'},
{begin: '/\\*', end: '\\*/', name: 'comment.block.livescript'}
]
},
functions: {
patterns: [
{
match: '\\b[a-zA-Z_][a-zA-Z0-9_]*\\s*(?=[:=]\\s*->)',
name: 'entity.name.function.livescript'
}
]
},
keywords: {
patterns: [
{
match: '\\b(and|or|is|isnt|not|instanceof|typeof|in|of)\\b',
name: 'keyword.operator.livescript'
}
]
},
numbers: {
patterns: [
{match: '\\b\\d+(\\.\\d+)?\\b', name: 'constant.numeric.livescript'}
]
},
parentheses: {
patterns: [
{match: '[()]', name: 'punctuation.definition.group.livescript'}
]
},
storage: {
patterns: [
{
match:
'\\b(if|else|unless|switch|case|default|for|while|loop|break|continue|return|do|try|catch|finally|throw|import|export|yield)\\b',
name: 'storage.control.livescript'
}
]
},
strings: {
patterns: [
{
begin: '"',
end: '"',
name: 'string.quoted.double.livescript',
patterns: [
{match: '\\\\.', name: 'constant.character.escape.livescript'}
]
},
{
begin: "'",
end: "'",
name: 'string.quoted.single.livescript',
patterns: [
{match: '\\\\.', name: 'constant.character.escape.livescript'}
]
}
]
},
variables: {
patterns: [
{
match: '(?<!\\.|\\d)\\b[a-zA-Z_][a-zA-Z0-9_]*\\b(?!\\s*\\()',
name: 'variable.livescript'
}
]
}
},
scopeName: 'source.livescript'
}
export default grammar