github-linguist 7.0.0 → 7.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/grammars/source.abap.json +51 -25
  3. data/grammars/source.afm.json +22 -14
  4. data/grammars/source.ahk.json +3 -3
  5. data/grammars/source.angelscript.json +2 -2
  6. data/grammars/source.ballerina.json +26 -2
  7. data/grammars/source.clarion.json +6 -6
  8. data/grammars/source.csound.json +1 -1
  9. data/grammars/source.elixir.json +2 -2
  10. data/grammars/source.gfm.json +21 -0
  11. data/grammars/source.haproxy-config.json +100 -0
  12. data/grammars/source.jison.json +1 -1
  13. data/grammars/source.js.css.json +328 -0
  14. data/grammars/source.js.json +1 -1
  15. data/grammars/source.js.jsx.json +1030 -1686
  16. data/grammars/source.julia.json +3 -7
  17. data/grammars/source.kotlin.json +355 -487
  18. data/grammars/source.nim.json +5 -9
  19. data/grammars/source.prolog.json +1 -1
  20. data/grammars/source.python.json +52 -18
  21. data/grammars/source.rascal.json +1 -0
  22. data/grammars/source.ruby.json +28 -28
  23. data/grammars/source.sqf.json +1 -1
  24. data/grammars/source.toml.json +79 -2
  25. data/grammars/source.ts.json +85 -35
  26. data/grammars/source.tsx.json +85 -35
  27. data/grammars/source.yara.json +1 -1
  28. data/grammars/text.eml.basic.json +283 -0
  29. data/grammars/text.html.cshtml.json +356 -0
  30. data/grammars/text.roff.json +1 -1
  31. data/grammars/version +1 -1
  32. data/lib/linguist/VERSION +1 -1
  33. data/lib/linguist/documentation.yml +1 -0
  34. data/lib/linguist/generated.rb +24 -0
  35. data/lib/linguist/heuristics.yml +21 -0
  36. data/lib/linguist/language.rb +7 -0
  37. data/lib/linguist/languages.json +1 -1
  38. data/lib/linguist/languages.yml +61 -13
  39. data/lib/linguist/samples.json +2270 -797
  40. data/lib/linguist/samples.json.orig +175625 -0
  41. metadata +7 -3
  42. data/grammars/source.regexp.babel.json +0 -200
@@ -157,7 +157,7 @@
157
157
  "function_decl": {
158
158
  "patterns": [
159
159
  {
160
- "match": "([[:alpha:]_∇][[:word:]⁺-ₜ!′∇]*)({(?:[^{}]|{(?:[^{}]|{[^{}]*})*})*})?(?=\\(.*\\)(::[^\\s]+)?(\\s*\\bwhere\\b\\s*[^\\s]+)?\\s*?=(?![=\u003e]))",
160
+ "match": "([[:alpha:]_∇][[:word:]⁺-ₜ!′∇]*)({(?:[^{}]|{(?:[^{}]|{[^{}]*})*})*})?(?=\\(.*\\)(::[^\\s]+)?(\\s*\\bwhere\\b\\s+.+?)?\\s*?=(?![=\u003e]))",
161
161
  "captures": {
162
162
  "1": {
163
163
  "name": "entity.name.function.julia"
@@ -190,7 +190,7 @@
190
190
  "patterns": [
191
191
  {
192
192
  "name": "keyword.other.julia",
193
- "match": "\\b(?\u003c![:_\\.])(?:function|@generated|type|immutable|mutable\\s+struct|struct|macro|quote|abstract\\s+type|primitive\\s+type|bitstype|typealias|module|baremodule|new|where)\\b"
193
+ "match": "\\b(?\u003c![:_\\.])(?:function|mutable\\s+struct|struct|macro|quote|abstract\\s+type|primitive\\s+type|module|baremodule|where)\\b"
194
194
  },
195
195
  {
196
196
  "begin": "\\b(for)\\b",
@@ -230,10 +230,6 @@
230
230
  "name": "keyword.control.import.julia",
231
231
  "match": "\\b(?\u003c![:_])(?:import)\\b"
232
232
  },
233
- {
234
- "name": "keyword.control.importall.julia",
235
- "match": "\\b(?\u003c![:_])(?:importall)\\b"
236
- },
237
233
  {
238
234
  "name": "keyword.control.using.julia",
239
235
  "match": "\\b(?\u003c![:_])(?:using)\\b"
@@ -659,7 +655,7 @@
659
655
  "patterns": [
660
656
  {
661
657
  "name": "meta.type.julia",
662
- "match": "(?\u003e!:_)(?:type|immutable|struct)\\s+([[:alpha:]_∇][[:word:]⁺-ₜ!′∇]*)(\\s*(\u003c:)\\s*[[:alpha:]_∇][[:word:]⁺-ₜ!′∇]*(?:{.*})?)?",
658
+ "match": "(?\u003e!:_)(?:struct|mutable\\s+struct|abstract\\s+type|primitive\\s+type)\\s+([[:alpha:]_∇][[:word:]⁺-ₜ!′∇]*)(\\s*(\u003c:)\\s*[[:alpha:]_∇][[:word:]⁺-ₜ!′∇]*(?:{.*})?)?",
663
659
  "captures": {
664
660
  "1": {
665
661
  "name": "entity.name.type.julia"
@@ -17,10 +17,25 @@
17
17
  }
18
18
  },
19
19
  {
20
- "include": "#imports"
20
+ "name": "meta.import.kotlin",
21
+ "match": "^\\s*(import)\\s+([^ $.]+(?:\\.(?:[`][^$`]+[`]|[^` $.]+))+)(?:\\s+(as)\\s+([`][^$`]+[`]|[^` $.]+))?",
22
+ "captures": {
23
+ "1": {
24
+ "name": "keyword.other.import.kotlin"
25
+ },
26
+ "2": {
27
+ "name": "storage.modifier.import.java"
28
+ },
29
+ "3": {
30
+ "name": "keyword.other.kotlin"
31
+ },
32
+ "4": {
33
+ "name": "entity.name.type"
34
+ }
35
+ }
21
36
  },
22
37
  {
23
- "include": "#statements"
38
+ "include": "#code"
24
39
  }
25
40
  ],
26
41
  "repository": {
@@ -28,8 +43,8 @@
28
43
  "patterns": [
29
44
  {
30
45
  "name": "meta.declaration.annotation.kotlin",
31
- "begin": "(@[^ (]+)(\\()",
32
- "end": "(\\))",
46
+ "begin": "(@[^ (]+)(\\()?",
47
+ "end": "(\\)|\\s|$)",
33
48
  "patterns": [
34
49
  {
35
50
  "match": "(\\w*)\\s*(=)",
@@ -43,7 +58,7 @@
43
58
  }
44
59
  },
45
60
  {
46
- "include": "#statements"
61
+ "include": "#code"
47
62
  },
48
63
  {
49
64
  "name": "punctuation.seperator.property.kotlin",
@@ -70,84 +85,182 @@
70
85
  }
71
86
  ]
72
87
  },
73
- "classes": {
74
- "begin": "(?\u003c!::)(?=\\b(?:companion|class|object|interface)\\b)",
75
- "end": "(?=$|\\})",
88
+ "braces": {
76
89
  "patterns": [
77
90
  {
78
- "include": "#comments"
79
- },
80
- {
81
- "begin": "\\b(companion\\s*)?(class|object|interface)\\b",
82
- "end": "(?=\u003c|\\{|\\(|:|$)",
91
+ "name": "meta.block.kotlin",
92
+ "begin": "\\{",
93
+ "end": "\\}",
83
94
  "patterns": [
84
95
  {
85
- "include": "#comments"
86
- },
87
- {
88
- "name": "entity.name.type.class.kotlin",
89
- "match": "\\w+"
96
+ "include": "#code"
90
97
  }
91
98
  ],
92
99
  "beginCaptures": {
93
- "1": {
94
- "name": "storage.modifier.kotlin"
95
- },
96
- "2": {
97
- "name": "storage.modifier.kotlin"
100
+ "0": {
101
+ "name": "punctuation.section.group.begin.kotlin"
102
+ }
103
+ },
104
+ "endCaptures": {
105
+ "0": {
106
+ "name": "punctuation.section.group.end.kotlin"
98
107
  }
99
108
  }
100
- },
109
+ }
110
+ ]
111
+ },
112
+ "brackets": {
113
+ "patterns": [
101
114
  {
102
- "begin": "\u003c",
103
- "end": "\u003e",
115
+ "name": "meta.brackets.kotlin",
116
+ "begin": "\\[",
117
+ "end": "\\]",
104
118
  "patterns": [
105
119
  {
106
- "include": "#generics"
120
+ "include": "#code"
107
121
  }
108
- ]
122
+ ],
123
+ "beginCaptures": {
124
+ "0": {
125
+ "name": "punctuation.section.brackets.begin.kotlin"
126
+ }
127
+ },
128
+ "endCaptures": {
129
+ "0": {
130
+ "name": "punctuation.section.brackets.end.kotlin"
131
+ }
132
+ }
133
+ }
134
+ ]
135
+ },
136
+ "builtin-functions": {
137
+ "patterns": [
138
+ {
139
+ "match": "\\b(apply|also|let|takeIf|run|takeUnless|with|println)\\b\\s*(?={|\\()",
140
+ "captures": {
141
+ "1": {
142
+ "name": "support.function.kotlin"
143
+ }
144
+ }
109
145
  },
110
146
  {
111
- "begin": "\\(",
112
- "end": "\\)",
113
- "patterns": [
114
- {
115
- "include": "#parameters"
147
+ "match": "\\b(mutableListOf|listOf|mutableMapOf|mapOf|mutableSetOf|setOf)\\b\\s*(?={|\\()",
148
+ "captures": {
149
+ "1": {
150
+ "name": "support.function.kotlin"
116
151
  }
117
- ]
152
+ }
153
+ }
154
+ ]
155
+ },
156
+ "class-literal": {
157
+ "name": "meta.class.kotlin",
158
+ "begin": "(?=\\b(?:class|interface|object)\\s+\\w+)\\b",
159
+ "end": "(?=\\}|$)",
160
+ "patterns": [
161
+ {
162
+ "include": "#keyword-literal"
118
163
  },
119
164
  {
120
- "begin": "(:)",
121
- "end": "(?={|$)",
165
+ "begin": "\\b(class|object|interface)\\b\\s+(\\w+)",
166
+ "end": "(?=\\{|\\(|:|$)",
122
167
  "patterns": [
123
168
  {
124
- "name": "entity.other.inherited-class.kotlin",
125
- "match": "\\w+"
169
+ "include": "#keyword-literal"
126
170
  },
127
171
  {
128
- "begin": "\\(",
129
- "end": "\\)",
130
- "patterns": [
131
- {
132
- "include": "#expressions"
133
- }
134
- ]
172
+ "include": "#annotations"
173
+ },
174
+ {
175
+ "include": "#types"
135
176
  }
136
177
  ],
137
178
  "beginCaptures": {
138
179
  "1": {
139
- "name": "keyword.operator.declaration.kotlin"
180
+ "name": "storage.modifier.kotlin"
181
+ },
182
+ "2": {
183
+ "name": "entity.name.class.kotlin"
140
184
  }
141
185
  }
142
186
  },
143
187
  {
144
- "begin": "\\{",
145
- "end": "\\}",
188
+ "begin": "(:)\\s*(\\w+)",
189
+ "end": "(?={|=|$)",
146
190
  "patterns": [
147
191
  {
148
- "include": "#statements"
192
+ "include": "#types"
149
193
  }
150
- ]
194
+ ],
195
+ "beginCaptures": {
196
+ "1": {
197
+ "name": "keyword.operator.declaration.kotlin"
198
+ },
199
+ "2": {
200
+ "name": "entity.other.inherited-class.kotlin"
201
+ }
202
+ }
203
+ },
204
+ {
205
+ "include": "#braces"
206
+ },
207
+ {
208
+ "include": "#parens"
209
+ }
210
+ ]
211
+ },
212
+ "code": {
213
+ "patterns": [
214
+ {
215
+ "include": "#comments"
216
+ },
217
+ {
218
+ "include": "#comments-inline"
219
+ },
220
+ {
221
+ "include": "#annotations"
222
+ },
223
+ {
224
+ "include": "#class-literal"
225
+ },
226
+ {
227
+ "include": "#parens"
228
+ },
229
+ {
230
+ "include": "#braces"
231
+ },
232
+ {
233
+ "include": "#brackets"
234
+ },
235
+ {
236
+ "include": "#keyword-literal"
237
+ },
238
+ {
239
+ "include": "#types"
240
+ },
241
+ {
242
+ "include": "#keyword-operator"
243
+ },
244
+ {
245
+ "include": "#keyword-constant"
246
+ },
247
+ {
248
+ "include": "#keyword-punctuation"
249
+ },
250
+ {
251
+ "include": "#builtin-functions"
252
+ },
253
+ {
254
+ "include": "#literal-functions"
255
+ },
256
+ {
257
+ "include": "#builtin-classes"
258
+ },
259
+ {
260
+ "include": "#literal-raw-string"
261
+ },
262
+ {
263
+ "include": "#literal-string"
151
264
  }
152
265
  ]
153
266
  },
@@ -162,9 +275,6 @@
162
275
  }
163
276
  }
164
277
  },
165
- {
166
- "include": "text.html.javadoc"
167
- },
168
278
  {
169
279
  "include": "#comments-inline"
170
280
  }
@@ -195,268 +305,91 @@
195
305
  }
196
306
  ]
197
307
  },
198
- "constants": {
308
+ "keyword-constant": {
199
309
  "patterns": [
200
310
  {
201
311
  "name": "constant.language.kotlin",
202
- "match": "\\b(true|false|null|this|super)\\b"
203
- },
204
- {
205
- "name": "constant.numeric.kotlin",
206
- "match": "\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)([LlFfUuDd]|UL|ul)?\\b"
207
- },
208
- {
209
- "name": "constant.other.kotlin",
210
- "match": "\\b([A-Z][A-Z0-9_]+)\\b"
211
- }
212
- ]
213
- },
214
- "expressions": {
215
- "patterns": [
216
- {
217
- "begin": "\\(",
218
- "end": "\\)",
219
- "patterns": [
220
- {
221
- "include": "#expressions"
222
- }
223
- ]
312
+ "match": "\\b(true|false|null|class)\\b"
224
313
  },
225
314
  {
226
- "include": "#types"
315
+ "name": "variable.language.kotlin",
316
+ "match": "\\b(this|super)\\b"
227
317
  },
228
318
  {
229
- "include": "#strings"
319
+ "name": "constant.numeric.hex.kotlin",
320
+ "match": "\\b(0(x|X)[0-9A-Fa-f_]*)[L]?\\b"
230
321
  },
231
322
  {
232
- "include": "#constants"
323
+ "name": "constant.numeric.binary.kotlin",
324
+ "match": "\\b(0(b|B)[0-1_]*)[L]?\\b"
233
325
  },
234
326
  {
235
- "include": "#comments"
327
+ "name": "constant.numeric.float.kotlin",
328
+ "match": "\\b([0-9][0-9_]*\\.[0-9][0-9_]*[fFL]?)\\b"
236
329
  },
237
330
  {
238
- "include": "#keywords"
331
+ "name": "constant.numeric.integer.kotlin",
332
+ "match": "\\b([0-9][0-9_]*[fFL]?)\\b"
239
333
  }
240
334
  ]
241
335
  },
242
- "functions": {
243
- "begin": "(?=\\s*\\b(?:fun)\\b)",
244
- "end": "(?=$|\\})",
336
+ "keyword-literal": {
245
337
  "patterns": [
246
338
  {
247
- "begin": "\\b(fun)\\b",
248
- "end": "(?=\\()",
249
- "patterns": [
250
- {
251
- "begin": "\u003c",
252
- "end": "\u003e",
253
- "patterns": [
254
- {
255
- "include": "#generics"
256
- }
257
- ]
258
- },
259
- {
260
- "match": "([\\.\u003c\\?\u003e\\w]+\\.)?(\\w+)",
261
- "captures": {
262
- "2": {
263
- "name": "entity.name.function.kotlin"
264
- }
265
- }
266
- }
267
- ],
268
- "beginCaptures": {
269
- "1": {
270
- "name": "keyword.other.kotlin"
271
- }
272
- }
273
- },
274
- {
275
- "begin": "\\(",
276
- "end": "\\)",
277
- "patterns": [
278
- {
279
- "include": "#parameters"
280
- }
281
- ]
339
+ "name": "keyword.operator.kotlin",
340
+ "match": "(\\!in|\\!is|as\\?)"
282
341
  },
283
342
  {
284
- "begin": "(:)",
285
- "end": "(?={|=|$)",
286
- "patterns": [
287
- {
288
- "include": "#types"
289
- }
290
- ],
291
- "beginCaptures": {
292
- "1": {
293
- "name": "keyword.operator.declaration.kotlin"
294
- }
295
- }
343
+ "name": "keyword.operator.kotlin",
344
+ "match": "\\b(in|is|as|assert)\\b"
296
345
  },
297
346
  {
298
- "begin": "\\{",
299
- "end": "(?=\\})",
300
- "patterns": [
301
- {
302
- "include": "#statements"
303
- }
304
- ]
347
+ "name": "storage.modifier.kotlin",
348
+ "match": "\\b(const)\\b"
305
349
  },
306
350
  {
307
- "begin": "(=)",
308
- "end": "(?=$)",
309
- "patterns": [
310
- {
311
- "include": "#expressions"
312
- }
313
- ],
314
- "beginCaptures": {
315
- "1": {
316
- "name": "keyword.operator.assignment.kotlin"
317
- }
318
- }
319
- }
320
- ]
321
- },
322
- "generics": {
323
- "patterns": [
324
- {
325
- "begin": "(:)",
326
- "end": "(?=,|\u003e)",
327
- "patterns": [
328
- {
329
- "include": "#types"
330
- }
331
- ],
332
- "beginCaptures": {
333
- "1": {
334
- "name": "keyword.operator.declaration.kotlin"
335
- }
336
- }
351
+ "name": "storage.type.kotlin",
352
+ "match": "\\b(val|var)\\b"
337
353
  },
338
354
  {
339
- "include": "#keywords"
355
+ "name": "punctuation.definition.variable.kotlin",
356
+ "match": "\\b(\\_)\\b"
340
357
  },
341
358
  {
342
- "name": "storage.type.generic.kotlin",
343
- "match": "\\w+"
344
- }
345
- ]
346
- },
347
- "getters-and-setters": {
348
- "patterns": [
349
- {
350
- "begin": "\\b(get)\\b\\s*\\(\\s*\\)",
351
- "end": "\\}|(?=\\bset\\b)|$",
352
- "patterns": [
353
- {
354
- "begin": "(=)",
355
- "end": "(?=$|\\bset\\b)",
356
- "patterns": [
357
- {
358
- "include": "#expressions"
359
- }
360
- ],
361
- "beginCaptures": {
362
- "1": {
363
- "name": "keyword.operator.assignment.kotlin"
364
- }
365
- }
366
- },
367
- {
368
- "begin": "\\{",
369
- "end": "\\}",
370
- "patterns": [
371
- {
372
- "include": "#expressions"
373
- }
374
- ]
375
- }
376
- ],
377
- "beginCaptures": {
378
- "1": {
379
- "name": "entity.name.function.kotlin"
380
- }
381
- }
359
+ "name": "storage.type.kotlin",
360
+ "match": "\\b(data|inline|tailrec|operator|infix|typealias|reified)\\b"
382
361
  },
383
- {
384
- "begin": "\\b(set)\\b\\s*(?=\\()",
385
- "end": "\\}|(?=\\bget\\b)|$",
386
- "patterns": [
387
- {
388
- "begin": "\\(",
389
- "end": "\\)",
390
- "patterns": [
391
- {
392
- "include": "#parameters"
393
- }
394
- ]
395
- },
396
- {
397
- "begin": "(=)",
398
- "end": "(?=$|\\bset\\b)",
399
- "patterns": [
400
- {
401
- "include": "#expressions"
402
- }
403
- ],
404
- "beginCaptures": {
405
- "1": {
406
- "name": "keyword.operator.assignment.kotlin"
407
- }
408
- }
409
- },
410
- {
411
- "begin": "\\{",
412
- "end": "\\}",
413
- "patterns": [
414
- {
415
- "include": "#expressions"
416
- }
417
- ]
418
- }
419
- ],
420
- "beginCaptures": {
421
- "1": {
422
- "name": "entity.name.function.kotlin"
423
- }
424
- }
425
- }
426
- ]
427
- },
428
- "imports": {
429
- "patterns": [
430
- {
431
- "match": "^\\s*(import)\\s+[^ $.]+(\\.([`][^$`]+[`]|[^` $.]+))+\\s+(as)?",
432
- "captures": {
433
- "1": {
434
- "name": "keyword.other.kotlin"
435
- },
436
- "4": {
437
- "name": "keyword.other.kotlin"
438
- }
439
- }
440
- }
441
- ]
442
- },
443
- "keywords": {
444
- "patterns": [
445
362
  {
446
363
  "name": "storage.modifier.kotlin",
447
- "match": "\\b(var|val|external|public|private|protected|abstract|final|sealed|enum|open|attribute|annotation|override|inline|vararg|in|out|internal|data|tailrec|operator|infix|const|yield|typealias|typeof|expect|actual|reified|suspend)\\b"
364
+ "match": "\\b(external|public|private|protected|internal|abstract|final|sealed|enum|open|annotation|override|vararg|typealias|expect|actual|suspend|yield)\\b"
448
365
  },
449
366
  {
450
367
  "name": "keyword.control.catch-exception.kotlin",
451
368
  "match": "\\b(try|catch|finally|throw)\\b"
452
369
  },
370
+ {
371
+ "name": "keyword.control.conditional.kotlin",
372
+ "match": "\\b(if|else|when)\\b"
373
+ },
453
374
  {
454
375
  "name": "keyword.control.kotlin",
455
- "match": "\\b(if|else|while|for|do|return|when|where|break|continue)\\b"
376
+ "match": "\\b(while|for|do|return|break|continue)\\b"
456
377
  },
457
378
  {
458
- "name": "keyword.operator.kotlin",
459
- "match": "\\b(in|is|as|assert)\\b"
379
+ "name": "entity.name.function.constructor",
380
+ "match": "\\b(constructor|init)\\b"
381
+ },
382
+ {
383
+ "name": "storage.type.kotlin",
384
+ "match": "\\b(companion|object)\\b"
385
+ }
386
+ ]
387
+ },
388
+ "keyword-operator": {
389
+ "patterns": [
390
+ {
391
+ "name": "keyword.operator.bitwise.kotlin",
392
+ "match": "\\b(and|or|not|inv)\\b"
460
393
  },
461
394
  {
462
395
  "name": "keyword.operator.comparison.kotlin",
@@ -466,21 +399,9 @@
466
399
  "name": "keyword.operator.assignment.kotlin",
467
400
  "match": "(=)"
468
401
  },
469
- {
470
- "name": "keyword.operator.reference.kotlin",
471
- "match": "(::)"
472
- },
473
402
  {
474
403
  "name": "keyword.operator.declaration.kotlin",
475
- "match": "(:)"
476
- },
477
- {
478
- "name": "keyword.operator.dot.kotlin",
479
- "match": "(\\.)"
480
- },
481
- {
482
- "name": "keyword.operator.dot.kotlin",
483
- "match": "(\\?\\.)"
404
+ "match": "(:(?!:))"
484
405
  },
485
406
  {
486
407
  "name": "keyword.operator.elvis.kotlin",
@@ -496,61 +417,74 @@
496
417
  },
497
418
  {
498
419
  "name": "keyword.operator.arithmetic.assign.kotlin",
499
- "match": "(\\+=|\\-=|\\*=|\\/=)"
420
+ "match": "(\\+\\=|\\-\\=|\\*\\=|\\/\\=)"
500
421
  },
501
422
  {
502
423
  "name": "keyword.operator.logical.kotlin",
503
- "match": "(!|\u0026\u0026|\\|\\|)"
424
+ "match": "(\\!|\\\u0026\\\u0026|\\|\\|)"
504
425
  },
505
426
  {
506
427
  "name": "keyword.operator.range.kotlin",
507
428
  "match": "(\\.\\.)"
508
- },
509
- {
510
- "name": "punctuation.terminator.kotlin",
511
- "match": "(;)"
512
429
  }
513
430
  ]
514
431
  },
515
- "namespaces": {
432
+ "keyword-punctuation": {
516
433
  "patterns": [
517
434
  {
518
- "name": "keyword.other.kotlin",
519
- "match": "\\b(namespace)\\b"
435
+ "name": "punctuation.accessor.reference.kotlin",
436
+ "match": "(::)"
520
437
  },
521
438
  {
522
- "begin": "\\{",
523
- "end": "\\}",
524
- "patterns": [
525
- {
526
- "include": "#statements"
527
- }
528
- ]
439
+ "name": "punctuation.accessor.dot.safe.kotlin",
440
+ "match": "(\\?\\.)"
441
+ },
442
+ {
443
+ "name": "punctuation.accessor.dot.kotlin",
444
+ "match": "(\\.)"
445
+ },
446
+ {
447
+ "name": "punctuation.seperator.kotlin",
448
+ "match": "(\\,)"
449
+ },
450
+ {
451
+ "name": "punctuation.terminator.kotlin",
452
+ "match": "(\\;)"
529
453
  }
530
454
  ]
531
455
  },
532
- "parameters": {
456
+ "literal-functions": {
457
+ "begin": "(?=\\b(?:fun)\\b)",
458
+ "end": "(?=$|=|\\})",
533
459
  "patterns": [
534
460
  {
535
- "begin": "(:)",
536
- "end": "(?=,|\\)|=)",
461
+ "begin": "\\b(fun)\\b",
462
+ "end": "(?=\\()",
537
463
  "patterns": [
464
+ {
465
+ "match": "([\\.\u003c\\?\u003e\\w]+\\.)?(\\w+|(`[^`]*`))",
466
+ "captures": {
467
+ "2": {
468
+ "name": "entity.name.function.kotlin"
469
+ }
470
+ }
471
+ },
538
472
  {
539
473
  "include": "#types"
540
474
  }
541
475
  ],
542
476
  "beginCaptures": {
543
477
  "1": {
544
- "name": "keyword.operator.declaration.kotlin"
478
+ "name": "keyword.other.kotlin"
545
479
  }
546
480
  }
547
481
  },
548
482
  {
549
- "begin": "(=)",
550
- "end": "(?=,|\\))",
483
+ "begin": "(:)",
484
+ "end": "(?={|=|$)",
551
485
  "patterns": [
552
486
  {
553
- "include": "#expressions"
487
+ "include": "#types"
554
488
  }
555
489
  ],
556
490
  "beginCaptures": {
@@ -560,56 +494,22 @@
560
494
  }
561
495
  },
562
496
  {
563
- "include": "#keywords"
564
- },
565
- {
566
- "name": "variable.parameter.function.kotlin",
567
- "match": "\\w+"
568
- }
569
- ]
570
- },
571
- "statements": {
572
- "patterns": [
573
- {
574
- "include": "#namespaces"
575
- },
576
- {
577
- "include": "#annotations"
578
- },
579
- {
580
- "include": "#typedefs"
581
- },
582
- {
583
- "include": "#classes"
584
- },
585
- {
586
- "include": "#functions"
497
+ "include": "#parens"
587
498
  },
588
499
  {
589
- "include": "#variables"
590
- },
591
- {
592
- "include": "#getters-and-setters"
593
- },
594
- {
595
- "include": "#expressions"
500
+ "include": "#braces"
596
501
  }
597
502
  ]
598
503
  },
599
- "strings": {
504
+ "literal-raw-string": {
600
505
  "patterns": [
601
506
  {
602
- "name": "string.quoted.third.kotlin",
507
+ "name": "string.quoted.triple.kotlin",
603
508
  "begin": "\"\"\"",
604
509
  "end": "\"\"\"",
605
510
  "patterns": [
606
511
  {
607
- "name": "variable.parameter.template.kotlin",
608
- "match": "(\\$\\w+|\\$\\{[^\\}]+\\})"
609
- },
610
- {
611
- "name": "constant.character.escape.kotlin",
612
- "match": "\\\\."
512
+ "include": "#string-content"
613
513
  }
614
514
  ],
615
515
  "beginCaptures": {
@@ -622,19 +522,18 @@
622
522
  "name": "punctuation.definition.string.end.kotlin"
623
523
  }
624
524
  }
625
- },
525
+ }
526
+ ]
527
+ },
528
+ "literal-string": {
529
+ "patterns": [
626
530
  {
627
531
  "name": "string.quoted.double.kotlin",
628
532
  "begin": "\"",
629
533
  "end": "\"",
630
534
  "patterns": [
631
535
  {
632
- "name": "variable.parameter.template.kotlin",
633
- "match": "(\\$\\w+|\\$\\{[^\\}]+\\})"
634
- },
635
- {
636
- "name": "constant.character.escape.kotlin",
637
- "match": "\\\\."
536
+ "include": "#string-content"
638
537
  }
639
538
  ],
640
539
  "beginCaptures": {
@@ -647,209 +546,178 @@
647
546
  "name": "punctuation.definition.string.end.kotlin"
648
547
  }
649
548
  }
650
- },
549
+ }
550
+ ]
551
+ },
552
+ "parameters": {
553
+ "patterns": [
651
554
  {
652
- "name": "string.quoted.single.kotlin",
653
- "begin": "'",
654
- "end": "'",
555
+ "begin": "(:)",
556
+ "end": "(?=,|=|\\))",
655
557
  "patterns": [
656
558
  {
657
- "name": "constant.character.escape.kotlin",
658
- "match": "\\\\."
559
+ "include": "#types"
659
560
  }
660
561
  ],
661
562
  "beginCaptures": {
662
- "0": {
663
- "name": "punctuation.definition.string.begin.kotlin"
664
- }
665
- },
666
- "endCaptures": {
667
- "0": {
668
- "name": "punctuation.definition.string.end.kotlin"
563
+ "1": {
564
+ "name": "keyword.operator.declaration.kotlin"
669
565
  }
670
566
  }
671
567
  },
672
568
  {
673
- "name": "string.quoted.single.kotlin",
674
- "begin": "`",
675
- "end": "`",
569
+ "name": "variable.parameter.function.kotlin",
570
+ "match": "\\w+(?=:)"
571
+ },
572
+ {
573
+ "include": "#keyword-literal"
574
+ }
575
+ ]
576
+ },
577
+ "parens": {
578
+ "patterns": [
579
+ {
580
+ "name": "meta.group.kotlin",
581
+ "begin": "\\(",
582
+ "end": "\\)",
583
+ "patterns": [
584
+ {
585
+ "include": "#keyword-punctuation"
586
+ },
587
+ {
588
+ "include": "#parameters"
589
+ },
590
+ {
591
+ "include": "#code"
592
+ }
593
+ ],
676
594
  "beginCaptures": {
677
595
  "0": {
678
- "name": "punctuation.definition.string.begin.kotlin"
596
+ "name": "punctuation.section.group.begin.kotlin"
679
597
  }
680
598
  },
681
599
  "endCaptures": {
682
600
  "0": {
683
- "name": "punctuation.definition.string.end.kotlin"
601
+ "name": "punctuation.section.group.end.kotlin"
684
602
  }
685
603
  }
686
604
  }
687
605
  ]
688
606
  },
689
- "typedefs": {
690
- "begin": "(?=\\s*(?:type))",
691
- "end": "(?=$)",
607
+ "string-content": {
692
608
  "patterns": [
693
609
  {
694
- "name": "keyword.other.kotlin",
695
- "match": "\\b(type)\\b"
610
+ "name": "constant.character.escape.newline.kotlin",
611
+ "match": "\\\\\\s*\\n"
696
612
  },
697
613
  {
698
- "begin": "\u003c",
699
- "end": "\u003e",
614
+ "name": "constant.character.escape.kotlin",
615
+ "match": "\\\\(x[\\da-fA-F]{2}|u[\\da-fA-F]{4}|.)"
616
+ },
617
+ {
618
+ "name": "entity.string.template.element.kotlin",
619
+ "begin": "(\\$)(\\{)",
620
+ "end": "\\}",
700
621
  "patterns": [
701
622
  {
702
- "include": "#generics"
623
+ "include": "#code"
703
624
  }
704
- ]
705
- },
706
- {
707
- "include": "#expressions"
625
+ ],
626
+ "beginCaptures": {
627
+ "1": {
628
+ "name": "punctuation.definition.keyword.kotlin"
629
+ },
630
+ "2": {
631
+ "name": "punctuation.section.block.begin.kotlin"
632
+ }
633
+ },
634
+ "endCaptures": {
635
+ "0": {
636
+ "name": "punctuation.section.block.end.kotlin"
637
+ }
638
+ }
708
639
  }
709
640
  ]
710
641
  },
711
642
  "types": {
712
643
  "patterns": [
713
644
  {
714
- "name": "storage.type.builtin.kotlin",
715
- "match": "\\b(Nothing|Any|Unit|String|CharSequence|Int|Boolean|Char|Long|Double|Float|Short|Byte|dynamic)\\b"
645
+ "name": "support.class.kotlin",
646
+ "match": "\\b(Nothing|Any|Unit|String|CharSequence|Int|Boolean|Char|Long|Double|Float|Short|Byte|Array|List|Map|Set|dynamic)\\b(\\?)?"
716
647
  },
717
648
  {
718
- "name": "storage.type.builtin.array.kotlin",
719
- "match": "\\b(IntArray|BooleanArray|CharArray|LongArray|DoubleArray|FloatArray|ShortArray|ByteArray)\\b"
649
+ "name": "support.class.kotlin",
650
+ "match": "\\b(IntArray|BooleanArray|CharArray|LongArray|DoubleArray|FloatArray|ShortArray|ByteArray)\\b(\\?)?"
720
651
  },
721
652
  {
722
- "begin": "\\b(Array|List|Map)\u003c\\b",
723
- "end": "\u003e",
653
+ "name": "entity.name.type.class.kotlin",
654
+ "match": "((?:[a-zA-Z]\\w*\\.)*[A-Z]+\\w*[a-z]+\\w*)(\\?)",
724
655
  "patterns": [
725
656
  {
726
- "include": "#types"
657
+ "include": "#keyword-punctuation"
727
658
  },
728
- {
729
- "include": "#keywords"
730
- }
731
- ],
732
- "beginCaptures": {
733
- "1": {
734
- "name": "storage.type.builtin.collection.kotlin"
735
- }
736
- }
737
- },
738
- {
739
- "begin": "\\w+\u003c",
740
- "end": "\u003e",
741
- "patterns": [
742
659
  {
743
660
  "include": "#types"
744
- },
745
- {
746
- "include": "#keywords"
747
661
  }
748
662
  ]
749
663
  },
750
664
  {
751
- "begin": "\\{",
752
- "end": "\\}",
753
- "patterns": [
754
- {
755
- "include": "#statements"
756
- }
757
- ]
758
- },
759
- {
760
- "begin": "\\(",
761
- "end": "\\)",
762
- "patterns": [
763
- {
764
- "include": "#types"
665
+ "name": "entity.name.type.class.kotlin",
666
+ "match": "\\b(?:[a-z]\\w*(\\.))*[A-Z]+\\w*\\b",
667
+ "captures": {
668
+ "1": {
669
+ "name": "keyword.operator.dereference.kotlin"
765
670
  }
766
- ]
671
+ }
767
672
  },
768
673
  {
769
- "name": "keyword.operator.declaration.kotlin",
770
- "match": "(-\u003e)"
771
- }
772
- ]
773
- },
774
- "variables": {
775
- "begin": "(?=\\s*\\b(?:var|val)\\b)",
776
- "end": "(?=:|=|(\\b(by)\\b)|$)",
777
- "patterns": [
778
- {
779
- "begin": "\\b(var|val)\\b",
780
- "end": "(?=:|=|(\\b(by)\\b)|$)",
674
+ "name": "meta.generic.kotlin",
675
+ "begin": "\\\u003c",
676
+ "end": "\\\u003e",
781
677
  "patterns": [
782
678
  {
783
- "begin": "\u003c",
784
- "end": "\u003e",
785
- "patterns": [
786
- {
787
- "include": "#generics"
788
- }
789
- ]
679
+ "name": "storage.modifier.kotlin",
680
+ "match": "\\b(out|in)\\b"
790
681
  },
791
682
  {
792
- "match": "([\\.\u003c\\?\u003e\\w]+\\.)?(\\w+)",
793
- "captures": {
794
- "2": {
795
- "name": "entity.name.variable.kotlin"
796
- }
797
- }
683
+ "include": "#types"
798
684
  }
799
685
  ],
800
686
  "beginCaptures": {
801
- "1": {
802
- "name": "keyword.other.kotlin"
687
+ "0": {
688
+ "name": "punctuation.definition.generic.begin.kotlin"
689
+ }
690
+ },
691
+ "endCaptures": {
692
+ "0": {
693
+ "name": "punctuation.definition.generic.end.kotlin"
803
694
  }
804
695
  }
805
696
  },
806
697
  {
807
- "begin": "(:)",
808
- "end": "(?==|$)",
698
+ "begin": "\\(",
699
+ "end": "\\)",
809
700
  "patterns": [
810
701
  {
811
702
  "include": "#types"
812
- },
813
- {
814
- "include": "#getters-and-setters"
815
703
  }
816
704
  ],
817
705
  "beginCaptures": {
818
- "1": {
819
- "name": "keyword.operator.declaration.kotlin"
706
+ "0": {
707
+ "name": "punctuation.section.group.begin.kotlin"
708
+ }
709
+ },
710
+ "endCaptures": {
711
+ "0": {
712
+ "name": "punctuation.section.group.end.kotlin"
820
713
  }
821
714
  }
822
715
  },
823
716
  {
824
- "begin": "\\b(by)\\b",
825
- "end": "(?=$)",
826
- "patterns": [
827
- {
828
- "include": "#expressions"
829
- }
830
- ],
831
- "beginCaptures": {
832
- "1": {
833
- "name": "keyword.other.kotlin"
834
- }
835
- }
717
+ "include": "#keyword-punctuation"
836
718
  },
837
719
  {
838
- "begin": "(=)",
839
- "end": "(?=$)",
840
- "patterns": [
841
- {
842
- "include": "#expressions"
843
- },
844
- {
845
- "include": "#getters-and-setters"
846
- }
847
- ],
848
- "beginCaptures": {
849
- "1": {
850
- "name": "keyword.operator.assignment.kotlin"
851
- }
852
- }
720
+ "include": "#keyword-operator"
853
721
  }
854
722
  ]
855
723
  }