tm-grammars 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. package/LICENSE +22 -0
  2. package/NOTICE +6565 -0
  3. package/README.md +211 -0
  4. package/grammars/abap.json +380 -0
  5. package/grammars/actionscript-3.json +951 -0
  6. package/grammars/ada.json +3874 -0
  7. package/grammars/apache.json +562 -0
  8. package/grammars/apex.json +3203 -0
  9. package/grammars/apl.json +1479 -0
  10. package/grammars/applescript.json +1406 -0
  11. package/grammars/ara.json +428 -0
  12. package/grammars/asm.json +1741 -0
  13. package/grammars/astro.json +776 -0
  14. package/grammars/awk.json +388 -0
  15. package/grammars/ballerina.json +3768 -0
  16. package/grammars/bat.json +783 -0
  17. package/grammars/beancount.json +831 -0
  18. package/grammars/berry.json +172 -0
  19. package/grammars/bibtex.json +315 -0
  20. package/grammars/bicep.json +239 -0
  21. package/grammars/blade.json +3870 -0
  22. package/grammars/c.json +3552 -0
  23. package/grammars/cadence.json +738 -0
  24. package/grammars/clarity.json +877 -0
  25. package/grammars/clojure.json +426 -0
  26. package/grammars/cmake.json +143 -0
  27. package/grammars/cobol.json +1124 -0
  28. package/grammars/codeql.json +1540 -0
  29. package/grammars/coffee.json +1311 -0
  30. package/grammars/cpp-macro.json +9498 -0
  31. package/grammars/cpp.json +16635 -0
  32. package/grammars/crystal.json +1866 -0
  33. package/grammars/csharp.json +5722 -0
  34. package/grammars/css.json +1860 -0
  35. package/grammars/csv.json +46 -0
  36. package/grammars/cue.json +1128 -0
  37. package/grammars/cypher.json +353 -0
  38. package/grammars/d.json +3185 -0
  39. package/grammars/dart.json +522 -0
  40. package/grammars/dax.json +185 -0
  41. package/grammars/diff.json +155 -0
  42. package/grammars/docker.json +97 -0
  43. package/grammars/dream-maker.json +640 -0
  44. package/grammars/elixir.json +1014 -0
  45. package/grammars/elm.json +751 -0
  46. package/grammars/erb.json +156 -0
  47. package/grammars/erlang.json +1757 -0
  48. package/grammars/fish.json +189 -0
  49. package/grammars/fsharp.json +1831 -0
  50. package/grammars/gdresource.json +290 -0
  51. package/grammars/gdscript.json +969 -0
  52. package/grammars/gdshader.json +405 -0
  53. package/grammars/gherkin.json +133 -0
  54. package/grammars/git-commit.json +85 -0
  55. package/grammars/git-rebase.json +56 -0
  56. package/grammars/glimmer-js.json +98 -0
  57. package/grammars/glimmer-ts.json +98 -0
  58. package/grammars/glsl.json +57 -0
  59. package/grammars/gnuplot.json +892 -0
  60. package/grammars/go.json +1012 -0
  61. package/grammars/graphql.json +1295 -0
  62. package/grammars/groovy.json +1378 -0
  63. package/grammars/hack.json +2650 -0
  64. package/grammars/haml.json +598 -0
  65. package/grammars/handlebars.json +848 -0
  66. package/grammars/haskell.json +2431 -0
  67. package/grammars/hcl.json +787 -0
  68. package/grammars/hjson.json +821 -0
  69. package/grammars/hlsl.json +212 -0
  70. package/grammars/html.json +93 -0
  71. package/grammars/imba.json +2696 -0
  72. package/grammars/ini.json +108 -0
  73. package/grammars/java.json +1885 -0
  74. package/grammars/javascript.json +5984 -0
  75. package/grammars/jinja-html.json +16 -0
  76. package/grammars/jinja.json +345 -0
  77. package/grammars/jison.json +715 -0
  78. package/grammars/jsdoc.json +21 -0
  79. package/grammars/json.json +208 -0
  80. package/grammars/json5.json +244 -0
  81. package/grammars/jsonc.json +208 -0
  82. package/grammars/jsonl.json +208 -0
  83. package/grammars/jsonnet.json +211 -0
  84. package/grammars/jssm.json +159 -0
  85. package/grammars/jsx.json +5984 -0
  86. package/grammars/julia.json +1061 -0
  87. package/grammars/kotlin.json +580 -0
  88. package/grammars/kusto.json +687 -0
  89. package/grammars/latex.json +2395 -0
  90. package/grammars/less.json +5012 -0
  91. package/grammars/liquid.json +990 -0
  92. package/grammars/lisp.json +121 -0
  93. package/grammars/logo.json +55 -0
  94. package/grammars/lua.json +956 -0
  95. package/grammars/make.json +629 -0
  96. package/grammars/markdown.json +3066 -0
  97. package/grammars/marko.json +1344 -0
  98. package/grammars/matlab.json +1131 -0
  99. package/grammars/mdc.json +571 -0
  100. package/grammars/mdx.json +5629 -0
  101. package/grammars/mermaid.json +1382 -0
  102. package/grammars/mojo.json +4153 -0
  103. package/grammars/narrat.json +227 -0
  104. package/grammars/nextflow.json +298 -0
  105. package/grammars/nginx.json +2121 -0
  106. package/grammars/nim.json +1522 -0
  107. package/grammars/nix.json +1200 -0
  108. package/grammars/nushell.json +1047 -0
  109. package/grammars/objective-c.json +3750 -0
  110. package/grammars/objective-cpp.json +7242 -0
  111. package/grammars/ocaml.json +2967 -0
  112. package/grammars/pascal.json +154 -0
  113. package/grammars/perl.json +2971 -0
  114. package/grammars/php.json +4024 -0
  115. package/grammars/plsql.json +241 -0
  116. package/grammars/postcss.json +377 -0
  117. package/grammars/powerquery.json +349 -0
  118. package/grammars/powershell.json +1024 -0
  119. package/grammars/prisma.json +443 -0
  120. package/grammars/prolog.json +298 -0
  121. package/grammars/proto.json +507 -0
  122. package/grammars/pug.json +1033 -0
  123. package/grammars/puppet.json +777 -0
  124. package/grammars/purescript.json +871 -0
  125. package/grammars/python.json +4208 -0
  126. package/grammars/r.json +637 -0
  127. package/grammars/raku.json +310 -0
  128. package/grammars/razor.json +1813 -0
  129. package/grammars/reg.json +136 -0
  130. package/grammars/rel.json +200 -0
  131. package/grammars/riscv.json +298 -0
  132. package/grammars/rst.json +734 -0
  133. package/grammars/ruby.json +2769 -0
  134. package/grammars/rust.json +1171 -0
  135. package/grammars/sas.json +302 -0
  136. package/grammars/sass.json +618 -0
  137. package/grammars/scala.json +1313 -0
  138. package/grammars/scheme.json +384 -0
  139. package/grammars/scss.json +1874 -0
  140. package/grammars/shaderlab.json +199 -0
  141. package/grammars/shellscript.json +2025 -0
  142. package/grammars/shellsession.json +33 -0
  143. package/grammars/smalltalk.json +235 -0
  144. package/grammars/solidity.json +1210 -0
  145. package/grammars/sparql.json +45 -0
  146. package/grammars/splunk.json +91 -0
  147. package/grammars/sql.json +631 -0
  148. package/grammars/ssh-config.json +88 -0
  149. package/grammars/stata.json +3050 -0
  150. package/grammars/stylus.json +1208 -0
  151. package/grammars/svelte.json +1171 -0
  152. package/grammars/swift.json +4203 -0
  153. package/grammars/system-verilog.json +1063 -0
  154. package/grammars/tasl.json +292 -0
  155. package/grammars/tcl.json +291 -0
  156. package/grammars/tex.json +281 -0
  157. package/grammars/toml.json +431 -0
  158. package/grammars/tsx.json +5984 -0
  159. package/grammars/turtle.json +261 -0
  160. package/grammars/twig.json +1394 -0
  161. package/grammars/typescript.json +5735 -0
  162. package/grammars/v.json +1001 -0
  163. package/grammars/vb.json +232 -0
  164. package/grammars/verilog.json +305 -0
  165. package/grammars/vhdl.json +1484 -0
  166. package/grammars/viml.json +445 -0
  167. package/grammars/vue-html.json +559 -0
  168. package/grammars/vue.json +1237 -0
  169. package/grammars/vyper.json +5415 -0
  170. package/grammars/wasm.json +831 -0
  171. package/grammars/wenyan.json +129 -0
  172. package/grammars/wgsl.json +391 -0
  173. package/grammars/wolfram.json +2370 -0
  174. package/grammars/xml.json +382 -0
  175. package/grammars/xsl.json +89 -0
  176. package/grammars/yaml.json +616 -0
  177. package/grammars/zenscript.json +257 -0
  178. package/grammars/zig.json +312 -0
  179. package/index.d.ts +18 -0
  180. package/index.js +2165 -0
  181. package/package.json +46 -0
@@ -0,0 +1,1200 @@
1
+ {
2
+ "displayName": "Nix",
3
+ "fileTypes": [
4
+ "nix"
5
+ ],
6
+ "name": "nix",
7
+ "patterns": [
8
+ {
9
+ "include": "#expression"
10
+ }
11
+ ],
12
+ "repository": {
13
+ "attribute-bind": {
14
+ "patterns": [
15
+ {
16
+ "include": "#attribute-name"
17
+ },
18
+ {
19
+ "include": "#attribute-bind-from-equals"
20
+ }
21
+ ]
22
+ },
23
+ "attribute-bind-from-equals": {
24
+ "begin": "\\=",
25
+ "beginCaptures": {
26
+ "0": {
27
+ "name": "keyword.operator.bind.nix"
28
+ }
29
+ },
30
+ "end": "\\;",
31
+ "endCaptures": {
32
+ "0": {
33
+ "name": "punctuation.terminator.bind.nix"
34
+ }
35
+ },
36
+ "patterns": [
37
+ {
38
+ "include": "#expression"
39
+ }
40
+ ]
41
+ },
42
+ "attribute-inherit": {
43
+ "begin": "\\binherit\\b",
44
+ "beginCaptures": {
45
+ "0": {
46
+ "name": "keyword.other.inherit.nix"
47
+ }
48
+ },
49
+ "end": "\\;",
50
+ "endCaptures": {
51
+ "0": {
52
+ "name": "punctuation.terminator.inherit.nix"
53
+ }
54
+ },
55
+ "patterns": [
56
+ {
57
+ "begin": "\\(",
58
+ "beginCaptures": {
59
+ "0": {
60
+ "name": "punctuation.section.function.arguments.nix"
61
+ }
62
+ },
63
+ "end": "(?=\\;)",
64
+ "patterns": [
65
+ {
66
+ "begin": "\\)",
67
+ "beginCaptures": {
68
+ "0": {
69
+ "name": "punctuation.section.function.arguments.nix"
70
+ }
71
+ },
72
+ "end": "(?=\\;)",
73
+ "patterns": [
74
+ {
75
+ "include": "#bad-reserved"
76
+ },
77
+ {
78
+ "include": "#attribute-name-single"
79
+ },
80
+ {
81
+ "include": "#others"
82
+ }
83
+ ]
84
+ },
85
+ {
86
+ "include": "#expression"
87
+ }
88
+ ]
89
+ },
90
+ {
91
+ "begin": "(?=[a-zA-Z\\_])",
92
+ "end": "(?=\\;)",
93
+ "patterns": [
94
+ {
95
+ "include": "#bad-reserved"
96
+ },
97
+ {
98
+ "include": "#attribute-name-single"
99
+ },
100
+ {
101
+ "include": "#others"
102
+ }
103
+ ]
104
+ },
105
+ {
106
+ "include": "#others"
107
+ }
108
+ ]
109
+ },
110
+ "attribute-name": {
111
+ "patterns": [
112
+ {
113
+ "match": "\\b[a-zA-Z\\_][a-zA-Z0-9\\_\\'\\-]*",
114
+ "name": "entity.other.attribute-name.multipart.nix"
115
+ },
116
+ {
117
+ "match": "\\."
118
+ },
119
+ {
120
+ "include": "#string-quoted"
121
+ },
122
+ {
123
+ "include": "#interpolation"
124
+ }
125
+ ]
126
+ },
127
+ "attribute-name-single": {
128
+ "match": "\\b[a-zA-Z\\_][a-zA-Z0-9\\_\\'\\-]*",
129
+ "name": "entity.other.attribute-name.single.nix"
130
+ },
131
+ "attrset-contents": {
132
+ "patterns": [
133
+ {
134
+ "include": "#attribute-inherit"
135
+ },
136
+ {
137
+ "include": "#bad-reserved"
138
+ },
139
+ {
140
+ "include": "#attribute-bind"
141
+ },
142
+ {
143
+ "include": "#others"
144
+ }
145
+ ]
146
+ },
147
+ "attrset-definition": {
148
+ "begin": "(?=\\{)",
149
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
150
+ "patterns": [
151
+ {
152
+ "begin": "(\\{)",
153
+ "beginCaptures": {
154
+ "0": {
155
+ "name": "punctuation.definition.attrset.nix"
156
+ }
157
+ },
158
+ "end": "(\\})",
159
+ "endCaptures": {
160
+ "0": {
161
+ "name": "punctuation.definition.attrset.nix"
162
+ }
163
+ },
164
+ "patterns": [
165
+ {
166
+ "include": "#attrset-contents"
167
+ }
168
+ ]
169
+ },
170
+ {
171
+ "begin": "(?<=\\})",
172
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
173
+ "patterns": [
174
+ {
175
+ "include": "#expression-cont"
176
+ }
177
+ ]
178
+ }
179
+ ]
180
+ },
181
+ "attrset-definition-brace-opened": {
182
+ "patterns": [
183
+ {
184
+ "begin": "(?<=\\})",
185
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
186
+ "patterns": [
187
+ {
188
+ "include": "#expression-cont"
189
+ }
190
+ ]
191
+ },
192
+ {
193
+ "begin": "(?=.?)",
194
+ "end": "\\}",
195
+ "endCaptures": {
196
+ "0": {
197
+ "name": "punctuation.definition.attrset.nix"
198
+ }
199
+ },
200
+ "patterns": [
201
+ {
202
+ "include": "#attrset-contents"
203
+ }
204
+ ]
205
+ }
206
+ ]
207
+ },
208
+ "attrset-for-sure": {
209
+ "patterns": [
210
+ {
211
+ "begin": "(?=\\brec\\b)",
212
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
213
+ "patterns": [
214
+ {
215
+ "begin": "\\brec\\b",
216
+ "beginCaptures": {
217
+ "0": {
218
+ "name": "keyword.other.nix"
219
+ }
220
+ },
221
+ "end": "(?=\\{)",
222
+ "patterns": [
223
+ {
224
+ "include": "#others"
225
+ }
226
+ ]
227
+ },
228
+ {
229
+ "include": "#attrset-definition"
230
+ },
231
+ {
232
+ "include": "#others"
233
+ }
234
+ ]
235
+ },
236
+ {
237
+ "begin": "(?=\\{\\s*(\\}|[^,?]*(=|;)))",
238
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
239
+ "patterns": [
240
+ {
241
+ "include": "#attrset-definition"
242
+ },
243
+ {
244
+ "include": "#others"
245
+ }
246
+ ]
247
+ }
248
+ ]
249
+ },
250
+ "attrset-or-function": {
251
+ "begin": "\\{",
252
+ "beginCaptures": {
253
+ "0": {
254
+ "name": "punctuation.definition.attrset-or-function.nix"
255
+ }
256
+ },
257
+ "end": "(?=([\\])};]|\\b(else|then)\\b))",
258
+ "patterns": [
259
+ {
260
+ "begin": "(?=(\\s*\\}|\\\"|\\binherit\\b|\\b[a-zA-Z\\_][a-zA-Z0-9\\_\\'\\-]*(\\s*\\.|\\s*=[^=])))",
261
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
262
+ "patterns": [
263
+ {
264
+ "include": "#attrset-definition-brace-opened"
265
+ }
266
+ ]
267
+ },
268
+ {
269
+ "begin": "(?=(\\.\\.\\.|\\b[a-zA-Z\\_][a-zA-Z0-9\\_\\'\\-]*\\s*[,?]))",
270
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
271
+ "patterns": [
272
+ {
273
+ "include": "#function-definition-brace-opened"
274
+ }
275
+ ]
276
+ },
277
+ {
278
+ "include": "#bad-reserved"
279
+ },
280
+ {
281
+ "begin": "\\b[a-zA-Z\\_][a-zA-Z0-9\\_\\'\\-]*",
282
+ "beginCaptures": {
283
+ "0": {
284
+ "name": "variable.parameter.function.maybe.nix"
285
+ }
286
+ },
287
+ "end": "(?=([\\])};]|\\b(else|then)\\b))",
288
+ "patterns": [
289
+ {
290
+ "begin": "(?=\\.)",
291
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
292
+ "patterns": [
293
+ {
294
+ "include": "#attrset-definition-brace-opened"
295
+ }
296
+ ]
297
+ },
298
+ {
299
+ "begin": "\\s*(\\,)",
300
+ "beginCaptures": {
301
+ "1": {
302
+ "name": "keyword.operator.nix"
303
+ }
304
+ },
305
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
306
+ "patterns": [
307
+ {
308
+ "include": "#function-definition-brace-opened"
309
+ }
310
+ ]
311
+ },
312
+ {
313
+ "begin": "(?=\\=)",
314
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
315
+ "patterns": [
316
+ {
317
+ "include": "#attribute-bind-from-equals"
318
+ },
319
+ {
320
+ "include": "#attrset-definition-brace-opened"
321
+ }
322
+ ]
323
+ },
324
+ {
325
+ "begin": "(?=\\?)",
326
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
327
+ "patterns": [
328
+ {
329
+ "include": "#function-parameter-default"
330
+ },
331
+ {
332
+ "begin": "\\,",
333
+ "beginCaptures": {
334
+ "0": {
335
+ "name": "keyword.operator.nix"
336
+ }
337
+ },
338
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
339
+ "patterns": [
340
+ {
341
+ "include": "#function-definition-brace-opened"
342
+ }
343
+ ]
344
+ }
345
+ ]
346
+ },
347
+ {
348
+ "include": "#others"
349
+ }
350
+ ]
351
+ },
352
+ {
353
+ "include": "#others"
354
+ }
355
+ ]
356
+ },
357
+ "bad-reserved": {
358
+ "match": "\\b(if|then|else|assert|with|let|in|rec|inherit)\\b",
359
+ "name": "invalid.illegal.reserved.nix"
360
+ },
361
+ "comment": {
362
+ "patterns": [
363
+ {
364
+ "begin": "/\\*([^*]|\\*[^\\/])*",
365
+ "end": "\\*\\/",
366
+ "name": "comment.block.nix",
367
+ "patterns": [
368
+ {
369
+ "include": "#comment-remark"
370
+ }
371
+ ]
372
+ },
373
+ {
374
+ "begin": "\\#",
375
+ "end": "$",
376
+ "name": "comment.line.number-sign.nix",
377
+ "patterns": [
378
+ {
379
+ "include": "#comment-remark"
380
+ }
381
+ ]
382
+ }
383
+ ]
384
+ },
385
+ "comment-remark": {
386
+ "captures": {
387
+ "1": {
388
+ "name": "markup.bold.comment.nix"
389
+ }
390
+ },
391
+ "match": "(TODO|FIXME|BUG|\\!\\!\\!):?"
392
+ },
393
+ "constants": {
394
+ "patterns": [
395
+ {
396
+ "begin": "\\b(builtins|true|false|null)\\b",
397
+ "beginCaptures": {
398
+ "0": {
399
+ "name": "constant.language.nix"
400
+ }
401
+ },
402
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
403
+ "patterns": [
404
+ {
405
+ "include": "#expression-cont"
406
+ }
407
+ ]
408
+ },
409
+ {
410
+ "begin": "\\b(scopedImport|import|isNull|abort|throw|baseNameOf|dirOf|removeAttrs|map|toString|derivationStrict|derivation)\\b",
411
+ "beginCaptures": {
412
+ "0": {
413
+ "name": "support.function.nix"
414
+ }
415
+ },
416
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
417
+ "patterns": [
418
+ {
419
+ "include": "#expression-cont"
420
+ }
421
+ ]
422
+ },
423
+ {
424
+ "begin": "\\b[0-9]+\\b",
425
+ "beginCaptures": {
426
+ "0": {
427
+ "name": "constant.numeric.nix"
428
+ }
429
+ },
430
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
431
+ "patterns": [
432
+ {
433
+ "include": "#expression-cont"
434
+ }
435
+ ]
436
+ }
437
+ ]
438
+ },
439
+ "expression": {
440
+ "patterns": [
441
+ {
442
+ "include": "#parens-and-cont"
443
+ },
444
+ {
445
+ "include": "#list-and-cont"
446
+ },
447
+ {
448
+ "include": "#string"
449
+ },
450
+ {
451
+ "include": "#interpolation"
452
+ },
453
+ {
454
+ "include": "#with-assert"
455
+ },
456
+ {
457
+ "include": "#function-for-sure"
458
+ },
459
+ {
460
+ "include": "#attrset-for-sure"
461
+ },
462
+ {
463
+ "include": "#attrset-or-function"
464
+ },
465
+ {
466
+ "include": "#let"
467
+ },
468
+ {
469
+ "include": "#if"
470
+ },
471
+ {
472
+ "include": "#operator-unary"
473
+ },
474
+ {
475
+ "include": "#constants"
476
+ },
477
+ {
478
+ "include": "#bad-reserved"
479
+ },
480
+ {
481
+ "include": "#parameter-name-and-cont"
482
+ },
483
+ {
484
+ "include": "#others"
485
+ }
486
+ ]
487
+ },
488
+ "expression-cont": {
489
+ "begin": "(?=.?)",
490
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
491
+ "patterns": [
492
+ {
493
+ "include": "#parens"
494
+ },
495
+ {
496
+ "include": "#list"
497
+ },
498
+ {
499
+ "include": "#string"
500
+ },
501
+ {
502
+ "include": "#interpolation"
503
+ },
504
+ {
505
+ "include": "#function-for-sure"
506
+ },
507
+ {
508
+ "include": "#attrset-for-sure"
509
+ },
510
+ {
511
+ "include": "#attrset-or-function"
512
+ },
513
+ {
514
+ "match": "(\\bor\\b|\\.|==|!=|!|\\<\\=|\\<|\\>\\=|\\>|&&|\\|\\||-\\>|//|\\?|\\+\\+|-|\\*|/(?=([^*]|$))|\\+)",
515
+ "name": "keyword.operator.nix"
516
+ },
517
+ {
518
+ "include": "#constants"
519
+ },
520
+ {
521
+ "include": "#bad-reserved"
522
+ },
523
+ {
524
+ "include": "#parameter-name"
525
+ },
526
+ {
527
+ "include": "#others"
528
+ }
529
+ ]
530
+ },
531
+ "function-body": {
532
+ "begin": "(@\\s*([a-zA-Z\\_][a-zA-Z0-9\\_\\'\\-]*)\\s*)?(\\:)",
533
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
534
+ "patterns": [
535
+ {
536
+ "include": "#expression"
537
+ }
538
+ ]
539
+ },
540
+ "function-body-from-colon": {
541
+ "begin": "(\\:)",
542
+ "beginCaptures": {
543
+ "0": {
544
+ "name": "punctuation.definition.function.nix"
545
+ }
546
+ },
547
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
548
+ "patterns": [
549
+ {
550
+ "include": "#expression"
551
+ }
552
+ ]
553
+ },
554
+ "function-contents": {
555
+ "patterns": [
556
+ {
557
+ "include": "#bad-reserved"
558
+ },
559
+ {
560
+ "include": "#function-parameter"
561
+ },
562
+ {
563
+ "include": "#others"
564
+ }
565
+ ]
566
+ },
567
+ "function-definition": {
568
+ "begin": "(?=.?)",
569
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
570
+ "patterns": [
571
+ {
572
+ "include": "#function-body-from-colon"
573
+ },
574
+ {
575
+ "begin": "(?=.?)",
576
+ "end": "(?=\\:)",
577
+ "patterns": [
578
+ {
579
+ "begin": "(\\b[a-zA-Z\\_][a-zA-Z0-9\\_\\'\\-]*)",
580
+ "beginCaptures": {
581
+ "0": {
582
+ "name": "variable.parameter.function.4.nix"
583
+ }
584
+ },
585
+ "end": "(?=\\:)",
586
+ "patterns": [
587
+ {
588
+ "begin": "\\@",
589
+ "end": "(?=\\:)",
590
+ "patterns": [
591
+ {
592
+ "include": "#function-header-until-colon-no-arg"
593
+ },
594
+ {
595
+ "include": "#others"
596
+ }
597
+ ]
598
+ },
599
+ {
600
+ "include": "#others"
601
+ }
602
+ ]
603
+ },
604
+ {
605
+ "begin": "(?=\\{)",
606
+ "end": "(?=\\:)",
607
+ "patterns": [
608
+ {
609
+ "include": "#function-header-until-colon-with-arg"
610
+ }
611
+ ]
612
+ }
613
+ ]
614
+ },
615
+ {
616
+ "include": "#others"
617
+ }
618
+ ]
619
+ },
620
+ "function-definition-brace-opened": {
621
+ "begin": "(?=.?)",
622
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
623
+ "patterns": [
624
+ {
625
+ "include": "#function-body-from-colon"
626
+ },
627
+ {
628
+ "begin": "(?=.?)",
629
+ "end": "(?=\\:)",
630
+ "patterns": [
631
+ {
632
+ "include": "#function-header-close-brace-with-arg"
633
+ },
634
+ {
635
+ "begin": "(?=.?)",
636
+ "end": "(?=\\})",
637
+ "patterns": [
638
+ {
639
+ "include": "#function-contents"
640
+ }
641
+ ]
642
+ }
643
+ ]
644
+ },
645
+ {
646
+ "include": "#others"
647
+ }
648
+ ]
649
+ },
650
+ "function-for-sure": {
651
+ "patterns": [
652
+ {
653
+ "begin": "(?=(\\b[a-zA-Z\\_][a-zA-Z0-9\\_\\'\\-]*\\s*[:@]|\\{[^}]*\\}\\s*:|\\{[^#}\"'/=]*[,\\?]))",
654
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
655
+ "patterns": [
656
+ {
657
+ "include": "#function-definition"
658
+ }
659
+ ]
660
+ }
661
+ ]
662
+ },
663
+ "function-header-close-brace-no-arg": {
664
+ "begin": "\\}",
665
+ "beginCaptures": {
666
+ "0": {
667
+ "name": "punctuation.definition.entity.function.nix"
668
+ }
669
+ },
670
+ "end": "(?=\\:)",
671
+ "patterns": [
672
+ {
673
+ "include": "#others"
674
+ }
675
+ ]
676
+ },
677
+ "function-header-close-brace-with-arg": {
678
+ "begin": "\\}",
679
+ "beginCaptures": {
680
+ "0": {
681
+ "name": "punctuation.definition.entity.function.nix"
682
+ }
683
+ },
684
+ "end": "(?=\\:)",
685
+ "patterns": [
686
+ {
687
+ "include": "#function-header-terminal-arg"
688
+ },
689
+ {
690
+ "include": "#others"
691
+ }
692
+ ]
693
+ },
694
+ "function-header-open-brace": {
695
+ "begin": "\\{",
696
+ "beginCaptures": {
697
+ "0": {
698
+ "name": "punctuation.definition.entity.function.2.nix"
699
+ }
700
+ },
701
+ "end": "(?=\\})",
702
+ "patterns": [
703
+ {
704
+ "include": "#function-contents"
705
+ }
706
+ ]
707
+ },
708
+ "function-header-terminal-arg": {
709
+ "begin": "(?=@)",
710
+ "end": "(?=\\:)",
711
+ "patterns": [
712
+ {
713
+ "begin": "\\@",
714
+ "end": "(?=\\:)",
715
+ "patterns": [
716
+ {
717
+ "begin": "(\\b[a-zA-Z\\_][a-zA-Z0-9\\_\\'\\-]*)",
718
+ "end": "(?=\\:)",
719
+ "name": "variable.parameter.function.3.nix"
720
+ },
721
+ {
722
+ "include": "#others"
723
+ }
724
+ ]
725
+ },
726
+ {
727
+ "include": "#others"
728
+ }
729
+ ]
730
+ },
731
+ "function-header-until-colon-no-arg": {
732
+ "begin": "(?=\\{)",
733
+ "end": "(?=\\:)",
734
+ "patterns": [
735
+ {
736
+ "include": "#function-header-open-brace"
737
+ },
738
+ {
739
+ "include": "#function-header-close-brace-no-arg"
740
+ }
741
+ ]
742
+ },
743
+ "function-header-until-colon-with-arg": {
744
+ "begin": "(?=\\{)",
745
+ "end": "(?=\\:)",
746
+ "patterns": [
747
+ {
748
+ "include": "#function-header-open-brace"
749
+ },
750
+ {
751
+ "include": "#function-header-close-brace-with-arg"
752
+ }
753
+ ]
754
+ },
755
+ "function-parameter": {
756
+ "patterns": [
757
+ {
758
+ "begin": "(\\.\\.\\.)",
759
+ "end": "(,|(?=\\}))",
760
+ "name": "keyword.operator.nix",
761
+ "patterns": [
762
+ {
763
+ "include": "#others"
764
+ }
765
+ ]
766
+ },
767
+ {
768
+ "begin": "\\b[a-zA-Z\\_][a-zA-Z0-9\\_\\'\\-]*",
769
+ "beginCaptures": {
770
+ "0": {
771
+ "name": "variable.parameter.function.1.nix"
772
+ }
773
+ },
774
+ "end": "(,|(?=\\}))",
775
+ "endCaptures": {
776
+ "0": {
777
+ "name": "keyword.operator.nix"
778
+ }
779
+ },
780
+ "patterns": [
781
+ {
782
+ "include": "#whitespace"
783
+ },
784
+ {
785
+ "include": "#comment"
786
+ },
787
+ {
788
+ "include": "#function-parameter-default"
789
+ },
790
+ {
791
+ "include": "#expression"
792
+ }
793
+ ]
794
+ },
795
+ {
796
+ "include": "#others"
797
+ }
798
+ ]
799
+ },
800
+ "function-parameter-default": {
801
+ "begin": "\\?",
802
+ "beginCaptures": {
803
+ "0": {
804
+ "name": "keyword.operator.nix"
805
+ }
806
+ },
807
+ "end": "(?=[,}])",
808
+ "patterns": [
809
+ {
810
+ "include": "#expression"
811
+ }
812
+ ]
813
+ },
814
+ "if": {
815
+ "begin": "(?=\\bif\\b)",
816
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
817
+ "patterns": [
818
+ {
819
+ "begin": "\\bif\\b",
820
+ "beginCaptures": {
821
+ "0": {
822
+ "name": "keyword.other.nix"
823
+ }
824
+ },
825
+ "end": "\\bth(?=en\\b)",
826
+ "endCaptures": {
827
+ "0": {
828
+ "name": "keyword.other.nix"
829
+ }
830
+ },
831
+ "patterns": [
832
+ {
833
+ "include": "#expression"
834
+ }
835
+ ]
836
+ },
837
+ {
838
+ "begin": "(?<=th)en\\b",
839
+ "beginCaptures": {
840
+ "0": {
841
+ "name": "keyword.other.nix"
842
+ }
843
+ },
844
+ "end": "\\bel(?=se\\b)",
845
+ "endCaptures": {
846
+ "0": {
847
+ "name": "keyword.other.nix"
848
+ }
849
+ },
850
+ "patterns": [
851
+ {
852
+ "include": "#expression"
853
+ }
854
+ ]
855
+ },
856
+ {
857
+ "begin": "(?<=el)se\\b",
858
+ "beginCaptures": {
859
+ "0": {
860
+ "name": "keyword.other.nix"
861
+ }
862
+ },
863
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
864
+ "endCaptures": {
865
+ "0": {
866
+ "name": "keyword.other.nix"
867
+ }
868
+ },
869
+ "patterns": [
870
+ {
871
+ "include": "#expression"
872
+ }
873
+ ]
874
+ }
875
+ ]
876
+ },
877
+ "illegal": {
878
+ "match": ".",
879
+ "name": "invalid.illegal"
880
+ },
881
+ "interpolation": {
882
+ "begin": "\\$\\{",
883
+ "beginCaptures": {
884
+ "0": {
885
+ "name": "punctuation.section.embedded.begin.nix"
886
+ }
887
+ },
888
+ "end": "\\}",
889
+ "endCaptures": {
890
+ "0": {
891
+ "name": "punctuation.section.embedded.end.nix"
892
+ }
893
+ },
894
+ "name": "markup.italic",
895
+ "patterns": [
896
+ {
897
+ "include": "#expression"
898
+ }
899
+ ]
900
+ },
901
+ "let": {
902
+ "begin": "(?=\\blet\\b)",
903
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
904
+ "patterns": [
905
+ {
906
+ "begin": "\\blet\\b",
907
+ "beginCaptures": {
908
+ "0": {
909
+ "name": "keyword.other.nix"
910
+ }
911
+ },
912
+ "end": "(?=([\\])};,]|\\b(in|else|then)\\b))",
913
+ "patterns": [
914
+ {
915
+ "begin": "(?=\\{)",
916
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
917
+ "patterns": [
918
+ {
919
+ "begin": "\\{",
920
+ "end": "\\}",
921
+ "patterns": [
922
+ {
923
+ "include": "#attrset-contents"
924
+ }
925
+ ]
926
+ },
927
+ {
928
+ "begin": "(^|(?<=\\}))",
929
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
930
+ "patterns": [
931
+ {
932
+ "include": "#expression-cont"
933
+ }
934
+ ]
935
+ },
936
+ {
937
+ "include": "#others"
938
+ }
939
+ ]
940
+ },
941
+ {
942
+ "include": "#attrset-contents"
943
+ },
944
+ {
945
+ "include": "#others"
946
+ }
947
+ ]
948
+ },
949
+ {
950
+ "begin": "\\bin\\b",
951
+ "beginCaptures": {
952
+ "0": {
953
+ "name": "keyword.other.nix"
954
+ }
955
+ },
956
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
957
+ "patterns": [
958
+ {
959
+ "include": "#expression"
960
+ }
961
+ ]
962
+ }
963
+ ]
964
+ },
965
+ "list": {
966
+ "begin": "\\[",
967
+ "beginCaptures": {
968
+ "0": {
969
+ "name": "punctuation.definition.list.nix"
970
+ }
971
+ },
972
+ "end": "\\]",
973
+ "endCaptures": {
974
+ "0": {
975
+ "name": "punctuation.definition.list.nix"
976
+ }
977
+ },
978
+ "patterns": [
979
+ {
980
+ "include": "#expression"
981
+ }
982
+ ]
983
+ },
984
+ "list-and-cont": {
985
+ "begin": "(?=\\[)",
986
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
987
+ "patterns": [
988
+ {
989
+ "include": "#list"
990
+ },
991
+ {
992
+ "include": "#expression-cont"
993
+ }
994
+ ]
995
+ },
996
+ "operator-unary": {
997
+ "match": "(!|-)",
998
+ "name": "keyword.operator.unary.nix"
999
+ },
1000
+ "others": {
1001
+ "patterns": [
1002
+ {
1003
+ "include": "#whitespace"
1004
+ },
1005
+ {
1006
+ "include": "#comment"
1007
+ },
1008
+ {
1009
+ "include": "#illegal"
1010
+ }
1011
+ ]
1012
+ },
1013
+ "parameter-name": {
1014
+ "captures": {
1015
+ "0": {
1016
+ "name": "variable.parameter.name.nix"
1017
+ }
1018
+ },
1019
+ "match": "\\b[a-zA-Z\\_][a-zA-Z0-9\\_\\'\\-]*"
1020
+ },
1021
+ "parameter-name-and-cont": {
1022
+ "begin": "\\b[a-zA-Z\\_][a-zA-Z0-9\\_\\'\\-]*",
1023
+ "beginCaptures": {
1024
+ "0": {
1025
+ "name": "variable.parameter.name.nix"
1026
+ }
1027
+ },
1028
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
1029
+ "patterns": [
1030
+ {
1031
+ "include": "#expression-cont"
1032
+ }
1033
+ ]
1034
+ },
1035
+ "parens": {
1036
+ "begin": "\\(",
1037
+ "beginCaptures": {
1038
+ "0": {
1039
+ "name": "punctuation.definition.expression.nix"
1040
+ }
1041
+ },
1042
+ "end": "\\)",
1043
+ "endCaptures": {
1044
+ "0": {
1045
+ "name": "punctuation.definition.expression.nix"
1046
+ }
1047
+ },
1048
+ "patterns": [
1049
+ {
1050
+ "include": "#expression"
1051
+ }
1052
+ ]
1053
+ },
1054
+ "parens-and-cont": {
1055
+ "begin": "(?=\\()",
1056
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
1057
+ "patterns": [
1058
+ {
1059
+ "include": "#parens"
1060
+ },
1061
+ {
1062
+ "include": "#expression-cont"
1063
+ }
1064
+ ]
1065
+ },
1066
+ "string": {
1067
+ "patterns": [
1068
+ {
1069
+ "begin": "(?=\\'\\')",
1070
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
1071
+ "patterns": [
1072
+ {
1073
+ "begin": "\\'\\'",
1074
+ "beginCaptures": {
1075
+ "0": {
1076
+ "name": "punctuation.definition.string.other.start.nix"
1077
+ }
1078
+ },
1079
+ "end": "\\'\\'(?!\\$|\\'|\\\\.)",
1080
+ "endCaptures": {
1081
+ "0": {
1082
+ "name": "punctuation.definition.string.other.end.nix"
1083
+ }
1084
+ },
1085
+ "name": "string.quoted.other.nix",
1086
+ "patterns": [
1087
+ {
1088
+ "match": "\\'\\'(\\$|\\'|\\\\.)",
1089
+ "name": "constant.character.escape.nix"
1090
+ },
1091
+ {
1092
+ "include": "#interpolation"
1093
+ }
1094
+ ]
1095
+ },
1096
+ {
1097
+ "include": "#expression-cont"
1098
+ }
1099
+ ]
1100
+ },
1101
+ {
1102
+ "begin": "(?=\\\")",
1103
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
1104
+ "patterns": [
1105
+ {
1106
+ "include": "#string-quoted"
1107
+ },
1108
+ {
1109
+ "include": "#expression-cont"
1110
+ }
1111
+ ]
1112
+ },
1113
+ {
1114
+ "begin": "([a-zA-Z0-9\\.\\_\\-\\+]*(\\/[a-zA-Z0-9\\.\\_\\-\\+]+)+)",
1115
+ "beginCaptures": {
1116
+ "0": {
1117
+ "name": "string.unquoted.path.nix"
1118
+ }
1119
+ },
1120
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
1121
+ "patterns": [
1122
+ {
1123
+ "include": "#expression-cont"
1124
+ }
1125
+ ]
1126
+ },
1127
+ {
1128
+ "begin": "(\\<[a-zA-Z0-9\\.\\_\\-\\+]+(\\/[a-zA-Z0-9\\.\\_\\-\\+]+)*\\>)",
1129
+ "beginCaptures": {
1130
+ "0": {
1131
+ "name": "string.unquoted.spath.nix"
1132
+ }
1133
+ },
1134
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
1135
+ "patterns": [
1136
+ {
1137
+ "include": "#expression-cont"
1138
+ }
1139
+ ]
1140
+ },
1141
+ {
1142
+ "begin": "([a-zA-Z][a-zA-Z0-9\\+\\-\\.]*\\:[a-zA-Z0-9\\%\\/\\?\\:\\@\\&\\=\\+\\$\\,\\-\\_\\.\\!\\~\\*\\']+)",
1143
+ "beginCaptures": {
1144
+ "0": {
1145
+ "name": "string.unquoted.url.nix"
1146
+ }
1147
+ },
1148
+ "end": "(?=([\\])};,]|\\b(else|then)\\b))",
1149
+ "patterns": [
1150
+ {
1151
+ "include": "#expression-cont"
1152
+ }
1153
+ ]
1154
+ }
1155
+ ]
1156
+ },
1157
+ "string-quoted": {
1158
+ "begin": "\\\"",
1159
+ "beginCaptures": {
1160
+ "0": {
1161
+ "name": "punctuation.definition.string.double.start.nix"
1162
+ }
1163
+ },
1164
+ "end": "\\\"",
1165
+ "endCaptures": {
1166
+ "0": {
1167
+ "name": "punctuation.definition.string.double.end.nix"
1168
+ }
1169
+ },
1170
+ "name": "string.quoted.double.nix",
1171
+ "patterns": [
1172
+ {
1173
+ "match": "\\\\.",
1174
+ "name": "constant.character.escape.nix"
1175
+ },
1176
+ {
1177
+ "include": "#interpolation"
1178
+ }
1179
+ ]
1180
+ },
1181
+ "whitespace": {
1182
+ "match": "\\s+"
1183
+ },
1184
+ "with-assert": {
1185
+ "begin": "\\b(with|assert)\\b",
1186
+ "beginCaptures": {
1187
+ "0": {
1188
+ "name": "keyword.other.nix"
1189
+ }
1190
+ },
1191
+ "end": "\\;",
1192
+ "patterns": [
1193
+ {
1194
+ "include": "#expression"
1195
+ }
1196
+ ]
1197
+ }
1198
+ },
1199
+ "scopeName": "source.nix"
1200
+ }