1
+ /* ***** BEGIN LICENSE BLOCK *****
2
+ * Distributed under the BSD license:
3
+ *
4
+ * Copyright (c) 2012, Ajax.org B.V.
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions are met:
9
+ * * Redistributions of source code must retain the above copyright
10
+ * notice, this list of conditions and the following disclaimer.
11
+ * * Redistributions in binary form must reproduce the above copyright
12
+ * notice, this list of conditions and the following disclaimer in the
13
+ * documentation and/or other materials provided with the distribution.
14
+ * * Neither the name of Ajax.org B.V. nor the
15
+ * names of its contributors may be used to endorse or promote products
16
+ * derived from this software without specific prior written permission.
17
+ *
18
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
22
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+ *
29
+ * ***** END LICENSE BLOCK ***** */
30
+
31
+ /* This file was autogenerated from https://github.com/BobDotCom/Nasal.tmbundle/blob/95113f60db7cb7ac7b6c3d854683773879407a48/Syntaxes/Nasal.tmLanguage (uuid: ) */
32
+ /****************************************************************************************
33
+ * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. *
34
+ * fileTypes *
35
+ ****************************************************************************************/
36
+
37
+ "use strict" ;
38
+
39
+ var oop = require ( "../lib/oop" ) ;
40
+ var TextHighlightRules = require ( "./text_highlight_rules" ) . TextHighlightRules ;
41
+
42
+ var NasalHighlightRules = function ( ) {
43
+ // regexp must not have capturing parentheses. Use (?:) instead.
44
+ // regexps are ordered -> the first match is used
45
+
46
+ this . $rules = {
47
+ start : [ {
48
+ token : "constant.other.allcaps.nasal" ,
49
+ regex : / \b [ [: upper :] _ ] [ [: upper :] [: digit :] _ ] * \b (? ! [ \. \( \' \" ] ) / ,
50
+ comment : "Match identifiers in ALL_CAPS as constants, except when followed by `.`, `(`, `'`, or `\"`."
51
+ } , {
52
+ todo : {
53
+ token : [
54
+ "support.class.nasal" ,
55
+ "meta.function.nasal" ,
56
+ "entity.name.function.nasal" ,
57
+ "meta.function.nasal" ,
58
+ "keyword.operator.nasal" ,
59
+ "meta.function.nasal" ,
60
+ "storage.type.function.nasal" ,
61
+ "meta.function.nasal" ,
62
+ "punctuation.definition.parameters.begin.nasal"
63
+ ] ,
64
+ regex : / ( [ a - z A - Z _ ? . $ ] [ \w ? . $ ] * ) ( \. ) ( [ a - z A - Z _ ? . $ ] [ \w ? . $ ] * ) ( \s * ) ( = ) ( \s * ) ( f u n c ) ( \s * ) ( \( ) / ,
65
+ push : [ {
66
+ token : "punctuation.definition.parameters.end.nasal" ,
67
+ regex : / \) / ,
68
+ next : "pop"
69
+ } , {
70
+ include : "$self"
71
+ } , {
72
+ token : "variable.parameter.nasal" ,
73
+ regex : / \w /
74
+ } , {
75
+ defaultToken : "meta.function.nasal"
76
+ } ]
77
+ } ,
78
+ comment : "match stuff like: Sound.play = func() { … }"
79
+ } , {
80
+ todo : {
81
+ token : [
82
+ "entity.name.function.nasal" ,
83
+ "meta.function.nasal" ,
84
+ "keyword.operator.nasal" ,
85
+ "meta.function.nasal" ,
86
+ "storage.type.function.nasal" ,
87
+ "meta.function.nasal" ,
88
+ "punctuation.definition.parameters.begin.nasal"
89
+ ] ,
90
+ regex : / ( [ a - z A - Z _ ? $ ] [ \w ? $ ] * ) ( \s * ) ( = ) ( \s * ) ( f u n c ) ( \s * ) ( \( ) / ,
91
+ push : [ {
92
+ token : "punctuation.definition.parameters.end.nasal" ,
93
+ regex : / \) / ,
94
+ next : "pop"
95
+ } , {
96
+ include : "$self"
97
+ } , {
98
+ token : "variable.parameter.nasal" ,
99
+ regex : / \w /
100
+ } , {
101
+ defaultToken : "meta.function.nasal"
102
+ } ]
103
+ } ,
104
+ comment : "match stuff like: play = func() { … }"
105
+ } , {
106
+ todo : {
107
+ token : [
108
+ "entity.name.function.nasal" ,
109
+ "meta.function.nasal" ,
110
+ "keyword.operator.nasal" ,
111
+ "meta.function.nasal" ,
112
+ "storage.type.function.nasal" ,
113
+ "meta.function.nasal" ,
114
+ "punctuation.definition.parameters.begin.nasal"
115
+ ] ,
116
+ regex : / ( [ a - z A - Z _ ? $ ] [ \w ? $ ] * ) ( \s * ) ( = ) ( \s * \( \s * ) ( f u n c ) ( \s * ) ( \( ) / ,
117
+ push : [ {
118
+ token : "punctuation.definition.parameters.end.nasal" ,
119
+ regex : / \) / ,
120
+ next : "pop"
121
+ } , {
122
+ include : "$self"
123
+ } , {
124
+ token : "variable.parameter.nasal" ,
125
+ regex : / \w /
126
+ } , {
127
+ defaultToken : "meta.function.nasal"
128
+ } ]
129
+ } ,
130
+ comment : "match stuff like: play = (func() { … }"
131
+ } , {
132
+ todo : {
133
+ token : [
134
+ "entity.name.function.nasal" ,
135
+ "meta.function.hash.nasal" ,
136
+ "storage.type.function.nasal" ,
137
+ "meta.function.hash.nasal" ,
138
+ "punctuation.definition.parameters.begin.nasal"
139
+ ] ,
140
+ regex : / \b ( [ a - z A - Z _ ? . $ ] [ \w ? . $ ] * ) ( \s * : \s * \b ) ( f u n c ) ( \s * ) ( \( ) / ,
141
+ push : [ {
142
+ token : "punctuation.definition.parameters.end.nasal" ,
143
+ regex : / \) / ,
144
+ next : "pop"
145
+ } , {
146
+ include : "$self"
147
+ } , {
148
+ token : "variable.parameter.nasal" ,
149
+ regex : / \w /
150
+ } , {
151
+ defaultToken : "meta.function.hash.nasal"
152
+ } ]
153
+ } ,
154
+ comment : "match stuff like: foobar: func() { … }"
155
+ } , {
156
+ todo : {
157
+ token : [
158
+ "storage.type.function.nasal" ,
159
+ "meta.function.nasal" ,
160
+ "punctuation.definition.parameters.begin.nasal"
161
+ ] ,
162
+ regex : / \b ( f u n c ) ( \s * ) ( \( ) / ,
163
+ push : [ {
164
+ token : "punctuation.definition.parameters.end.nasal" ,
165
+ regex : / \) / ,
166
+ next : "pop"
167
+ } , {
168
+ include : "$self"
169
+ } , {
170
+ token : "variable.parameter.nasal" ,
171
+ regex : / \w /
172
+ } , {
173
+ defaultToken : "meta.function.nasal"
174
+ } ]
175
+ } ,
176
+ comment : "match stuff like: func() { … }"
177
+ } , {
178
+ token : [
179
+ "keyword.operator.new.nasal" ,
180
+ "meta.class.instance.constructor" ,
181
+ "entity.name.type.instance.nasal"
182
+ ] ,
183
+ regex : / ( n e w ) ( \s + ) ( \w + (?: \. \w * ) ? ) /
184
+ } , {
185
+ token : "keyword.control.nasal" ,
186
+ regex : / \b (?: i f | e l s e | e l s i f | w h i l e | f o r | f o r e a c h | f o r i n d e x ) \b /
187
+ } , {
188
+ token : "keyword.control.nasal" ,
189
+ regex : / \b (?: b r e a k (?: \s + [ A - Z ] { 2 , 16 } ) ? (? = \s * (?: ; | \} ) ) | c o n t i n u e (?: \s + [ A - Z ] { 2 , 16 } ) ? (? = \s * (?: ; | \} ) ) | [ A - Z ] { 2 , 16 } (? = \s * ; (?: [ ^ \) # ; ] * ?; ) { 0 , 2 } [ ^ \) # ; ] * ?\) ) ) \b /
190
+ } , {
191
+ token : "keyword.operator.nasal" ,
192
+ regex : / ! | \* | \- | \+ | ~ | \/ | = = | = | ! = | < = | > = | < | > | ! | \? | \: | \* = | \/ = | \+ = | \- = | ~ = | \. \. \. | \b (?: a n d | o r ) \b /
193
+ } , {
194
+ token : "variable.language.nasal" ,
195
+ regex : / \b (?: m e | a r g | p a r e n t s | o b j ) \b /
196
+ } , {
197
+ token : "storage.type.nasal" ,
198
+ regex : / \b (?: r e t u r n | v a r ) \b /
199
+ } , {
200
+ token : "constant.language.nil.nasal" ,
201
+ regex : / \b n i l \b /
202
+ } , {
203
+ token : "punctuation.definition.string.begin.nasal" ,
204
+ regex : / ' / ,
205
+ push : [ {
206
+ token : "punctuation.definition.string.end.nasal" ,
207
+ regex : / ' / ,
208
+ next : "pop"
209
+ } , {
210
+ token : "constant.character.escape.nasal" ,
211
+ regex : / \\ ' /
212
+ } , {
213
+ defaultToken : "string.quoted.single.nasal"
214
+ } ] ,
215
+ comment : "Single quoted strings"
216
+ } , {
217
+ token : "punctuation.definition.string.begin.nasal" ,
218
+ regex : / " / ,
219
+ push : [ {
220
+ token : "punctuation.definition.string.end.nasal" ,
221
+ regex : / " / ,
222
+ next : "pop"
223
+ } , {
224
+ token : "constant.character.escape.nasal" ,
225
+ regex : / \\ (?: x [ \d a - f A - F ] { 2 } | [ 0 - 2 ] [ 0 - 7 ] { , 2 } | 3 [ 0 - 6 ] [ 0 - 7 ] ? | 3 7 [ 0 - 7 ] ? | [ 4 - 7 ] [ 0 - 7 ] ? | r | n | t | \\ | " ) /
226
+ } , {
227
+ token : "constant.character.escape.nasal" ,
228
+ regex : / % (?: % | (?: \d + \$ ) ? [ + - ] ? (?: [ 0 ] | ' .{ 1 } ) ? - ? \d * (?: \. \d + ) ? [ b c d e E u f F g G o s x X ] ) /
229
+ } , {
230
+ defaultToken : "string.quoted.double.nasal"
231
+ } ] ,
232
+ comment : "Double quoted strings"
233
+ } , {
234
+ token : [
235
+ "punctuation.definition.string.begin.nasal" ,
236
+ "string.other" ,
237
+ "punctuation.definition.string.end.nasal"
238
+ ] ,
239
+ regex : / ( ` ) ( .) ( ` ) / ,
240
+ comment : "Single-byte ASCII character constants"
241
+ } , {
242
+ token : [
243
+ "punctuation.definition.comment.nasal" ,
244
+ "comment.line.hash.nasal"
245
+ ] ,
246
+ regex : / ( # ) ( .* $ ) / ,
247
+ comment : "Comments"
248
+ } , {
249
+ token : "constant.numeric.nasal" ,
250
+ regex : / (?: (?: \b [ 0 - 9 ] + ) ? \. ) ? \b [ 0 - 9 ] + (?: [ e E ] [ - + ] ? [ 0 - 9 ] + ) ? \b / ,
251
+ comment : "Integers, floats, and scientific format"
252
+ } , {
253
+ token : "constant.numeric.nasal" ,
254
+ regex : / 0 [ x | X ] [ 0 - 9 a - f A - F ] + / ,
255
+ comment : "Hex codes"
256
+ } , {
257
+ token : "punctuation.terminator.statement.nasal" ,
258
+ regex : / \; /
259
+ } , {
260
+ token : [
261
+ "punctuation.section.scope.begin.nasal" ,
262
+ "punctuation.section.scope.end.nasal"
263
+ ] ,
264
+ regex : / ( \[ ) ( \] ) /
265
+ } , {
266
+ todo : {
267
+ token : "punctuation.section.scope.begin.nasal" ,
268
+ regex : / \{ / ,
269
+ push : [ {
270
+ token : "punctuation.section.scope.end.nasal" ,
271
+ regex : / \} / ,
272
+ next : "pop"
273
+ } , {
274
+ include : "$self"
275
+ } ]
276
+ }
277
+ } , {
278
+ todo : {
279
+ token : "punctuation.section.scope.begin.nasal" ,
280
+ regex : / \( / ,
281
+ push : [ {
282
+ token : "punctuation.section.scope.end.nasal" ,
283
+ regex : / \) / ,
284
+ next : "pop"
285
+ } , {
286
+ include : "$self"
287
+ } ]
288
+ }
289
+ } , {
290
+ token : "invalid.illegal" ,
291
+ regex : / % | \$ | @ | & | \^ | \| | \\ | ` / ,
292
+ comment : "Illegal characters"
293
+ } , {
294
+ todo : {
295
+ comment : "TODO: Symbols in hash keys"
296
+ } ,
297
+ comment : "TODO: Symbols in hash keys"
298
+ } , {
299
+ token : "variable.language.nasal" ,
300
+ regex : / \b (?: a p p e n d | b i n d | c a l l | c a l l e r | c h r | c l o s u r e | c m p | c o m p i l e | c o n t a i n s | d e l e t e | d i e | f i n d | g h o s t t y p e | i d | i n t | k e y s | l e f t | n u m | p o p | r i g h t | s e t s i z e | s i z e | s o r t | s p l i t | s p r i n t f | s t r e q | s u b s t r | s u b v e c | t y p e o f | r e a d l i n e ) \b / ,
301
+ comment : "Core functions"
302
+ } , {
303
+ token : "variable.language.nasal" ,
304
+ regex : / \b (?: a b o r t | a b s | a i r c r a f t T o C a r t | a d d c o m m a n d | a i r p o r t i n f o | a i r w a y s R o u t e | a s s e r t | c a r t t o g e o d | c m d a r g | c o u r s e A n d D i s t a n c e | c r e a t e D i s c o n t i n u i t y | c r e a t e V i a T o | c r e a t e W P | c r e a t e W P F r o m | d e f i n e d | d i r e c t o r y | f g c o m m a n d | f i n d A i r p o r t s B y I C A O | f i n d A i r p o r t s W i t h i n R a n g e | f i n d F i x e s B y I D | f i n d N a v a i d B y F r e q u e n c y | f i n d N a v a i d s B y F r e q u e n c y | f i n d N a v a i d s B y I D | f i n d N a v a i d s W i t h i n R a n g e | f i n d d a t a | f l i g h t p l a n | g e o d i n f o | g e o d t o c a r t | g e t _ c a r t _ g r o u n d _ i n t e r s e c t i o n | g e t p r o p | g r e a t C i r c l e M o v e | i n t e r p o l a t e | i s a | l o g p r i n t | m a g v a r | m a k e t i m e r | s t a r t | s t o p | r e s t a r t | m a k e t i m e s t a m p | m d 5 | n a v i n f o | p a r s e _ m a r k d o w n | p a r s e x m l | p r i n t | p r i n t f | p r i n t l o g | r a n d | r e g i s t e r F l i g h t P l a n D e l e g a t e | r e m o v e c o m m a n d | r e m o v e l i s t e n e r | r e s o l v e p a t h | s e t l i s t e n e r | _ s e t l i s t e n e r | s e t p r o p | s r a n d | s y s t i m e | t h i s f u n c | t i l e I n d e x | t i l e P a t h | v a l u e s ) \b / ,
305
+ comment : "FG ext core functions"
306
+ } , {
307
+ token : "variable.language.nasal" ,
308
+ regex : / \b (?: s i n g l e S h o t | i s R u n n i n g | s i m u l a t e d T i m e ) \b / ,
309
+ comment : "FG ext core functions"
310
+ } , {
311
+ token : "constant.language.nasal" ,
312
+ regex : / \b (?: D 2 R | F P S 2 K T | F T 2 M | G A L 2 L | I N 2 M | K G 2 L B | K T 2 F P S | K T 2 M P S | L G 2 G A L | L B 2 K G | M 2 F T | M 2 I N | M 2 N M | M P S 2 K T | N M 2 M | R 2 D ) \b / ,
313
+ comment : "FG ext core constants"
314
+ } , {
315
+ token : "support.function.nasal" ,
316
+ regex : / \b (?: a d d C h i l d | a d d C h i l d r e n | a l i a s | c l e a r V a l u e | e q u a l s | g e t A l i a s T a r g e t | g e t A t t r i b u t e | g e t B o o l V a l u e | g e t C h i l d | g e t C h i l d r e n | g e t I n d e x | g e t N a m e | g e t N o d e | g e t P a r e n t | g e t P a t h | g e t T y p e | g e t V a l u e | g e t V a l u e s | i n i t N o d e | r e m o v e | r e m o v e A l l C h i l d r e n | r e m o v e C h i l d | r e m o v e C h i l d r e n | s e t A t t r i b u t e | s e t B o o l V a l u e | s e t D o u b l e V a l u e | s e t I n t V a l u e | s e t V a l u e | s e t V a l u e s | u n a l i a s | c o m p i l e C o n d i t i o n | c o n d i t i o n | c o p y | d u m p | g e t N o d e | n o d e L i s t | r u n B i n d i n g | s e t A l l | w r a p | w r a p N o d e ) \b / ,
317
+ comment : "FG func props"
318
+ } , {
319
+ token : "support.class.nasal" ,
320
+ regex : / \b N o d e \b / ,
321
+ comment : "FG node class"
322
+ } , {
323
+ token : "variable.language.nasal" ,
324
+ regex : / \b (?: p r o p s | g l o b a l s ) \b / ,
325
+ comment : "FG func props variables"
326
+ } , {
327
+ todo : {
328
+ token : [
329
+ "support.function.nasal" ,
330
+ "punctuation.definition.arguments.begin.nasal"
331
+ ] ,
332
+ regex : / \b ( [ a - z A - Z _ ? $ ] [ \w ? $ ] * ) ( \( ) / ,
333
+ push : [ {
334
+ token : "punctuation.definition.arguments.end.nasal" ,
335
+ regex : / \) / ,
336
+ next : "pop"
337
+ } , {
338
+ include : "$self"
339
+ } , {
340
+ defaultToken : "meta.function-call.nasal"
341
+ } ]
342
+ } ,
343
+ comment : "function call"
344
+ } ]
345
+ } ;
346
+
347
+ this . normalizeRules ( ) ;
348
+ } ;
349
+
350
+ NasalHighlightRules . metaData = {
351
+ fileTypes : [ "nas" ] ,
352
+ name : "Nasal" ,
353
+ scopeName : "source.nasal"
354
+ } ;
355
+
356
+
357
+ oop . inherits ( NasalHighlightRules , TextHighlightRules ) ;
358
+
359
+ exports . NasalHighlightRules = NasalHighlightRules ;
0 commit comments