-
-
Notifications
You must be signed in to change notification settings - Fork 31
/
source.loomscript.js
155 lines (153 loc) · 4.78 KB
/
source.loomscript.js
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// This is a TextMate grammar distributed by `starry-night`.
// This grammar is licensed `mit`.
// See <https://github.com/wooorm/starry-night> for more info.
/**
* @import {Grammar} from '@wooorm/starry-night'
*/
/** @type {Grammar} */
const grammar = {
extensions: [],
names: ['loomscript'],
patterns: [
{include: '#comments'},
{include: '#keywords'},
{include: '#strings'},
{
begin: 'import',
beginCaptures: {0: {name: 'keyword.other.import.loomscript'}},
end: ';',
endCaptures: {0: {name: 'punctuation.terminator.loomscript'}},
name: 'meta.declaration.loomscript'
},
{
begin: '(package)\\s+',
beginCaptures: {1: {name: 'storage.modifier.loomscript'}},
end: '([\\w\\.]+)?',
endCaptures: {1: {name: 'entity.name.type.package.loomscript'}},
name: 'meta.package.loomscript'
}
],
repository: {
comments: {
patterns: [
{
captures: {1: {name: 'punctuation.definition.comment.loomscript'}},
match: '(//).*$\\n?',
name: 'comment.line.double-slash.loomscript'
},
{
begin: '/\\*',
captures: {0: {name: 'punctuation.definition.comment.loomscript'}},
end: '\\*/',
name: 'comment.block.loomscript'
}
]
},
keywords: {
patterns: [
{
match: '\\b(true|false|null)\\b',
name: 'constant.language.loomscript'
},
{
match:
'\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f)?\\b',
name: 'constant.numeric.loomscript'
},
{match: '\\bas\\b', name: 'keyword.cast.loomscript'},
{
match:
'\\b(if|else|while|do|for|each|in|case|switch|do|default|with|return)\\b',
name: 'keyword.control.loomscript'
},
{
match: '\\b(exit|return|break|continue)\\b',
name: 'keyword.control.end.loomscript'
},
{match: '\\b(new)\\b', name: 'keyword.control.new.loomscript'},
{match: '\\?|:', name: 'keyword.control.ternary.loomscript'},
{
match:
'\\b(\\.\\.\\.|class|const|extends|function|get|implements|interface|package|set|namespace|var)\\b',
name: 'keyword.declaration.loomscript'
},
{
match: '\\b(delete|is|typeof)\\b',
name: 'keyword.operator.loomscript'
},
{
match: '(\\-|\\+|\\*|\\/|\\~\\/|%)',
name: 'keyword.operator.arithmetic.loomscript'
},
{match: '(=)', name: 'keyword.operator.assignment.loomscript'},
{
match: '(([+*/%-]|\\~)=)',
name: 'keyword.operator.assignment.arithmetic.loomscript'
},
{
match: '(<<|>>>?|~|\\^|\\||&)',
name: 'keyword.operator.bitwise.loomscript'
},
{
match: '(===?|!==?|<=?|>=?)',
name: 'keyword.operator.comparison.loomscript'
},
{
match: '(\\-\\-|\\+\\+)',
name: 'keyword.operator.increment-decrement.loomscript'
},
{match: '(!|&&|\\|\\|)', name: 'keyword.operator.logical.loomscript'},
{
match: '((&|\\^|\\||<<|>>>?)=)',
name: 'keyword.operator.assignment.bitwise.loomscript'
},
{match: '\\b(\\*|Null)\\b', name: 'keyword.special-type.loomscript'},
{match: ';', name: 'punctuation.terminator.loomscript'},
{
match:
'\\b(dynamic|final|internal|native|override|private|protected|public|static)\\b',
name: 'storage.modifier.loomscript'
},
{
match: '\\b(?:void|bool|int)\\b',
name: 'storage.type.primitive.loomscript'
},
{match: '\\b(this|super)\\b', name: 'variable.language.loomscript'}
]
},
strings: {
patterns: [
{
begin: '"',
beginCaptures: {
0: {name: 'punctuation.definition.string.begin.loomscript'}
},
end: '"',
endCaptures: {
0: {name: 'punctuation.definition.string.end.loomscript'}
},
name: 'string.quoted.double.loomscript',
patterns: [
{match: '\\\\.', name: 'constant.character.escape.loomscript'}
]
},
{
begin: "'",
beginCaptures: {
0: {name: 'punctuation.definition.string.begin.loomscript'}
},
end: "'",
endCaptures: {
0: {name: 'punctuation.definition.string.end.loomscript'}
},
name: 'string.quoted.single.loomscript',
patterns: [
{match: '\\\\.', name: 'constant.character.escape.loomscript'}
]
}
]
}
},
scopeName: 'source.loomscript'
}
export default grammar