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,3768 @@
1
+ {
2
+ "displayName": "Ballerina",
3
+ "fileTypes": [
4
+ "bal"
5
+ ],
6
+ "name": "ballerina",
7
+ "patterns": [
8
+ {
9
+ "include": "#statements"
10
+ }
11
+ ],
12
+ "repository": {
13
+ "access-modifier": {
14
+ "patterns": [
15
+ {
16
+ "match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(public|private)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))",
17
+ "name": "storage.modifier.ballerina keyword.other.ballerina"
18
+ }
19
+ ]
20
+ },
21
+ "annotationAttachment": {
22
+ "patterns": [
23
+ {
24
+ "captures": {
25
+ "1": {
26
+ "name": "punctuation.decorator.ballerina"
27
+ },
28
+ "2": {
29
+ "name": "support.type.ballerina"
30
+ },
31
+ "3": {
32
+ "name": "punctuation.decorator.ballerina"
33
+ },
34
+ "4": {
35
+ "name": "support.type.ballerina"
36
+ }
37
+ },
38
+ "match": "(@)((?:[_$[:alpha:]][_$[:alnum:]]*))\\s*(:?)\\s*((?:[_$[:alpha:]][_$[:alnum:]]*)?)"
39
+ }
40
+ ]
41
+ },
42
+ "annotationDefinition": {
43
+ "patterns": [
44
+ {
45
+ "begin": "\\bannotation\\b",
46
+ "beginCaptures": {
47
+ "0": {
48
+ "name": "keyword.ballerina"
49
+ }
50
+ },
51
+ "end": ";",
52
+ "patterns": [
53
+ {
54
+ "include": "#code"
55
+ }
56
+ ]
57
+ }
58
+ ]
59
+ },
60
+ "array-literal": {
61
+ "begin": "\\s*(\\[)",
62
+ "beginCaptures": {
63
+ "1": {
64
+ "name": "meta.brace.square.ballerina"
65
+ }
66
+ },
67
+ "end": "\\]",
68
+ "endCaptures": {
69
+ "0": {
70
+ "name": "meta.brace.square.ballerina"
71
+ }
72
+ },
73
+ "name": "meta.array.literal.ballerina",
74
+ "patterns": [
75
+ {
76
+ "include": "#expression"
77
+ },
78
+ {
79
+ "include": "#punctuation-comma"
80
+ }
81
+ ]
82
+ },
83
+ "booleans": {
84
+ "patterns": [
85
+ {
86
+ "match": "\\b(true|false)\\b",
87
+ "name": "constant.language.boolean.ballerina"
88
+ }
89
+ ]
90
+ },
91
+ "butClause": {
92
+ "patterns": [
93
+ {
94
+ "begin": "=>",
95
+ "beginCaptures": {
96
+ "0": {
97
+ "name": "meta.arrow.ballerina storage.type.function.arrow.ballerina"
98
+ }
99
+ },
100
+ "end": ",|(?=\\})",
101
+ "patterns": [
102
+ {
103
+ "include": "#code"
104
+ }
105
+ ]
106
+ }
107
+ ]
108
+ },
109
+ "butExp": {
110
+ "patterns": [
111
+ {
112
+ "begin": "\\bbut\\b",
113
+ "beginCaptures": {
114
+ "0": {
115
+ "name": "keyword.ballerina"
116
+ }
117
+ },
118
+ "end": "\\}",
119
+ "endCaptures": {
120
+ "0": {
121
+ "name": "punctuation.definition.block.ballerina.documentation"
122
+ }
123
+ },
124
+ "patterns": [
125
+ {
126
+ "include": "#butExpBody"
127
+ },
128
+ {
129
+ "include": "#comment"
130
+ }
131
+ ]
132
+ }
133
+ ]
134
+ },
135
+ "butExpBody": {
136
+ "patterns": [
137
+ {
138
+ "begin": "\\{",
139
+ "beginCaptures": {
140
+ "0": {
141
+ "name": "punctuation.definition.block.ballerina.documentation"
142
+ }
143
+ },
144
+ "end": "(?=\\})",
145
+ "endCaptures": {
146
+ "0": {
147
+ "name": "punctuation.definition.block.ballerina.documentation"
148
+ }
149
+ },
150
+ "patterns": [
151
+ {
152
+ "include": "#parameter"
153
+ },
154
+ {
155
+ "include": "#butClause"
156
+ },
157
+ {
158
+ "include": "#comment"
159
+ }
160
+ ]
161
+ }
162
+ ]
163
+ },
164
+ "call": {
165
+ "patterns": [
166
+ {
167
+ "match": "(?:\\')?([_$[:alpha:]][_$[:alnum:]]*)\\s*(?=\\()",
168
+ "name": "entity.name.function.ballerina"
169
+ }
170
+ ]
171
+ },
172
+ "callableUnitBody": {
173
+ "patterns": [
174
+ {
175
+ "begin": "\\{",
176
+ "beginCaptures": {
177
+ "0": {
178
+ "name": "punctuation.definition.block.ballerina"
179
+ }
180
+ },
181
+ "end": "(?=\\})",
182
+ "endCaptures": {
183
+ "0": {
184
+ "name": "punctuation.definition.block.ballerina"
185
+ }
186
+ },
187
+ "patterns": [
188
+ {
189
+ "include": "#workerDef"
190
+ },
191
+ {
192
+ "include": "#service-decl"
193
+ },
194
+ {
195
+ "include": "#objectDec"
196
+ },
197
+ {
198
+ "include": "#function-defn"
199
+ },
200
+ {
201
+ "include": "#forkStatement"
202
+ },
203
+ {
204
+ "include": "#code"
205
+ }
206
+ ]
207
+ }
208
+ ]
209
+ },
210
+ "class-body": {
211
+ "begin": "\\{",
212
+ "beginCaptures": {
213
+ "0": {
214
+ "name": "punctuation.definition.block.ballerina"
215
+ }
216
+ },
217
+ "end": "\\}",
218
+ "endCaptures": {
219
+ "0": {
220
+ "name": "punctuation.definition.block.ballerina"
221
+ }
222
+ },
223
+ "name": "meta.class.body.ballerina",
224
+ "patterns": [
225
+ {
226
+ "include": "#comment"
227
+ },
228
+ {
229
+ "include": "#mdDocumentation"
230
+ },
231
+ {
232
+ "include": "#function-defn"
233
+ },
234
+ {
235
+ "include": "#var-expr"
236
+ },
237
+ {
238
+ "include": "#variable-initializer"
239
+ },
240
+ {
241
+ "include": "#access-modifier"
242
+ },
243
+ {
244
+ "include": "#keywords"
245
+ },
246
+ {
247
+ "begin": "(?<=:)\\s*",
248
+ "end": "(?=\\s|[;),}\\]:\\-\\+]|;|^\\s*$|(?:^\\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|service|type|var)\\b))"
249
+ },
250
+ {
251
+ "include": "#decl-block"
252
+ },
253
+ {
254
+ "include": "#expression"
255
+ },
256
+ {
257
+ "include": "#punctuation-comma"
258
+ },
259
+ {
260
+ "include": "#punctuation-semicolon"
261
+ }
262
+ ]
263
+ },
264
+ "class-defn": {
265
+ "begin": "(\\s+)(class\\b)|^class\\b(?=\\s+|/[/*])",
266
+ "beginCaptures": {
267
+ "0": {
268
+ "name": "storage.type.class.ballerina keyword.other.ballerina"
269
+ }
270
+ },
271
+ "end": "(?<=\\})",
272
+ "name": "meta.class.ballerina",
273
+ "patterns": [
274
+ {
275
+ "include": "#keywords"
276
+ },
277
+ {
278
+ "captures": {
279
+ "0": {
280
+ "name": "entity.name.type.class.ballerina"
281
+ }
282
+ },
283
+ "match": "[_$[:alpha:]][_$[:alnum:]]*"
284
+ },
285
+ {
286
+ "include": "#class-body"
287
+ }
288
+ ]
289
+ },
290
+ "code": {
291
+ "patterns": [
292
+ {
293
+ "include": "#booleans"
294
+ },
295
+ {
296
+ "include": "#matchStatement"
297
+ },
298
+ {
299
+ "include": "#butExp"
300
+ },
301
+ {
302
+ "include": "#xml"
303
+ },
304
+ {
305
+ "include": "#stringTemplate"
306
+ },
307
+ {
308
+ "include": "#keywords"
309
+ },
310
+ {
311
+ "include": "#strings"
312
+ },
313
+ {
314
+ "include": "#comment"
315
+ },
316
+ {
317
+ "include": "#mdDocumentation"
318
+ },
319
+ {
320
+ "include": "#annotationAttachment"
321
+ },
322
+ {
323
+ "include": "#numbers"
324
+ },
325
+ {
326
+ "include": "#maps"
327
+ },
328
+ {
329
+ "include": "#paranthesised"
330
+ },
331
+ {
332
+ "include": "#paranthesisedBracket"
333
+ },
334
+ {
335
+ "include": "#regex"
336
+ }
337
+ ]
338
+ },
339
+ "comment": {
340
+ "patterns": [
341
+ {
342
+ "match": "\\/\\/.*",
343
+ "name": "comment.ballerina"
344
+ }
345
+ ]
346
+ },
347
+ "constrainType": {
348
+ "patterns": [
349
+ {
350
+ "begin": "<",
351
+ "beginCaptures": {
352
+ "0": {
353
+ "name": "punctuation.definition.parameters.begin.ballerina"
354
+ }
355
+ },
356
+ "end": ">",
357
+ "endCaptures": {
358
+ "0": {
359
+ "name": "punctuation.definition.parameters.end.ballerina"
360
+ }
361
+ },
362
+ "patterns": [
363
+ {
364
+ "include": "#comment"
365
+ },
366
+ {
367
+ "include": "#constrainType"
368
+ },
369
+ {
370
+ "match": "\\b([_$[:alpha:]][_$[:alnum:]]*)\\b",
371
+ "name": "storage.type.ballerina"
372
+ }
373
+ ]
374
+ }
375
+ ]
376
+ },
377
+ "control-statement": {
378
+ "patterns": [
379
+ {
380
+ "begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(return)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))",
381
+ "beginCaptures": {
382
+ "0": {
383
+ "name": "keyword.control.flow.ballerina"
384
+ }
385
+ },
386
+ "end": "(?=[;}]|$|;|^\\s*$|(?:^\\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|service|type|var)\\b))",
387
+ "patterns": [
388
+ {
389
+ "include": "#expression"
390
+ }
391
+ ]
392
+ },
393
+ {
394
+ "include": "#for-loop"
395
+ },
396
+ {
397
+ "include": "#if-statement"
398
+ },
399
+ {
400
+ "match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(else|if)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))",
401
+ "name": "keyword.control.conditional.ballerina"
402
+ }
403
+ ]
404
+ },
405
+ "decl-block": {
406
+ "begin": "\\{",
407
+ "beginCaptures": {
408
+ "0": {
409
+ "name": "punctuation.definition.block.ballerina"
410
+ }
411
+ },
412
+ "end": "(?=\\} external;)|(\\})",
413
+ "endCaptures": {
414
+ "0": {
415
+ "name": "punctuation.definition.block.ballerina"
416
+ }
417
+ },
418
+ "name": "meta.block.ballerina",
419
+ "patterns": [
420
+ {
421
+ "include": "#statements"
422
+ },
423
+ {
424
+ "include": "#mdDocumentation"
425
+ }
426
+ ]
427
+ },
428
+ "declaration": {
429
+ "patterns": [
430
+ {
431
+ "include": "#import-declaration"
432
+ },
433
+ {
434
+ "include": "#var-expr"
435
+ },
436
+ {
437
+ "include": "#typeDefinition"
438
+ },
439
+ {
440
+ "include": "#function-defn"
441
+ },
442
+ {
443
+ "include": "#service-decl"
444
+ },
445
+ {
446
+ "include": "#class-defn"
447
+ },
448
+ {
449
+ "include": "#enum-decl"
450
+ },
451
+ {
452
+ "include": "#source"
453
+ },
454
+ {
455
+ "include": "#keywords"
456
+ }
457
+ ]
458
+ },
459
+ "defaultValue": {
460
+ "patterns": [
461
+ {
462
+ "begin": "[=:]",
463
+ "beginCaptures": {
464
+ "0": {
465
+ "name": "keyword.operator.ballerina"
466
+ }
467
+ },
468
+ "end": "(?=[,)])",
469
+ "patterns": [
470
+ {
471
+ "include": "#code"
472
+ }
473
+ ]
474
+ }
475
+ ]
476
+ },
477
+ "defaultWithParentheses": {
478
+ "patterns": [
479
+ {
480
+ "begin": "\\(",
481
+ "beginCaptures": {
482
+ "0": {
483
+ "name": "punctuation.definition.block.ballerina"
484
+ }
485
+ },
486
+ "end": "\\)",
487
+ "endCaptures": {
488
+ "0": {
489
+ "name": "punctuation.definition.block.ballerina"
490
+ }
491
+ }
492
+ }
493
+ ]
494
+ },
495
+ "documentationBody": {
496
+ "patterns": [
497
+ {
498
+ "begin": "\\{",
499
+ "beginCaptures": {
500
+ "0": {
501
+ "name": "punctuation.definition.block.ballerina.documentation"
502
+ }
503
+ },
504
+ "end": "(?=\\})",
505
+ "endCaptures": {
506
+ "0": {
507
+ "name": "punctuation.definition.block.ballerina.documentation"
508
+ }
509
+ },
510
+ "patterns": [
511
+ {
512
+ "captures": {
513
+ "1": {
514
+ "name": "keyword.other.ballerina.documentation"
515
+ },
516
+ "2": {
517
+ "name": "keyword.other.ballerina.documentation"
518
+ },
519
+ "3": {
520
+ "name": "variable.parameter.ballerina.documentation"
521
+ },
522
+ "4": {
523
+ "name": "keyword.other.ballerina.documentation"
524
+ }
525
+ },
526
+ "match": "(P|R|T|F|V)({{)(.*)(}})"
527
+ },
528
+ {
529
+ "begin": "\\```",
530
+ "end": "\\```",
531
+ "name": "comment.block.code.ballerina.documentation"
532
+ },
533
+ {
534
+ "begin": "\\``",
535
+ "end": "\\``",
536
+ "name": "comment.block.code.ballerina.documentation"
537
+ },
538
+ {
539
+ "begin": "\\`",
540
+ "end": "\\`",
541
+ "name": "comment.block.code.ballerina.documentation"
542
+ },
543
+ {
544
+ "match": ".",
545
+ "name": "comment.block.ballerina.documentation"
546
+ }
547
+ ]
548
+ }
549
+ ]
550
+ },
551
+ "documentationDef": {
552
+ "patterns": [
553
+ {
554
+ "begin": "\\b(?:documentation|deprecated)\\b",
555
+ "beginCaptures": {
556
+ "0": {
557
+ "name": "keyword.ballerina"
558
+ }
559
+ },
560
+ "end": "\\}",
561
+ "endCaptures": {
562
+ "0": {
563
+ "name": "delimiter.curly"
564
+ }
565
+ },
566
+ "patterns": [
567
+ {
568
+ "include": "#documentationBody"
569
+ },
570
+ {
571
+ "include": "#comment"
572
+ }
573
+ ]
574
+ }
575
+ ]
576
+ },
577
+ "enum-decl": {
578
+ "begin": "(?:\\b(const)\\s+)?\\b(enum)\\s+([_$[:alpha:]][_$[:alnum:]]*)",
579
+ "beginCaptures": {
580
+ "1": {
581
+ "name": "storage.modifier.ballerina"
582
+ },
583
+ "2": {
584
+ "name": "keyword.other.ballerina"
585
+ },
586
+ "3": {
587
+ "name": "entity.name.type.enum.ballerina"
588
+ }
589
+ },
590
+ "end": "(?<=\\})",
591
+ "name": "meta.enum.declaration.ballerina",
592
+ "patterns": [
593
+ {
594
+ "include": "#comment"
595
+ },
596
+ {
597
+ "include": "#mdDocumentation"
598
+ },
599
+ {
600
+ "begin": "\\{",
601
+ "beginCaptures": {
602
+ "0": {
603
+ "name": "punctuation.definition.block.ballerina"
604
+ }
605
+ },
606
+ "end": "\\}",
607
+ "endCaptures": {
608
+ "0": {
609
+ "name": "punctuation.definition.block.ballerina"
610
+ }
611
+ },
612
+ "patterns": [
613
+ {
614
+ "include": "#comment"
615
+ },
616
+ {
617
+ "include": "#mdDocumentation"
618
+ },
619
+ {
620
+ "begin": "([_$[:alpha:]][_$[:alnum:]]*)",
621
+ "beginCaptures": {
622
+ "0": {
623
+ "name": "variable.other.enummember.ballerina"
624
+ }
625
+ },
626
+ "end": "(?=,|\\}|$)",
627
+ "patterns": [
628
+ {
629
+ "include": "#comment"
630
+ },
631
+ {
632
+ "include": "#variable-initializer"
633
+ }
634
+ ]
635
+ },
636
+ {
637
+ "begin": "(?=((\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`)|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])+\\])))",
638
+ "end": "(?=,|\\}|$)",
639
+ "patterns": [
640
+ {
641
+ "include": "#string"
642
+ },
643
+ {
644
+ "include": "#array-literal"
645
+ },
646
+ {
647
+ "include": "#comment"
648
+ },
649
+ {
650
+ "include": "#variable-initializer"
651
+ }
652
+ ]
653
+ },
654
+ {
655
+ "include": "#punctuation-comma"
656
+ }
657
+ ]
658
+ }
659
+ ]
660
+ },
661
+ "errorDestructure": {
662
+ "patterns": [
663
+ {
664
+ "begin": "error",
665
+ "beginCaptures": {
666
+ "0": {
667
+ "name": "storage.type.ballerina"
668
+ }
669
+ },
670
+ "end": "(?==>)",
671
+ "patterns": [
672
+ {
673
+ "include": "#code"
674
+ }
675
+ ]
676
+ }
677
+ ]
678
+ },
679
+ "expression": {
680
+ "patterns": [
681
+ {
682
+ "include": "#keywords"
683
+ },
684
+ {
685
+ "include": "#expressionWithoutIdentifiers"
686
+ },
687
+ {
688
+ "include": "#identifiers"
689
+ },
690
+ {
691
+ "include": "#regex"
692
+ }
693
+ ]
694
+ },
695
+ "expression-operators": {
696
+ "patterns": [
697
+ {
698
+ "match": "\\*=|(?<!\\()/=|%=|\\+=|\\-=",
699
+ "name": "keyword.operator.assignment.compound.ballerina"
700
+ },
701
+ {
702
+ "match": "\\&=|\\^=|<<=|>>=|>>>=|\\|=",
703
+ "name": "keyword.operator.assignment.compound.bitwise.ballerina"
704
+ },
705
+ {
706
+ "match": "<<|>>>|>>",
707
+ "name": "keyword.operator.bitwise.shift.ballerina"
708
+ },
709
+ {
710
+ "match": "===|!==|==|!=",
711
+ "name": "keyword.operator.comparison.ballerina"
712
+ },
713
+ {
714
+ "match": "<=|>=|<>|<|>",
715
+ "name": "keyword.operator.relational.ballerina"
716
+ },
717
+ {
718
+ "captures": {
719
+ "1": {
720
+ "name": "keyword.operator.logical.ballerina"
721
+ },
722
+ "2": {
723
+ "name": "keyword.operator.assignment.compound.ballerina"
724
+ },
725
+ "3": {
726
+ "name": "keyword.operator.arithmetic.ballerina"
727
+ }
728
+ },
729
+ "match": "(?<=[_$[:alnum:]])(\\!)\\s*(?:(/=)|(?:(/)(?![/*])))"
730
+ },
731
+ {
732
+ "match": "\\!|&&|\\|\\||\\?\\?",
733
+ "name": "keyword.operator.logical.ballerina"
734
+ },
735
+ {
736
+ "match": "\\&|~|\\^|\\|",
737
+ "name": "keyword.operator.bitwise.ballerina"
738
+ },
739
+ {
740
+ "match": "\\=",
741
+ "name": "keyword.operator.assignment.ballerina"
742
+ },
743
+ {
744
+ "match": "--",
745
+ "name": "keyword.operator.decrement.ballerina"
746
+ },
747
+ {
748
+ "match": "\\+\\+",
749
+ "name": "keyword.operator.increment.ballerina"
750
+ },
751
+ {
752
+ "match": "%|\\*|/|-|\\+",
753
+ "name": "keyword.operator.arithmetic.ballerina"
754
+ }
755
+ ]
756
+ },
757
+ "expressionWithoutIdentifiers": {
758
+ "patterns": [
759
+ {
760
+ "include": "#xml"
761
+ },
762
+ {
763
+ "include": "#string"
764
+ },
765
+ {
766
+ "include": "#stringTemplate"
767
+ },
768
+ {
769
+ "include": "#comment"
770
+ },
771
+ {
772
+ "include": "#object-literal"
773
+ },
774
+ {
775
+ "include": "#ternary-expression"
776
+ },
777
+ {
778
+ "include": "#expression-operators"
779
+ },
780
+ {
781
+ "include": "#literal"
782
+ },
783
+ {
784
+ "include": "#paranthesised"
785
+ },
786
+ {
787
+ "include": "#regex"
788
+ }
789
+ ]
790
+ },
791
+ "flags-on-off": {
792
+ "name": "meta.flags.regexp.ballerina",
793
+ "patterns": [
794
+ {
795
+ "begin": "(\\??)([imsx]*)(-?)([imsx]*)(:)",
796
+ "beginCaptures": {
797
+ "1": {
798
+ "name": "punctuation.other.non-capturing-group-begin.regexp.ballerina"
799
+ },
800
+ "2": {
801
+ "name": "keyword.other.non-capturing-group.flags-on.regexp.ballerina"
802
+ },
803
+ "3": {
804
+ "name": "punctuation.other.non-capturing-group.off.regexp.ballerina"
805
+ },
806
+ "4": {
807
+ "name": "keyword.other.non-capturing-group.flags-off.regexp.ballerina"
808
+ },
809
+ "5": {
810
+ "name": "punctuation.other.non-capturing-group-end.regexp.ballerina"
811
+ }
812
+ },
813
+ "end": "()",
814
+ "name": "constant.other.flag.regexp.ballerina",
815
+ "patterns": [
816
+ {
817
+ "include": "#regexp"
818
+ },
819
+ {
820
+ "include": "#template-substitution-element"
821
+ }
822
+ ]
823
+ }
824
+ ]
825
+ },
826
+ "for-loop": {
827
+ "begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))foreach\\s*",
828
+ "beginCaptures": {
829
+ "0": {
830
+ "name": "keyword.control.loop.ballerina"
831
+ },
832
+ "1": {
833
+ "name": "support.type.primitive.ballerina"
834
+ }
835
+ },
836
+ "end": "(?=\\{)",
837
+ "patterns": [
838
+ {
839
+ "match": "\\bin\\b",
840
+ "name": "keyword.other.ballerina"
841
+ },
842
+ {
843
+ "include": "#identifiers"
844
+ },
845
+ {
846
+ "include": "#comment"
847
+ },
848
+ {
849
+ "include": "#var-expr"
850
+ },
851
+ {
852
+ "include": "#expression"
853
+ }
854
+ ]
855
+ },
856
+ "forkBody": {
857
+ "patterns": [
858
+ {
859
+ "begin": "\\{",
860
+ "beginCaptures": {
861
+ "0": {
862
+ "name": "punctuation.definition.block.ballerina"
863
+ }
864
+ },
865
+ "end": "(?=\\})",
866
+ "patterns": [
867
+ {
868
+ "include": "#workerDef"
869
+ }
870
+ ]
871
+ }
872
+ ]
873
+ },
874
+ "forkStatement": {
875
+ "patterns": [
876
+ {
877
+ "begin": "\\bfork\\b",
878
+ "beginCaptures": {
879
+ "0": {
880
+ "name": "keyword.control.ballerina"
881
+ }
882
+ },
883
+ "end": "\\}",
884
+ "endCaptures": {
885
+ "0": {
886
+ "name": "punctuation.definition.block.ballerina"
887
+ }
888
+ },
889
+ "patterns": [
890
+ {
891
+ "include": "#forkBody"
892
+ }
893
+ ]
894
+ }
895
+ ]
896
+ },
897
+ "function-body": {
898
+ "patterns": [
899
+ {
900
+ "include": "#comment"
901
+ },
902
+ {
903
+ "include": "#functionParameters"
904
+ },
905
+ {
906
+ "include": "#decl-block"
907
+ },
908
+ {
909
+ "begin": "\\=>",
910
+ "beginCaptures": {
911
+ "0": {
912
+ "name": "meta.arrow.ballerina storage.type.function.arrow.ballerina"
913
+ }
914
+ },
915
+ "end": "(?=\\;)|(?=\\,)|(?=)(?=\\);)",
916
+ "name": "meta.block.ballerina",
917
+ "patterns": [
918
+ {
919
+ "include": "#statements"
920
+ },
921
+ {
922
+ "include": "#punctuation-comma"
923
+ }
924
+ ]
925
+ },
926
+ {
927
+ "match": "\\*",
928
+ "name": "keyword.generator.asterisk.ballerina"
929
+ }
930
+ ]
931
+ },
932
+ "function-defn": {
933
+ "begin": "(?:(public|private)\\s+)?(function\\b)",
934
+ "beginCaptures": {
935
+ "1": {
936
+ "name": "keyword.other.ballerina"
937
+ },
938
+ "2": {
939
+ "name": "keyword.other.ballerina"
940
+ }
941
+ },
942
+ "end": "(?<=\\;)|(?<=\\})|(?<=\\,)|(?=)(?=\\);)",
943
+ "name": "meta.function.ballerina",
944
+ "patterns": [
945
+ {
946
+ "match": "\\bexternal\\b",
947
+ "name": "keyword.ballerina"
948
+ },
949
+ {
950
+ "include": "#stringTemplate"
951
+ },
952
+ {
953
+ "include": "#annotationAttachment"
954
+ },
955
+ {
956
+ "include": "#functionReturns"
957
+ },
958
+ {
959
+ "include": "#functionName"
960
+ },
961
+ {
962
+ "include": "#functionParameters"
963
+ },
964
+ {
965
+ "include": "#punctuation-semicolon"
966
+ },
967
+ {
968
+ "include": "#function-body"
969
+ },
970
+ {
971
+ "include": "#regex"
972
+ }
973
+ ]
974
+ },
975
+ "function-parameters-body": {
976
+ "patterns": [
977
+ {
978
+ "include": "#comment"
979
+ },
980
+ {
981
+ "include": "#numbers"
982
+ },
983
+ {
984
+ "include": "#string"
985
+ },
986
+ {
987
+ "include": "#annotationAttachment"
988
+ },
989
+ {
990
+ "include": "#recordLiteral"
991
+ },
992
+ {
993
+ "include": "#keywords"
994
+ },
995
+ {
996
+ "include": "#parameter-name"
997
+ },
998
+ {
999
+ "include": "#array-literal"
1000
+ },
1001
+ {
1002
+ "include": "#variable-initializer"
1003
+ },
1004
+ {
1005
+ "include": "#identifiers"
1006
+ },
1007
+ {
1008
+ "include": "#regex"
1009
+ },
1010
+ {
1011
+ "match": "\\,",
1012
+ "name": "punctuation.separator.parameter.ballerina"
1013
+ }
1014
+ ]
1015
+ },
1016
+ "functionName": {
1017
+ "patterns": [
1018
+ {
1019
+ "match": "\\bfunction\\b",
1020
+ "name": "keyword.other.ballerina"
1021
+ },
1022
+ {
1023
+ "include": "#type-primitive"
1024
+ },
1025
+ {
1026
+ "include": "#self-literal"
1027
+ },
1028
+ {
1029
+ "include": "#string"
1030
+ },
1031
+ {
1032
+ "captures": {
1033
+ "2": {
1034
+ "name": "variable.language.this.ballerina"
1035
+ },
1036
+ "3": {
1037
+ "name": "keyword.other.ballerina"
1038
+ },
1039
+ "4": {
1040
+ "name": "support.type.primitive.ballerina"
1041
+ },
1042
+ "5": {
1043
+ "name": "storage.type.ballerina"
1044
+ },
1045
+ "6": {
1046
+ "name": "meta.definition.function.ballerina entity.name.function.ballerina"
1047
+ }
1048
+ },
1049
+ "match": "\\s+(\\b(self)|\\b(is|new|isolated|null|function|in)\\b|(string|int|boolean|float|byte|decimal|json|xml|anydata)\\b|\\b(readonly|error|map)\\b|([_$[:alpha:]][_$[:alnum:]]*))"
1050
+ }
1051
+ ]
1052
+ },
1053
+ "functionParameters": {
1054
+ "begin": "\\(|\\[",
1055
+ "beginCaptures": {
1056
+ "0": {
1057
+ "name": "punctuation.definition.parameters.begin.ballerina"
1058
+ }
1059
+ },
1060
+ "end": "\\)|\\]",
1061
+ "endCaptures": {
1062
+ "0": {
1063
+ "name": "punctuation.definition.parameters.end.ballerina"
1064
+ }
1065
+ },
1066
+ "name": "meta.parameters.ballerina",
1067
+ "patterns": [
1068
+ {
1069
+ "include": "#function-parameters-body"
1070
+ }
1071
+ ]
1072
+ },
1073
+ "functionReturns": {
1074
+ "begin": "\\s*(returns)\\s*",
1075
+ "beginCaptures": {
1076
+ "1": {
1077
+ "name": "keyword.other.ballerina"
1078
+ }
1079
+ },
1080
+ "end": "(?==>)|(\\=)|(?=\\{)|(\\))|(?=\\;)",
1081
+ "endCaptures": {
1082
+ "1": {
1083
+ "name": "keyword.operator.ballerina"
1084
+ }
1085
+ },
1086
+ "name": "meta.type.function.return.ballerina",
1087
+ "patterns": [
1088
+ {
1089
+ "include": "#comment"
1090
+ },
1091
+ {
1092
+ "include": "#string"
1093
+ },
1094
+ {
1095
+ "include": "#numbers"
1096
+ },
1097
+ {
1098
+ "include": "#keywords"
1099
+ },
1100
+ {
1101
+ "include": "#type-primitive"
1102
+ },
1103
+ {
1104
+ "captures": {
1105
+ "1": {
1106
+ "name": "support.type.primitive.ballerina"
1107
+ }
1108
+ },
1109
+ "match": "\\s*\\b(var)(?=\\s+|\\[|\\?)"
1110
+ },
1111
+ {
1112
+ "match": "\\|",
1113
+ "name": "keyword.operator.ballerina"
1114
+ },
1115
+ {
1116
+ "match": "\\?",
1117
+ "name": "keyword.operator.optional.ballerina"
1118
+ },
1119
+ {
1120
+ "include": "#type-annotation"
1121
+ },
1122
+ {
1123
+ "include": "#type-tuple"
1124
+ },
1125
+ {
1126
+ "include": "#keywords"
1127
+ },
1128
+ {
1129
+ "match": "[_$[:alpha:]][_$[:alnum:]]*",
1130
+ "name": "variable.other.readwrite.ballerina"
1131
+ }
1132
+ ]
1133
+ },
1134
+ "functionType": {
1135
+ "patterns": [
1136
+ {
1137
+ "begin": "\\bfunction\\b",
1138
+ "beginCaptures": {
1139
+ "0": {
1140
+ "name": "keyword.ballerina"
1141
+ }
1142
+ },
1143
+ "end": "(?=\\,)|(?=\\|)|(?=\\:)|(?==>)|(?=\\))|(?=\\])",
1144
+ "patterns": [
1145
+ {
1146
+ "include": "#comment"
1147
+ },
1148
+ {
1149
+ "include": "#functionTypeParamList"
1150
+ },
1151
+ {
1152
+ "include": "#functionTypeReturns"
1153
+ }
1154
+ ]
1155
+ }
1156
+ ]
1157
+ },
1158
+ "functionTypeParamList": {
1159
+ "patterns": [
1160
+ {
1161
+ "begin": "\\(",
1162
+ "beginCaptures": {
1163
+ "0": {
1164
+ "name": "delimiter.parenthesis"
1165
+ }
1166
+ },
1167
+ "end": "\\)",
1168
+ "endCaptures": {
1169
+ "0": {
1170
+ "name": "delimiter.parenthesis"
1171
+ }
1172
+ },
1173
+ "patterns": [
1174
+ {
1175
+ "match": "public",
1176
+ "name": "keyword"
1177
+ },
1178
+ {
1179
+ "include": "#annotationAttachment"
1180
+ },
1181
+ {
1182
+ "include": "#recordLiteral"
1183
+ },
1184
+ {
1185
+ "include": "#record"
1186
+ },
1187
+ {
1188
+ "include": "#objectDec"
1189
+ },
1190
+ {
1191
+ "include": "#functionType"
1192
+ },
1193
+ {
1194
+ "include": "#constrainType"
1195
+ },
1196
+ {
1197
+ "include": "#parameterTuple"
1198
+ },
1199
+ {
1200
+ "include": "#functionTypeType"
1201
+ },
1202
+ {
1203
+ "include": "#comment"
1204
+ }
1205
+ ]
1206
+ }
1207
+ ]
1208
+ },
1209
+ "functionTypeReturns": {
1210
+ "patterns": [
1211
+ {
1212
+ "begin": "\\breturns\\b",
1213
+ "beginCaptures": {
1214
+ "0": {
1215
+ "name": "keyword"
1216
+ }
1217
+ },
1218
+ "end": "(?=\\,)|(?:\\|)|(?=\\])|(?=\\))",
1219
+ "patterns": [
1220
+ {
1221
+ "include": "#functionTypeReturnsParameter"
1222
+ },
1223
+ {
1224
+ "include": "#comment"
1225
+ }
1226
+ ]
1227
+ }
1228
+ ]
1229
+ },
1230
+ "functionTypeReturnsParameter": {
1231
+ "patterns": [
1232
+ {
1233
+ "begin": "((?=record|object|function)|(?:[_$[:alpha:]][_$[:alnum:]]*))",
1234
+ "beginCaptures": {
1235
+ "0": {
1236
+ "name": "storage.type.ballerina"
1237
+ }
1238
+ },
1239
+ "end": "(?=\\,)|(?:\\|)|(?:\\:)|(?==>)|(?=\\))|(?=\\])",
1240
+ "patterns": [
1241
+ {
1242
+ "include": "#record"
1243
+ },
1244
+ {
1245
+ "include": "#objectDec"
1246
+ },
1247
+ {
1248
+ "include": "#functionType"
1249
+ },
1250
+ {
1251
+ "include": "#constrainType"
1252
+ },
1253
+ {
1254
+ "include": "#defaultValue"
1255
+ },
1256
+ {
1257
+ "include": "#comment"
1258
+ },
1259
+ {
1260
+ "include": "#parameterTuple"
1261
+ },
1262
+ {
1263
+ "match": "[_$[:alpha:]][_$[:alnum:]]*",
1264
+ "name": "default.variable.parameter.ballerina"
1265
+ }
1266
+ ]
1267
+ }
1268
+ ]
1269
+ },
1270
+ "functionTypeType": {
1271
+ "patterns": [
1272
+ {
1273
+ "begin": "[_$[:alpha:]][_$[:alnum:]]*",
1274
+ "beginCaptures": {
1275
+ "0": {
1276
+ "name": "storage.type.ballerina"
1277
+ }
1278
+ },
1279
+ "end": "(?=\\,)|(?:\\|)|(?=\\])|(?=\\))"
1280
+ }
1281
+ ]
1282
+ },
1283
+ "identifiers": {
1284
+ "patterns": [
1285
+ {
1286
+ "captures": {
1287
+ "1": {
1288
+ "name": "punctuation.accessor.ballerina"
1289
+ },
1290
+ "2": {
1291
+ "name": "punctuation.accessor.optional.ballerina"
1292
+ },
1293
+ "3": {
1294
+ "name": "entity.name.function.ballerina"
1295
+ }
1296
+ },
1297
+ "match": "(?x)(?:(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*)?([_$[:alpha:]][_$[:alnum:]]*)(?=\\s*=\\s*(\n ((\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((\n ((<\\s*$)|((<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?[\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()\\'\\\"\\`]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n))"
1298
+ },
1299
+ {
1300
+ "captures": {
1301
+ "1": {
1302
+ "name": "punctuation.accessor.ballerina"
1303
+ },
1304
+ "2": {
1305
+ "name": "punctuation.accessor.optional.ballerina"
1306
+ },
1307
+ "3": {
1308
+ "name": "entity.name.function.ballerina"
1309
+ }
1310
+ },
1311
+ "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*)\\s*(?=\\()"
1312
+ },
1313
+ {
1314
+ "captures": {
1315
+ "1": {
1316
+ "name": "punctuation.accessor.ballerina"
1317
+ },
1318
+ "2": {
1319
+ "name": "punctuation.accessor.optional.ballerina"
1320
+ },
1321
+ "3": {
1322
+ "name": "variable.other.property.ballerina"
1323
+ }
1324
+ },
1325
+ "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))\\s*(\\#?[_$[:alpha:]][_$[:alnum:]]*)"
1326
+ },
1327
+ {
1328
+ "include": "#type-primitive"
1329
+ },
1330
+ {
1331
+ "include": "#self-literal"
1332
+ },
1333
+ {
1334
+ "match": "\\b(check|foreach|if|checkpanic)\\b",
1335
+ "name": "keyword.control.ballerina"
1336
+ },
1337
+ {
1338
+ "include": "#call"
1339
+ },
1340
+ {
1341
+ "match": "\\b(var)\\b",
1342
+ "name": "support.type.primitive.ballerina"
1343
+ },
1344
+ {
1345
+ "captures": {
1346
+ "1": {
1347
+ "name": "variable.other.readwrite.ballerina"
1348
+ },
1349
+ "3": {
1350
+ "name": "punctuation.accessor.ballerina"
1351
+ },
1352
+ "4": {
1353
+ "name": "entity.name.function.ballerina"
1354
+ },
1355
+ "5": {
1356
+ "name": "punctuation.definition.parameters.begin.ballerina"
1357
+ },
1358
+ "6": {
1359
+ "name": "punctuation.definition.parameters.end.ballerina"
1360
+ }
1361
+ },
1362
+ "match": "([_$[:alpha:]][_$[:alnum:]]*)((\\.)([_$[:alpha:]][_$[:alnum:]]*)(\\()(\\)))?"
1363
+ },
1364
+ {
1365
+ "match": "(\\')([_$[:alpha:]][_$[:alnum:]]*)",
1366
+ "name": "variable.other.property.ballerina"
1367
+ },
1368
+ {
1369
+ "include": "#type-annotation"
1370
+ }
1371
+ ]
1372
+ },
1373
+ "if-statement": {
1374
+ "patterns": [
1375
+ {
1376
+ "begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?=\\bif\\b\\s*(?!\\{))",
1377
+ "end": "(?<=\\})",
1378
+ "patterns": [
1379
+ {
1380
+ "include": "#comment"
1381
+ },
1382
+ {
1383
+ "begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(if)\\s*(\\()?",
1384
+ "beginCaptures": {
1385
+ "1": {
1386
+ "name": "keyword.control.conditional.ballerina"
1387
+ },
1388
+ "2": {
1389
+ "name": "meta.brace.round.ballerina"
1390
+ }
1391
+ },
1392
+ "end": "(\\))|(?=\\{)",
1393
+ "endCaptures": {
1394
+ "1": {
1395
+ "name": "meta.brace.round.ballerina"
1396
+ }
1397
+ },
1398
+ "patterns": [
1399
+ {
1400
+ "include": "#decl-block"
1401
+ },
1402
+ {
1403
+ "include": "#keywords"
1404
+ },
1405
+ {
1406
+ "include": "#identifiers"
1407
+ },
1408
+ {
1409
+ "include": "#type-primitive"
1410
+ },
1411
+ {
1412
+ "include": "#xml"
1413
+ },
1414
+ {
1415
+ "include": "#string"
1416
+ },
1417
+ {
1418
+ "include": "#stringTemplate"
1419
+ },
1420
+ {
1421
+ "include": "#comment"
1422
+ },
1423
+ {
1424
+ "include": "#ternary-expression"
1425
+ },
1426
+ {
1427
+ "include": "#expression-operators"
1428
+ },
1429
+ {
1430
+ "include": "#literal"
1431
+ },
1432
+ {
1433
+ "include": "#paranthesised"
1434
+ },
1435
+ {
1436
+ "include": "#regex"
1437
+ }
1438
+ ]
1439
+ },
1440
+ {
1441
+ "begin": "(?<=\\))(?=\\s|\\=)",
1442
+ "end": "(?=\\{)",
1443
+ "patterns": [
1444
+ {
1445
+ "include": "#literal"
1446
+ },
1447
+ {
1448
+ "include": "#keywords"
1449
+ }
1450
+ ]
1451
+ },
1452
+ {
1453
+ "include": "#decl-block"
1454
+ }
1455
+ ]
1456
+ }
1457
+ ]
1458
+ },
1459
+ "import-clause": {
1460
+ "patterns": [
1461
+ {
1462
+ "include": "#comment"
1463
+ },
1464
+ {
1465
+ "captures": {
1466
+ "1": {
1467
+ "name": "keyword.control.default.ballerina"
1468
+ },
1469
+ "3": {
1470
+ "name": "variable.other.readwrite.ballerina meta.import.module.ballerina"
1471
+ },
1472
+ "5": {
1473
+ "name": "keyword.control.default.ballerina"
1474
+ },
1475
+ "6": {
1476
+ "name": "variable.other.readwrite.alias.ballerina"
1477
+ }
1478
+ },
1479
+ "match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(\\bdefault)|(\\*)|(\\b[_$[:alpha:]][_$[:alnum:]]*))"
1480
+ },
1481
+ {
1482
+ "match": "([_$[:alpha:]][_$[:alnum:]]*)",
1483
+ "name": "variable.other.readwrite.alias.ballerina"
1484
+ }
1485
+ ]
1486
+ },
1487
+ "import-declaration": {
1488
+ "begin": "\\bimport\\b",
1489
+ "beginCaptures": {
1490
+ "0": {
1491
+ "name": "keyword.control.import.ballerina"
1492
+ }
1493
+ },
1494
+ "end": "\\;",
1495
+ "endCaptures": {
1496
+ "0": {
1497
+ "name": "punctuation.terminator.statement.ballerina"
1498
+ }
1499
+ },
1500
+ "name": "meta.import.ballerina",
1501
+ "patterns": [
1502
+ {
1503
+ "match": "(\\')([_$[:alpha:]][_$[:alnum:]]*)",
1504
+ "name": "variable.other.property.ballerina"
1505
+ },
1506
+ {
1507
+ "include": "#keywords"
1508
+ },
1509
+ {
1510
+ "include": "#comment"
1511
+ },
1512
+ {
1513
+ "include": "#import-clause"
1514
+ },
1515
+ {
1516
+ "include": "#punctuation-accessor"
1517
+ }
1518
+ ]
1519
+ },
1520
+ "keywords": {
1521
+ "patterns": [
1522
+ {
1523
+ "match": "\\b(fork|join|while|returns|transaction|transactional|retry|commit|rollback|typeof|enum|wait|match)\\b",
1524
+ "name": "keyword.control.ballerina"
1525
+ },
1526
+ {
1527
+ "match": "\\b(return|break|continue|check|checkpanic|panic|trap|from|where)\\b",
1528
+ "name": "keyword.control.flow.ballerina"
1529
+ },
1530
+ {
1531
+ "match": "\\b(public|private|external|return|record|object|remote|abstract|client|true|false|fail|import|version)\\b",
1532
+ "name": "keyword.other.ballerina"
1533
+ },
1534
+ {
1535
+ "match": "\\b(as|on|function|resource|listener|const|final|is|null|lock|annotation|source|worker|parameter|field|isolated|in)\\b",
1536
+ "name": "keyword.other.ballerina"
1537
+ },
1538
+ {
1539
+ "match": "\\b(xmlns|table|key|let|new|select|start|flush|default|do|base16|base64|conflict)\\b",
1540
+ "name": "keyword.other.ballerina"
1541
+ },
1542
+ {
1543
+ "match": "\\b(limit|outer|equals|order|by|ascending|descending|class|configurable|variable|module|service|group|collect)\\b",
1544
+ "name": "keyword.other.ballerina"
1545
+ },
1546
+ {
1547
+ "match": "(=>)",
1548
+ "name": "meta.arrow.ballerina storage.type.function.arrow.ballerina"
1549
+ },
1550
+ {
1551
+ "match": "(!|%|\\+|\\-|~=|===|==|=|!=|!==|<|>|&|\\||\\?:|\\.\\.\\.|<=|>=|&&|\\|\\||~|>>|>>>)",
1552
+ "name": "keyword.operator.ballerina"
1553
+ },
1554
+ {
1555
+ "include": "#types"
1556
+ },
1557
+ {
1558
+ "include": "#self-literal"
1559
+ },
1560
+ {
1561
+ "include": "#type-primitive"
1562
+ }
1563
+ ]
1564
+ },
1565
+ "literal": {
1566
+ "patterns": [
1567
+ {
1568
+ "include": "#booleans"
1569
+ },
1570
+ {
1571
+ "include": "#numbers"
1572
+ },
1573
+ {
1574
+ "include": "#strings"
1575
+ },
1576
+ {
1577
+ "include": "#maps"
1578
+ },
1579
+ {
1580
+ "include": "#self-literal"
1581
+ },
1582
+ {
1583
+ "include": "#array-literal"
1584
+ }
1585
+ ]
1586
+ },
1587
+ "maps": {
1588
+ "patterns": [
1589
+ {
1590
+ "begin": "\\{",
1591
+ "end": "\\}",
1592
+ "patterns": [
1593
+ {
1594
+ "include": "#code"
1595
+ }
1596
+ ]
1597
+ }
1598
+ ]
1599
+ },
1600
+ "matchBindingPattern": {
1601
+ "patterns": [
1602
+ {
1603
+ "begin": "var",
1604
+ "beginCaptures": {
1605
+ "0": {
1606
+ "name": "storage.type.ballerina"
1607
+ }
1608
+ },
1609
+ "end": "(?==>)|,",
1610
+ "patterns": [
1611
+ {
1612
+ "include": "#errorDestructure"
1613
+ },
1614
+ {
1615
+ "include": "#code"
1616
+ },
1617
+ {
1618
+ "match": "[_$[:alpha:]][_$[:alnum:]]*",
1619
+ "name": "variable.parameter.ballerina"
1620
+ }
1621
+ ]
1622
+ }
1623
+ ]
1624
+ },
1625
+ "matchStatement": {
1626
+ "patterns": [
1627
+ {
1628
+ "begin": "\\bmatch\\b",
1629
+ "beginCaptures": {
1630
+ "0": {
1631
+ "name": "keyword.control.ballerina"
1632
+ }
1633
+ },
1634
+ "end": "\\}",
1635
+ "patterns": [
1636
+ {
1637
+ "include": "#matchStatementBody"
1638
+ },
1639
+ {
1640
+ "include": "#comment"
1641
+ },
1642
+ {
1643
+ "include": "#code"
1644
+ }
1645
+ ]
1646
+ }
1647
+ ]
1648
+ },
1649
+ "matchStatementBody": {
1650
+ "patterns": [
1651
+ {
1652
+ "begin": "\\{",
1653
+ "beginCaptures": {
1654
+ "0": {
1655
+ "name": "punctuation.definition.block.ballerina.documentation"
1656
+ }
1657
+ },
1658
+ "end": "(?=\\})",
1659
+ "endCaptures": {
1660
+ "0": {
1661
+ "name": "punctuation.definition.block.ballerina.documentation"
1662
+ }
1663
+ },
1664
+ "patterns": [
1665
+ {
1666
+ "include": "#literal"
1667
+ },
1668
+ {
1669
+ "include": "#matchBindingPattern"
1670
+ },
1671
+ {
1672
+ "include": "#matchStatementPatternClause"
1673
+ },
1674
+ {
1675
+ "include": "#comment"
1676
+ },
1677
+ {
1678
+ "include": "#code"
1679
+ }
1680
+ ]
1681
+ }
1682
+ ]
1683
+ },
1684
+ "matchStatementPatternClause": {
1685
+ "patterns": [
1686
+ {
1687
+ "begin": "=>",
1688
+ "beginCaptures": {
1689
+ "0": {
1690
+ "name": "keyword.ballerina"
1691
+ }
1692
+ },
1693
+ "end": "((\\})|;|,)",
1694
+ "patterns": [
1695
+ {
1696
+ "include": "#callableUnitBody"
1697
+ },
1698
+ {
1699
+ "include": "#code"
1700
+ }
1701
+ ]
1702
+ }
1703
+ ]
1704
+ },
1705
+ "mdDocumentation": {
1706
+ "begin": "\\#",
1707
+ "end": "[\\r\\n]+",
1708
+ "name": "comment.mddocs.ballerina",
1709
+ "patterns": [
1710
+ {
1711
+ "include": "#mdDocumentationReturnParamDescription"
1712
+ },
1713
+ {
1714
+ "include": "#mdDocumentationParamDescription"
1715
+ }
1716
+ ]
1717
+ },
1718
+ "mdDocumentationParamDescription": {
1719
+ "patterns": [
1720
+ {
1721
+ "begin": "(\\+\\s+)(\\'?[_$[:alpha:]][_$[:alnum:]]*)(\\s*\\-\\s+)",
1722
+ "beginCaptures": {
1723
+ "1": {
1724
+ "name": "keyword.operator.ballerina"
1725
+ },
1726
+ "2": {
1727
+ "name": "variable.other.readwrite.ballerina"
1728
+ },
1729
+ "3": {
1730
+ "name": "keyword.operator.ballerina"
1731
+ }
1732
+ },
1733
+ "end": "(?=[^#\\r\\n]|(?:# *?\\+))",
1734
+ "patterns": [
1735
+ {
1736
+ "match": "#.*",
1737
+ "name": "comment.mddocs.paramdesc.ballerina"
1738
+ }
1739
+ ]
1740
+ }
1741
+ ]
1742
+ },
1743
+ "mdDocumentationReturnParamDescription": {
1744
+ "patterns": [
1745
+ {
1746
+ "begin": "(#)(?: *?)(\\+)(?: *)(return)(?: *)(-)?(.*)",
1747
+ "beginCaptures": {
1748
+ "1": {
1749
+ "name": "comment.mddocs.ballerina"
1750
+ },
1751
+ "2": {
1752
+ "name": "keyword.ballerina"
1753
+ },
1754
+ "3": {
1755
+ "name": "keyword.ballerina"
1756
+ },
1757
+ "4": {
1758
+ "name": "keyword.ballerina"
1759
+ },
1760
+ "5": {
1761
+ "name": "comment.mddocs.returnparamdesc.ballerina"
1762
+ }
1763
+ },
1764
+ "end": "(?=[^#\\r\\n]|(?:# *?\\+))",
1765
+ "patterns": [
1766
+ {
1767
+ "match": "#.*",
1768
+ "name": "comment.mddocs.returnparamdesc.ballerina"
1769
+ }
1770
+ ]
1771
+ }
1772
+ ]
1773
+ },
1774
+ "multiType": {
1775
+ "patterns": [
1776
+ {
1777
+ "match": "(?<=\\|)([_$[:alpha:]][_$[:alnum:]]*)|([_$[:alpha:]][_$[:alnum:]]*)(?=\\|)",
1778
+ "name": "storage.type.ballerina"
1779
+ },
1780
+ {
1781
+ "match": "\\|",
1782
+ "name": "keyword.operator.ballerina"
1783
+ }
1784
+ ]
1785
+ },
1786
+ "numbers": {
1787
+ "patterns": [
1788
+ {
1789
+ "match": "\\b0[xX][\\da-fA-F]+\\b|\\b\\d+(?:\\.(?:\\d+|$))?",
1790
+ "name": "constant.numeric.decimal.ballerina"
1791
+ }
1792
+ ]
1793
+ },
1794
+ "object-literal": {
1795
+ "begin": "\\{",
1796
+ "beginCaptures": {
1797
+ "0": {
1798
+ "name": "punctuation.definition.block.ballerina"
1799
+ }
1800
+ },
1801
+ "end": "\\}",
1802
+ "endCaptures": {
1803
+ "0": {
1804
+ "name": "punctuation.definition.block.ballerina"
1805
+ }
1806
+ },
1807
+ "name": "meta.objectliteral.ballerina",
1808
+ "patterns": [
1809
+ {
1810
+ "include": "#object-member"
1811
+ },
1812
+ {
1813
+ "include": "#punctuation-comma"
1814
+ }
1815
+ ]
1816
+ },
1817
+ "object-member": {
1818
+ "patterns": [
1819
+ {
1820
+ "include": "#comment"
1821
+ },
1822
+ {
1823
+ "include": "#function-defn"
1824
+ },
1825
+ {
1826
+ "include": "#literal"
1827
+ },
1828
+ {
1829
+ "include": "#keywords"
1830
+ },
1831
+ {
1832
+ "include": "#expression"
1833
+ },
1834
+ {
1835
+ "begin": "(?=\\[)",
1836
+ "end": "(?=:)|((?<=[\\]])(?=\\s*[\\(\\<]))",
1837
+ "name": "meta.object.member.ballerina meta.object-literal.key.ballerina",
1838
+ "patterns": [
1839
+ {
1840
+ "include": "#comment"
1841
+ }
1842
+ ]
1843
+ },
1844
+ {
1845
+ "begin": "(?=[\\'\\\"\\`])",
1846
+ "end": "(?=:)|((?<=[\\'\\\"\\`])(?=((\\s*[\\(\\<,}])|(\\n*})|(\\s+(as)\\s+))))",
1847
+ "name": "meta.object.member.ballerina meta.object-literal.key.ballerina",
1848
+ "patterns": [
1849
+ {
1850
+ "include": "#comment"
1851
+ },
1852
+ {
1853
+ "include": "#string"
1854
+ }
1855
+ ]
1856
+ },
1857
+ {
1858
+ "begin": "(?x)(?=(\\b(?<!\\$)0(?:x|X)[0-9a-fA-F][0-9a-fA-F_]*(n)?\\b(?!\\$))|(\\b(?<!\\$)0(?:b|B)[01][01_]*(n)?\\b(?!\\$))|(\\b(?<!\\$)0(?:o|O)?[0-7][0-7_]*(n)?\\b(?!\\$))|((?<!\\$)(?:\n (?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\\b)| # 1.1E+3\n (?:\\b[0-9][0-9_]*(\\.)[eE][+-]?[0-9][0-9_]*(n)?\\b)| # 1.E+3\n (?:\\B(\\.)[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\\b)| # .1E+3\n (?:\\b[0-9][0-9_]*[eE][+-]?[0-9][0-9_]*(n)?\\b)| # 1E+3\n (?:\\b[0-9][0-9_]*(\\.)[0-9][0-9_]*(n)?\\b)| # 1.1\n (?:\\b[0-9][0-9_]*(\\.)(n)?\\B)| # 1.\n (?:\\B(\\.)[0-9][0-9_]*(n)?\\b)| # .1\n (?:\\b[0-9][0-9_]*(n)?\\b(?!\\.)) # 1\n)(?!\\$)))",
1859
+ "end": "(?=:)|(?=\\s*([\\(\\<,}])|(\\s+as\\s+))",
1860
+ "name": "meta.object.member.ballerina meta.object-literal.key.ballerina",
1861
+ "patterns": [
1862
+ {
1863
+ "include": "#comment"
1864
+ },
1865
+ {
1866
+ "include": "#numbers"
1867
+ }
1868
+ ]
1869
+ },
1870
+ {
1871
+ "begin": "(?<=[\\]\\'\\\"\\`])(?=\\s*[\\(\\<])",
1872
+ "end": "(?=\\}|;|,)|(?<=\\})",
1873
+ "name": "meta.method.declaration.ballerina",
1874
+ "patterns": [
1875
+ {
1876
+ "include": "#function-body"
1877
+ }
1878
+ ]
1879
+ },
1880
+ {
1881
+ "captures": {
1882
+ "0": {
1883
+ "name": "meta.object-literal.key.ballerina"
1884
+ },
1885
+ "1": {
1886
+ "name": "constant.numeric.decimal.ballerina"
1887
+ }
1888
+ },
1889
+ "match": "(?![_$[:alpha:]])([[:digit:]]+)\\s*(?=(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*:)",
1890
+ "name": "meta.object.member.ballerina"
1891
+ },
1892
+ {
1893
+ "captures": {
1894
+ "0": {
1895
+ "name": "meta.object-literal.key.ballerina"
1896
+ },
1897
+ "1": {
1898
+ "name": "entity.name.function.ballerina"
1899
+ }
1900
+ },
1901
+ "match": "(?x)(?:([_$[:alpha:]][_$[:alnum:]]*)\\s*(?=(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*:(\\s*\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/)*\\s*(\n ((\n (function\\s*[(<*]) |\n (function\\s+) |\n ([_$[:alpha:]][_$[:alnum:]]*\\s*=>)\n )) |\n ((\n ((<\\s*$)|((<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?[\\(]\\s*((([\\{\\[]\\s*)?$)|((\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})\\s*((:\\s*\\{?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))|((\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])\\s*((:\\s*\\[?$)|((\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+\\s*)?=\\s*)))))) |\n # sure shot arrow functions even if => is on new line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)?\n [(]\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*\n (\n ([)]\\s*:) | # ():\n ((\\.\\.\\.\\s*)?[_$[:alpha:]][_$[:alnum:]]*\\s*:) # [(]param: | [(]...param:\n )\n) |\n\n# arrow function possible to detect only with => on same line\n(\n (<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<]|\\<\\s*([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\]))([^=<>]|=[^<])*\\>)*\\>)*>\\s*)? # typeparameters\n \\(\\s*(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*(([_$[:alpha:]]|(\\{([^\\{\\}]|(\\{([^\\{\\}]|\\{[^\\{\\}]*\\})*\\}))*\\})|(\\[([^\\[\\]]|(\\[([^\\[\\]]|\\[[^\\[\\]]*\\])*\\]))*\\])|(\\.\\.\\.\\s*[_$[:alpha:]]))([^()\\'\\\"\\`]|(\\(([^\\(\\)]|(\\(([^\\(\\)]|\\([^\\(\\)]*\\))*\\)))*\\))|(\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`))*)?\\) # parameters\n (\\s*:\\s*([^<>\\(\\)\\{\\}]|\\<([^<>]|\\<([^<>]|\\<[^<>]+\\>)+\\>)+\\>|\\([^\\(\\)]+\\)|\\{[^\\{\\}]+\\})+)? # return type\n \\s*=> # arrow operator\n)\n ))\n)))",
1902
+ "name": "meta.object.member.ballerina"
1903
+ },
1904
+ {
1905
+ "captures": {
1906
+ "0": {
1907
+ "name": "meta.object-literal.key.ballerina"
1908
+ }
1909
+ },
1910
+ "match": "(?:[_$[:alpha:]][_$[:alnum:]]*)\\s*(?=(\\/\\*([^\\*]|(\\*[^\\/]))*\\*\\/\\s*)*:)",
1911
+ "name": "meta.object.member.ballerina"
1912
+ },
1913
+ {
1914
+ "begin": "\\.\\.\\.",
1915
+ "beginCaptures": {
1916
+ "0": {
1917
+ "name": "keyword.operator.spread.ballerina"
1918
+ }
1919
+ },
1920
+ "end": "(?=,|\\})",
1921
+ "name": "meta.object.member.ballerina",
1922
+ "patterns": [
1923
+ {
1924
+ "include": "#expression"
1925
+ }
1926
+ ]
1927
+ },
1928
+ {
1929
+ "captures": {
1930
+ "1": {
1931
+ "name": "variable.other.readwrite.ballerina"
1932
+ }
1933
+ },
1934
+ "match": "([_$[:alpha:]][_$[:alnum:]]*)\\s*(?=,|\\}|$|\\/\\/|\\/\\*)",
1935
+ "name": "meta.object.member.ballerina"
1936
+ },
1937
+ {
1938
+ "captures": {
1939
+ "1": {
1940
+ "name": "keyword.control.as.ballerina"
1941
+ },
1942
+ "2": {
1943
+ "name": "storage.modifier.ballerina"
1944
+ }
1945
+ },
1946
+ "match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(as)\\s+(const)(?=\\s*([,}]|$))",
1947
+ "name": "meta.object.member.ballerina"
1948
+ },
1949
+ {
1950
+ "begin": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(as)\\s+",
1951
+ "beginCaptures": {
1952
+ "1": {
1953
+ "name": "keyword.control.as.ballerina"
1954
+ }
1955
+ },
1956
+ "end": "(?=[;),}\\]:?\\-\\+\\>]|\\|\\||\\&\\&|\\!\\=\\=|$|^|((?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(as)\\s+))",
1957
+ "name": "meta.object.member.ballerina"
1958
+ },
1959
+ {
1960
+ "begin": "(?=[_$[:alpha:]][_$[:alnum:]]*\\s*=)",
1961
+ "end": "(?=,|\\}|$|\\/\\/|\\/\\*)",
1962
+ "name": "meta.object.member.ballerina",
1963
+ "patterns": [
1964
+ {
1965
+ "include": "#expression"
1966
+ }
1967
+ ]
1968
+ }
1969
+ ]
1970
+ },
1971
+ "objectDec": {
1972
+ "patterns": [
1973
+ {
1974
+ "begin": "\\bobject\\b(?!:)",
1975
+ "beginCaptures": {
1976
+ "0": {
1977
+ "name": "keyword.other.ballerina"
1978
+ }
1979
+ },
1980
+ "end": "(?<=\\})",
1981
+ "patterns": [
1982
+ {
1983
+ "include": "#decl-block"
1984
+ }
1985
+ ]
1986
+ }
1987
+ ]
1988
+ },
1989
+ "objectInitBody": {
1990
+ "patterns": [
1991
+ {
1992
+ "begin": "\\{",
1993
+ "beginCaptures": {
1994
+ "0": {
1995
+ "name": "punctuation.definition.block.ballerina"
1996
+ }
1997
+ },
1998
+ "end": "(?=\\})",
1999
+ "endCaptures": {
2000
+ "0": {
2001
+ "name": "punctuation.definition.block.ballerina"
2002
+ }
2003
+ },
2004
+ "patterns": [
2005
+ {
2006
+ "include": "#comment"
2007
+ },
2008
+ {
2009
+ "include": "#code"
2010
+ }
2011
+ ]
2012
+ }
2013
+ ]
2014
+ },
2015
+ "objectInitParameters": {
2016
+ "patterns": [
2017
+ {
2018
+ "begin": "\\(",
2019
+ "beginCaptures": {
2020
+ "0": {
2021
+ "name": "punctuation.definition.parameters.begin.ballerina"
2022
+ }
2023
+ },
2024
+ "end": "\\)",
2025
+ "endCaptures": {
2026
+ "0": {
2027
+ "name": "punctuation.definition.parameters.end.ballerina"
2028
+ }
2029
+ },
2030
+ "patterns": [
2031
+ {
2032
+ "include": "#code"
2033
+ },
2034
+ {
2035
+ "match": "\\b([_$[:alpha:]][_$[:alnum:]]*)\\b",
2036
+ "name": "variable.parameter.ballerina"
2037
+ }
2038
+ ]
2039
+ }
2040
+ ]
2041
+ },
2042
+ "objectMemberFunctionDec": {
2043
+ "patterns": [
2044
+ {
2045
+ "begin": "\\bfunction\\b",
2046
+ "beginCaptures": {
2047
+ "0": {
2048
+ "name": "keyword.ballerina"
2049
+ }
2050
+ },
2051
+ "end": ";",
2052
+ "endCaptures": {
2053
+ "0": {
2054
+ "name": "punctuation.definition.block.ballerina"
2055
+ }
2056
+ },
2057
+ "patterns": [
2058
+ {
2059
+ "include": "#functionParameters"
2060
+ },
2061
+ {
2062
+ "match": "\\breturns\\b",
2063
+ "name": "keyword.ballerina"
2064
+ },
2065
+ {
2066
+ "include": "#code"
2067
+ }
2068
+ ]
2069
+ }
2070
+ ]
2071
+ },
2072
+ "parameter": {
2073
+ "patterns": [
2074
+ {
2075
+ "begin": "((?=record|object|function)|([_$[:alpha:]][_$[:alnum:]]*)(?=\\|)|(?:[_$[:alpha:]][_$[:alnum:]]*))",
2076
+ "beginCaptures": {
2077
+ "0": {
2078
+ "name": "storage.type.ballerina"
2079
+ }
2080
+ },
2081
+ "end": "(?:\\,)|(?:\\|)|(?:\\:)|(?==>)|(?=\\))|(?=\\])",
2082
+ "patterns": [
2083
+ {
2084
+ "include": "#parameterWithDescriptor"
2085
+ },
2086
+ {
2087
+ "include": "#record"
2088
+ },
2089
+ {
2090
+ "include": "#objectDec"
2091
+ },
2092
+ {
2093
+ "include": "#functionType"
2094
+ },
2095
+ {
2096
+ "include": "#constrainType"
2097
+ },
2098
+ {
2099
+ "include": "#defaultValue"
2100
+ },
2101
+ {
2102
+ "include": "#comment"
2103
+ },
2104
+ {
2105
+ "include": "#parameterTuple"
2106
+ },
2107
+ {
2108
+ "match": "[_$[:alpha:]][_$[:alnum:]]*",
2109
+ "name": "default.variable.parameter.ballerina"
2110
+ }
2111
+ ]
2112
+ }
2113
+ ]
2114
+ },
2115
+ "parameter-name": {
2116
+ "patterns": [
2117
+ {
2118
+ "captures": {
2119
+ "1": {
2120
+ "name": "support.type.primitive.ballerina"
2121
+ }
2122
+ },
2123
+ "match": "\\s*\\b(var)\\s+"
2124
+ },
2125
+ {
2126
+ "captures": {
2127
+ "10": {
2128
+ "name": "keyword.operator.optional.ballerina"
2129
+ },
2130
+ "2": {
2131
+ "name": "keyword.operator.rest.ballerina"
2132
+ },
2133
+ "3": {
2134
+ "name": "support.type.primitive.ballerina"
2135
+ },
2136
+ "4": {
2137
+ "name": "keyword.other.ballerina"
2138
+ },
2139
+ "5": {
2140
+ "name": "constant.language.boolean.ballerina"
2141
+ },
2142
+ "6": {
2143
+ "name": "keyword.control.flow.ballerina"
2144
+ },
2145
+ "7": {
2146
+ "name": "storage.type.ballerina"
2147
+ },
2148
+ "8": {
2149
+ "name": "variable.parameter.ballerina"
2150
+ },
2151
+ "9": {
2152
+ "name": "variable.parameter.ballerina"
2153
+ }
2154
+ },
2155
+ "match": "(?x)(?:(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))\\s+)?(?:(\\.\\.\\.)\\s*)?(?<!=|:)(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?:(this)|(string|int|boolean|float|byte|decimal|json|xml|anydata)|\\b(is|new|isolated|null|function|in)\\b|\\b(true|false)\\b|\\b(check|foreach|if|checkpanic)\\b|\\b(readonly|error|map)\\b|([_$[:alpha:]][_$[:alnum:]]*))(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))\\s*(\\??)"
2156
+ }
2157
+ ]
2158
+ },
2159
+ "parameterTuple": {
2160
+ "patterns": [
2161
+ {
2162
+ "begin": "\\[",
2163
+ "end": "(?=\\,)|(?=\\|)|(?=\\:)|(?==>)|(?=\\))",
2164
+ "patterns": [
2165
+ {
2166
+ "include": "#record"
2167
+ },
2168
+ {
2169
+ "include": "#objectDec"
2170
+ },
2171
+ {
2172
+ "include": "#parameterTupleType"
2173
+ },
2174
+ {
2175
+ "include": "#parameterTupleEnd"
2176
+ },
2177
+ {
2178
+ "include": "#comment"
2179
+ }
2180
+ ]
2181
+ }
2182
+ ]
2183
+ },
2184
+ "parameterTupleEnd": {
2185
+ "patterns": [
2186
+ {
2187
+ "begin": "\\]",
2188
+ "end": "(?=\\,)|(?=\\|)|(?=\\:)|(?==>)|(?=\\))",
2189
+ "patterns": [
2190
+ {
2191
+ "include": "#defaultWithParentheses"
2192
+ },
2193
+ {
2194
+ "match": "[_$[:alpha:]][_$[:alnum:]]*",
2195
+ "name": "default.variable.parameter.ballerina"
2196
+ }
2197
+ ]
2198
+ }
2199
+ ]
2200
+ },
2201
+ "parameterTupleType": {
2202
+ "patterns": [
2203
+ {
2204
+ "begin": "[_$[:alpha:]][_$[:alnum:]]*",
2205
+ "beginCaptures": {
2206
+ "0": {
2207
+ "name": "storage.type.ballerina"
2208
+ }
2209
+ },
2210
+ "end": "(?:\\,)|(?:\\|)|(?=\\])"
2211
+ }
2212
+ ]
2213
+ },
2214
+ "parameterWithDescriptor": {
2215
+ "patterns": [
2216
+ {
2217
+ "begin": "\\&",
2218
+ "beginCaptures": {
2219
+ "0": {
2220
+ "name": "keyword.operator.ballerina"
2221
+ }
2222
+ },
2223
+ "end": "(?=\\,)|(?=\\|)|(?=\\))",
2224
+ "patterns": [
2225
+ {
2226
+ "include": "#parameter"
2227
+ }
2228
+ ]
2229
+ }
2230
+ ]
2231
+ },
2232
+ "parameters": {
2233
+ "patterns": [
2234
+ {
2235
+ "match": "\\s*(return|break|continue|check|checkpanic|panic|trap|from|where)\\b",
2236
+ "name": "keyword.control.flow.ballerina"
2237
+ },
2238
+ {
2239
+ "match": "\\s*(let|select)\\b",
2240
+ "name": "keyword.other.ballerina"
2241
+ },
2242
+ {
2243
+ "match": "\\,",
2244
+ "name": "punctuation.separator.parameter.ballerina"
2245
+ }
2246
+ ]
2247
+ },
2248
+ "paranthesised": {
2249
+ "begin": "\\(",
2250
+ "beginCaptures": {
2251
+ "0": {
2252
+ "name": "meta.brace.round.ballerina"
2253
+ }
2254
+ },
2255
+ "end": "\\)",
2256
+ "endCaptures": {
2257
+ "0": {
2258
+ "name": "meta.brace.round.ballerina"
2259
+ }
2260
+ },
2261
+ "name": "meta.brace.round.block.ballerina",
2262
+ "patterns": [
2263
+ {
2264
+ "include": "#self-literal"
2265
+ },
2266
+ {
2267
+ "include": "#function-defn"
2268
+ },
2269
+ {
2270
+ "include": "#decl-block"
2271
+ },
2272
+ {
2273
+ "include": "#comment"
2274
+ },
2275
+ {
2276
+ "include": "#string"
2277
+ },
2278
+ {
2279
+ "include": "#parameters"
2280
+ },
2281
+ {
2282
+ "include": "#annotationAttachment"
2283
+ },
2284
+ {
2285
+ "include": "#recordLiteral"
2286
+ },
2287
+ {
2288
+ "include": "#stringTemplate"
2289
+ },
2290
+ {
2291
+ "include": "#parameter-name"
2292
+ },
2293
+ {
2294
+ "include": "#variable-initializer"
2295
+ },
2296
+ {
2297
+ "include": "#expression"
2298
+ },
2299
+ {
2300
+ "include": "#regex"
2301
+ }
2302
+ ]
2303
+ },
2304
+ "paranthesisedBracket": {
2305
+ "patterns": [
2306
+ {
2307
+ "begin": "\\[",
2308
+ "end": "\\]",
2309
+ "patterns": [
2310
+ {
2311
+ "include": "#comment"
2312
+ },
2313
+ {
2314
+ "include": "#code"
2315
+ }
2316
+ ]
2317
+ }
2318
+ ]
2319
+ },
2320
+ "punctuation-accessor": {
2321
+ "patterns": [
2322
+ {
2323
+ "captures": {
2324
+ "1": {
2325
+ "name": "punctuation.accessor.ballerina"
2326
+ },
2327
+ "2": {
2328
+ "name": "punctuation.accessor.optional.ballerina"
2329
+ }
2330
+ },
2331
+ "match": "(?:(\\.)|(\\?\\.(?!\\s*[[:digit:]])))"
2332
+ }
2333
+ ]
2334
+ },
2335
+ "punctuation-comma": {
2336
+ "patterns": [
2337
+ {
2338
+ "match": ",",
2339
+ "name": "punctuation.separator.comma.ballerina"
2340
+ }
2341
+ ]
2342
+ },
2343
+ "punctuation-semicolon": {
2344
+ "patterns": [
2345
+ {
2346
+ "match": ";",
2347
+ "name": "punctuation.terminator.statement.ballerina"
2348
+ }
2349
+ ]
2350
+ },
2351
+ "record": {
2352
+ "begin": "\\brecord\\b",
2353
+ "beginCaptures": {
2354
+ "0": {
2355
+ "name": "keyword.other.ballerina"
2356
+ }
2357
+ },
2358
+ "end": "(?<=\\})",
2359
+ "name": "meta.record.ballerina",
2360
+ "patterns": [
2361
+ {
2362
+ "include": "#recordBody"
2363
+ }
2364
+ ]
2365
+ },
2366
+ "recordBody": {
2367
+ "patterns": [
2368
+ {
2369
+ "include": "#decl-block"
2370
+ }
2371
+ ]
2372
+ },
2373
+ "recordLiteral": {
2374
+ "patterns": [
2375
+ {
2376
+ "begin": "\\{",
2377
+ "beginCaptures": {
2378
+ "0": {
2379
+ "name": "punctuation.definition.block.ballerina"
2380
+ }
2381
+ },
2382
+ "end": "\\}",
2383
+ "endCaptures": {
2384
+ "0": {
2385
+ "name": "punctuation.definition.block.ballerina"
2386
+ }
2387
+ },
2388
+ "patterns": [
2389
+ {
2390
+ "include": "#code"
2391
+ }
2392
+ ]
2393
+ }
2394
+ ]
2395
+ },
2396
+ "regex": {
2397
+ "patterns": [
2398
+ {
2399
+ "begin": "(\\bre)(\\s*)(`)",
2400
+ "beginCaptures": {
2401
+ "1": {
2402
+ "name": "support.type.primitive.ballerina"
2403
+ },
2404
+ "3": {
2405
+ "name": "punctuation.definition.regexp.template.begin.ballerina"
2406
+ }
2407
+ },
2408
+ "end": "`",
2409
+ "endCaptures": {
2410
+ "1": {
2411
+ "name": "punctuation.definition.regexp.template.end.ballerina"
2412
+ }
2413
+ },
2414
+ "name": "regexp.template.ballerina",
2415
+ "patterns": [
2416
+ {
2417
+ "include": "#template-substitution-element"
2418
+ },
2419
+ {
2420
+ "include": "#regexp"
2421
+ }
2422
+ ]
2423
+ }
2424
+ ]
2425
+ },
2426
+ "regex-character-class": {
2427
+ "patterns": [
2428
+ {
2429
+ "match": "\\\\[wWsSdDtrn]|\\.",
2430
+ "name": "keyword.other.character-class.regexp.ballerina"
2431
+ },
2432
+ {
2433
+ "match": "\\\\[^pPu]",
2434
+ "name": "constant.character.escape.backslash.regexp"
2435
+ }
2436
+ ]
2437
+ },
2438
+ "regex-unicode-properties-general-category": {
2439
+ "patterns": [
2440
+ {
2441
+ "match": "(Lu|Ll|Lt|Lm|Lo|L|Mn|Mc|Me|M|Nd|Nl|No|N|Pc|Pd|Ps|Pe|Pi|Pf|Po|P|Sm|Sc|Sk|So|S|Zs|Zl|Zp|Z|Cf|Cc|Cn|Co|C)",
2442
+ "name": "constant.other.unicode-property-general-category.regexp.ballerina"
2443
+ }
2444
+ ]
2445
+ },
2446
+ "regex-unicode-property-key": {
2447
+ "patterns": [
2448
+ {
2449
+ "begin": "(sc=|gc=)",
2450
+ "beginCaptures": {
2451
+ "1": {
2452
+ "name": "keyword.other.unicode-property-key.regexp.ballerina"
2453
+ }
2454
+ },
2455
+ "end": "()",
2456
+ "endCaptures": {
2457
+ "1": {
2458
+ "name": "punctuation.other.unicode-property.end.regexp.ballerina"
2459
+ }
2460
+ },
2461
+ "name": "keyword.other.unicode-property-key.regexp.ballerina",
2462
+ "patterns": [
2463
+ {
2464
+ "include": "#regex-unicode-properties-general-category"
2465
+ }
2466
+ ]
2467
+ }
2468
+ ]
2469
+ },
2470
+ "regexp": {
2471
+ "patterns": [
2472
+ {
2473
+ "match": "\\^|\\$",
2474
+ "name": "keyword.control.assertion.regexp.ballerina"
2475
+ },
2476
+ {
2477
+ "match": "[?+*]|\\{(\\d+,\\d+|\\d+,|,\\d+|\\d+)\\}\\??",
2478
+ "name": "keyword.operator.quantifier.regexp.ballerina"
2479
+ },
2480
+ {
2481
+ "match": "\\|",
2482
+ "name": "keyword.operator.or.regexp.ballerina"
2483
+ },
2484
+ {
2485
+ "begin": "(\\()",
2486
+ "beginCaptures": {
2487
+ "1": {
2488
+ "name": "punctuation.definition.group.regexp.ballerina"
2489
+ }
2490
+ },
2491
+ "end": "(\\))",
2492
+ "endCaptures": {
2493
+ "1": {
2494
+ "name": "punctuation.definition.group.regexp.ballerina"
2495
+ }
2496
+ },
2497
+ "name": "meta.group.assertion.regexp.ballerina",
2498
+ "patterns": [
2499
+ {
2500
+ "include": "#template-substitution-element"
2501
+ },
2502
+ {
2503
+ "include": "#regexp"
2504
+ },
2505
+ {
2506
+ "include": "#flags-on-off"
2507
+ },
2508
+ {
2509
+ "include": "#unicode-property-escape"
2510
+ }
2511
+ ]
2512
+ },
2513
+ {
2514
+ "begin": "(\\[)(\\^)?",
2515
+ "beginCaptures": {
2516
+ "1": {
2517
+ "name": "punctuation.definition.character-class.start.regexp.ballerina"
2518
+ },
2519
+ "2": {
2520
+ "name": "keyword.operator.negation.regexp.ballerina"
2521
+ }
2522
+ },
2523
+ "end": "(\\])",
2524
+ "endCaptures": {
2525
+ "1": {
2526
+ "name": "punctuation.definition.character-class.end.regexp.ballerina"
2527
+ }
2528
+ },
2529
+ "name": "constant.other.character-class.set.regexp.ballerina",
2530
+ "patterns": [
2531
+ {
2532
+ "captures": {
2533
+ "1": {
2534
+ "name": "constant.character.numeric.regexp"
2535
+ },
2536
+ "2": {
2537
+ "name": "constant.character.escape.backslash.regexp"
2538
+ },
2539
+ "3": {
2540
+ "name": "constant.character.numeric.regexp"
2541
+ },
2542
+ "4": {
2543
+ "name": "constant.character.escape.backslash.regexp"
2544
+ }
2545
+ },
2546
+ "match": "(?:.|(\\\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\\\[^pPu]))\\-(?:[^\\]\\\\]|(\\\\(?:[0-7]{3}|x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}))|(\\\\[^pPu]))",
2547
+ "name": "constant.other.character-class.range.regexp.ballerina"
2548
+ },
2549
+ {
2550
+ "include": "#regex-character-class"
2551
+ },
2552
+ {
2553
+ "include": "#unicode-values"
2554
+ },
2555
+ {
2556
+ "include": "#unicode-property-escape"
2557
+ }
2558
+ ]
2559
+ },
2560
+ {
2561
+ "include": "#template-substitution-element"
2562
+ },
2563
+ {
2564
+ "include": "#regex-character-class"
2565
+ },
2566
+ {
2567
+ "include": "#unicode-values"
2568
+ },
2569
+ {
2570
+ "include": "#unicode-property-escape"
2571
+ }
2572
+ ]
2573
+ },
2574
+ "self-literal": {
2575
+ "patterns": [
2576
+ {
2577
+ "captures": {
2578
+ "1": {
2579
+ "name": "variable.language.this.ballerina"
2580
+ },
2581
+ "2": {
2582
+ "name": "punctuation.accessor.ballerina"
2583
+ },
2584
+ "3": {
2585
+ "name": "entity.name.function.ballerina"
2586
+ }
2587
+ },
2588
+ "match": "(\\bself\\b)\\s*(.)\\s*([_$[:alpha:]][_$[:alnum:]]*)\\s*(?=\\()"
2589
+ },
2590
+ {
2591
+ "match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))self\\b(?!\\$)",
2592
+ "name": "variable.language.this.ballerina"
2593
+ }
2594
+ ]
2595
+ },
2596
+ "service-decl": {
2597
+ "begin": "\\bservice\\b",
2598
+ "beginCaptures": {
2599
+ "0": {
2600
+ "name": "keyword.ballerina"
2601
+ }
2602
+ },
2603
+ "end": "(?=;|^\\s*$|(?:^\\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|service|type|var)\\b))|(?<=\\})|(?<=\\,)",
2604
+ "name": "meta.service.declaration.ballerina",
2605
+ "patterns": [
2606
+ {
2607
+ "include": "#class-defn"
2608
+ },
2609
+ {
2610
+ "include": "#serviceName"
2611
+ },
2612
+ {
2613
+ "include": "#serviceOn"
2614
+ },
2615
+ {
2616
+ "include": "#serviceBody"
2617
+ },
2618
+ {
2619
+ "include": "#objectDec"
2620
+ }
2621
+ ]
2622
+ },
2623
+ "serviceBody": {
2624
+ "patterns": [
2625
+ {
2626
+ "include": "#comment"
2627
+ },
2628
+ {
2629
+ "include": "#mdDocumentation"
2630
+ },
2631
+ {
2632
+ "include": "#documentationDef"
2633
+ },
2634
+ {
2635
+ "include": "#decl-block"
2636
+ }
2637
+ ]
2638
+ },
2639
+ "serviceName": {
2640
+ "patterns": [
2641
+ {
2642
+ "include": "#string"
2643
+ },
2644
+ {
2645
+ "match": "(\\/([_$[:alpha:]][_$[:alnum:]]*)|\\\"[_$[:alpha:]][_$[:alnum:]]*\\\")",
2646
+ "name": "entity.service.path.ballerina"
2647
+ }
2648
+ ]
2649
+ },
2650
+ "serviceOn": {
2651
+ "patterns": [
2652
+ {
2653
+ "begin": "on",
2654
+ "beginCaptures": {
2655
+ "0": {
2656
+ "name": "keyword.other.ballerina"
2657
+ }
2658
+ },
2659
+ "end": "(?={)",
2660
+ "patterns": [
2661
+ {
2662
+ "include": "#code"
2663
+ }
2664
+ ]
2665
+ }
2666
+ ]
2667
+ },
2668
+ "source": {
2669
+ "patterns": [
2670
+ {
2671
+ "begin": "(\\bsource\\b)\\s+([_$[:alpha:]][_$[:alnum:]]*)",
2672
+ "beginCaptures": {
2673
+ "1": {
2674
+ "name": "keyword.other.ballerina"
2675
+ },
2676
+ "2": {
2677
+ "name": "variable.other.readwrite.ballerina"
2678
+ }
2679
+ },
2680
+ "end": "(?=\\,)|(?=\\;)"
2681
+ }
2682
+ ]
2683
+ },
2684
+ "statements": {
2685
+ "patterns": [
2686
+ {
2687
+ "include": "#stringTemplate"
2688
+ },
2689
+ {
2690
+ "include": "#declaration"
2691
+ },
2692
+ {
2693
+ "include": "#control-statement"
2694
+ },
2695
+ {
2696
+ "include": "#decl-block"
2697
+ },
2698
+ {
2699
+ "include": "#expression"
2700
+ },
2701
+ {
2702
+ "include": "#punctuation-semicolon"
2703
+ },
2704
+ {
2705
+ "include": "#string"
2706
+ },
2707
+ {
2708
+ "include": "#comment"
2709
+ },
2710
+ {
2711
+ "include": "#mdDocumentation"
2712
+ },
2713
+ {
2714
+ "include": "#keywords"
2715
+ },
2716
+ {
2717
+ "include": "#annotationAttachment"
2718
+ },
2719
+ {
2720
+ "include": "#regex"
2721
+ }
2722
+ ]
2723
+ },
2724
+ "string": {
2725
+ "patterns": [
2726
+ {
2727
+ "begin": "\"",
2728
+ "beginCaptures": {
2729
+ "0": {
2730
+ "name": "punctuation.definition.string.begin.ballerina"
2731
+ }
2732
+ },
2733
+ "end": "(\")|((?:[^\\\\\\n])$)",
2734
+ "endCaptures": {
2735
+ "1": {
2736
+ "name": "punctuation.definition.string.end.ballerina"
2737
+ },
2738
+ "2": {
2739
+ "name": "invalid.illegal.newline.ballerina"
2740
+ }
2741
+ },
2742
+ "name": "string.quoted.double.ballerina",
2743
+ "patterns": [
2744
+ {
2745
+ "include": "#string-character-escape"
2746
+ }
2747
+ ]
2748
+ }
2749
+ ]
2750
+ },
2751
+ "string-character-escape": {
2752
+ "patterns": [
2753
+ {
2754
+ "match": "\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|u\\{[0-9A-Fa-f]+\\}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.|$)",
2755
+ "name": "constant.character.escape.ballerina"
2756
+ }
2757
+ ]
2758
+ },
2759
+ "stringTemplate": {
2760
+ "patterns": [
2761
+ {
2762
+ "begin": "((string)|([_$[:alpha:]][_$[:alnum:]]*))?(`)",
2763
+ "beginCaptures": {
2764
+ "1": {
2765
+ "name": "entity.name.function.tagged-template.ballerina"
2766
+ },
2767
+ "2": {
2768
+ "name": "support.type.primitive.ballerina"
2769
+ },
2770
+ "4": {
2771
+ "name": "punctuation.definition.string.template.begin.ballerina"
2772
+ }
2773
+ },
2774
+ "end": "\\\\?`",
2775
+ "endCaptures": {
2776
+ "0": {
2777
+ "name": "punctuation.definition.string.template.end.ballerina"
2778
+ }
2779
+ },
2780
+ "name": "string.template.ballerina",
2781
+ "patterns": [
2782
+ {
2783
+ "include": "#template-substitution-element"
2784
+ },
2785
+ {
2786
+ "include": "#string-character-escape"
2787
+ }
2788
+ ]
2789
+ }
2790
+ ]
2791
+ },
2792
+ "strings": {
2793
+ "patterns": [
2794
+ {
2795
+ "begin": "\\\"",
2796
+ "beginCaptures": {
2797
+ "0": {
2798
+ "name": "string.begin.ballerina"
2799
+ }
2800
+ },
2801
+ "end": "\\\"",
2802
+ "endCaptures": {
2803
+ "0": {
2804
+ "name": "string.end.ballerina"
2805
+ }
2806
+ },
2807
+ "patterns": [
2808
+ {
2809
+ "match": "\\\\.",
2810
+ "name": "constant.character.escape.ballerina"
2811
+ },
2812
+ {
2813
+ "match": ".",
2814
+ "name": "string"
2815
+ }
2816
+ ]
2817
+ }
2818
+ ]
2819
+ },
2820
+ "template-substitution-element": {
2821
+ "patterns": [
2822
+ {
2823
+ "begin": "\\$\\{",
2824
+ "beginCaptures": {
2825
+ "0": {
2826
+ "name": "punctuation.definition.template-expression.begin.ballerina"
2827
+ }
2828
+ },
2829
+ "contentName": "meta.embedded.line.ballerina",
2830
+ "end": "\\}",
2831
+ "endCaptures": {
2832
+ "0": {
2833
+ "name": "punctuation.definition.template-expression.end.ballerina"
2834
+ }
2835
+ },
2836
+ "name": "meta.template.expression.ballerina",
2837
+ "patterns": [
2838
+ {
2839
+ "include": "#expression"
2840
+ }
2841
+ ]
2842
+ }
2843
+ ]
2844
+ },
2845
+ "templateVariable": {
2846
+ "patterns": [
2847
+ {
2848
+ "begin": "\\${",
2849
+ "beginCaptures": {
2850
+ "0": {
2851
+ "name": "constant.character.escape.ballerina"
2852
+ }
2853
+ },
2854
+ "end": "}",
2855
+ "endCaptures": {
2856
+ "0": {
2857
+ "name": "constant.character.escape.ballerina"
2858
+ }
2859
+ },
2860
+ "patterns": [
2861
+ {
2862
+ "include": "#code"
2863
+ }
2864
+ ]
2865
+ }
2866
+ ]
2867
+ },
2868
+ "ternary-expression": {
2869
+ "begin": "(?!\\?\\.\\s*[^[:digit:]])(\\?)(?!\\?)",
2870
+ "beginCaptures": {
2871
+ "1": {
2872
+ "name": "keyword.operator.ternary.ballerina"
2873
+ }
2874
+ },
2875
+ "end": "\\s*",
2876
+ "endCaptures": {
2877
+ "1": {
2878
+ "name": "keyword.operator.ternary.ballerina"
2879
+ }
2880
+ },
2881
+ "patterns": [
2882
+ {
2883
+ "include": "#expression"
2884
+ }
2885
+ ]
2886
+ },
2887
+ "tupleType": {
2888
+ "patterns": [
2889
+ {
2890
+ "begin": "\\[",
2891
+ "end": "(?=\\]|;)",
2892
+ "patterns": [
2893
+ {
2894
+ "include": "#comment"
2895
+ },
2896
+ {
2897
+ "include": "#constrainType"
2898
+ },
2899
+ {
2900
+ "include": "#paranthesisedBracket"
2901
+ },
2902
+ {
2903
+ "match": "\\b([_$[:alpha:]][_$[:alnum:]]*)\\b",
2904
+ "name": "storage.type.ballerina"
2905
+ }
2906
+ ]
2907
+ }
2908
+ ]
2909
+ },
2910
+ "type": {
2911
+ "patterns": [
2912
+ {
2913
+ "include": "#comment"
2914
+ },
2915
+ {
2916
+ "include": "#string"
2917
+ },
2918
+ {
2919
+ "include": "#numbers"
2920
+ },
2921
+ {
2922
+ "include": "#type-primitive"
2923
+ },
2924
+ {
2925
+ "include": "#type-tuple"
2926
+ }
2927
+ ]
2928
+ },
2929
+ "type-annotation": {
2930
+ "patterns": [
2931
+ {
2932
+ "begin": "(\\:)",
2933
+ "beginCaptures": {
2934
+ "1": {
2935
+ "name": "keyword.operator.type.annotation.ballerina"
2936
+ }
2937
+ },
2938
+ "end": "(?<![:|&])((?=$|^|[,);\\}\\]\\?\\>\\=>]|//)|(?==[^>])|((?<=[\\}>\\]\\)]|[_$[:alpha:]])\\s*(?=\\{)))(\\?)?",
2939
+ "name": "meta.type.annotation.ballerina",
2940
+ "patterns": [
2941
+ {
2942
+ "include": "#booleans"
2943
+ },
2944
+ {
2945
+ "include": "#stringTemplate"
2946
+ },
2947
+ {
2948
+ "include": "#regex"
2949
+ },
2950
+ {
2951
+ "include": "#self-literal"
2952
+ },
2953
+ {
2954
+ "include": "#xml"
2955
+ },
2956
+ {
2957
+ "include": "#call"
2958
+ },
2959
+ {
2960
+ "captures": {
2961
+ "1": {
2962
+ "name": "keyword.other.ballerina"
2963
+ },
2964
+ "10": {
2965
+ "name": "punctuation.definition.parameters.begin.ballerina"
2966
+ },
2967
+ "11": {
2968
+ "name": "punctuation.definition.parameters.end.ballerina"
2969
+ },
2970
+ "2": {
2971
+ "name": "constant.language.boolean.ballerina"
2972
+ },
2973
+ "3": {
2974
+ "name": "keyword.control.ballerina"
2975
+ },
2976
+ "4": {
2977
+ "name": "storage.type.ballerina"
2978
+ },
2979
+ "5": {
2980
+ "name": "support.type.primitive.ballerina"
2981
+ },
2982
+ "6": {
2983
+ "name": "variable.other.readwrite.ballerina"
2984
+ },
2985
+ "8": {
2986
+ "name": "punctuation.accessor.ballerina"
2987
+ },
2988
+ "9": {
2989
+ "name": "entity.name.function.ballerina"
2990
+ }
2991
+ },
2992
+ "match": "\\b(is|new|isolated|null|function|in)\\b|\\b(true|false)\\b|\\b(check|foreach|if|checkpanic)\\b|\\b(readonly|error|map)\\b|\\b(var)\\b|([_$[:alpha:]][_$[:alnum:]]*)((\\.)([_$[:alpha:]][_$[:alnum:]]*)(\\()(\\)))?"
2993
+ },
2994
+ {
2995
+ "match": "\\?",
2996
+ "name": "keyword.operator.optional.ballerina"
2997
+ },
2998
+ {
2999
+ "include": "#multiType"
3000
+ },
3001
+ {
3002
+ "include": "#type"
3003
+ },
3004
+ {
3005
+ "include": "#paranthesised"
3006
+ }
3007
+ ]
3008
+ }
3009
+ ]
3010
+ },
3011
+ "type-primitive": {
3012
+ "patterns": [
3013
+ {
3014
+ "match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(string|int|boolean|float|byte|decimal|json|xml|anydata)(?![_$[:alnum:]])(?:(?=\\.\\.\\.)|(?!\\.))",
3015
+ "name": "support.type.primitive.ballerina"
3016
+ }
3017
+ ]
3018
+ },
3019
+ "type-tuple": {
3020
+ "begin": "\\[",
3021
+ "beginCaptures": {
3022
+ "0": {
3023
+ "name": "meta.brace.square.ballerina"
3024
+ }
3025
+ },
3026
+ "end": "\\]",
3027
+ "endCaptures": {
3028
+ "0": {
3029
+ "name": "meta.brace.square.ballerina"
3030
+ }
3031
+ },
3032
+ "name": "meta.type.tuple.ballerina",
3033
+ "patterns": [
3034
+ {
3035
+ "include": "#self-literal"
3036
+ },
3037
+ {
3038
+ "include": "#booleans"
3039
+ },
3040
+ {
3041
+ "match": "\\.\\.\\.",
3042
+ "name": "keyword.operator.rest.ballerina"
3043
+ },
3044
+ {
3045
+ "captures": {
3046
+ "1": {
3047
+ "name": "entity.name.label.ballerina"
3048
+ },
3049
+ "2": {
3050
+ "name": "keyword.operator.optional.ballerina"
3051
+ },
3052
+ "3": {
3053
+ "name": "punctuation.separator.label.ballerina"
3054
+ }
3055
+ },
3056
+ "match": "(?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))([_$[:alpha:]][_$[:alnum:]]*)\\s*(\\?)?\\s*(:)"
3057
+ },
3058
+ {
3059
+ "include": "#identifiers"
3060
+ },
3061
+ {
3062
+ "include": "#type"
3063
+ },
3064
+ {
3065
+ "include": "#punctuation-comma"
3066
+ }
3067
+ ]
3068
+ },
3069
+ "typeDefinition": {
3070
+ "patterns": [
3071
+ {
3072
+ "begin": "(\\btype\\b)\\s+([_$[:alpha:]][_$[:alnum:]]*)",
3073
+ "beginCaptures": {
3074
+ "1": {
3075
+ "name": "keyword.other.ballerina"
3076
+ },
3077
+ "2": {
3078
+ "name": "entity.name.type.ballerina"
3079
+ }
3080
+ },
3081
+ "end": "\\;",
3082
+ "endCaptures": {
3083
+ "0": {
3084
+ "name": "punctuation.terminator.statement.ballerina"
3085
+ }
3086
+ },
3087
+ "patterns": [
3088
+ {
3089
+ "include": "#functionParameters"
3090
+ },
3091
+ {
3092
+ "include": "#functionReturns"
3093
+ },
3094
+ {
3095
+ "include": "#mdDocumentation"
3096
+ },
3097
+ {
3098
+ "include": "#record"
3099
+ },
3100
+ {
3101
+ "include": "#string"
3102
+ },
3103
+ {
3104
+ "include": "#keywords"
3105
+ },
3106
+ {
3107
+ "include": "#multiType"
3108
+ },
3109
+ {
3110
+ "include": "#type-primitive"
3111
+ },
3112
+ {
3113
+ "match": "[_$[:alpha:]][_$[:alnum:]]*",
3114
+ "name": "variable.other.readwrite.ballerina"
3115
+ },
3116
+ {
3117
+ "include": "#type-annotation"
3118
+ },
3119
+ {
3120
+ "include": "#typeDescription"
3121
+ },
3122
+ {
3123
+ "include": "#decl-block"
3124
+ }
3125
+ ]
3126
+ }
3127
+ ]
3128
+ },
3129
+ "typeDescription": {
3130
+ "patterns": [
3131
+ {
3132
+ "begin": "[_$[:alpha:]][_$[:alnum:]]*",
3133
+ "end": "(?=;)",
3134
+ "patterns": [
3135
+ {
3136
+ "include": "#numbers"
3137
+ },
3138
+ {
3139
+ "include": "#decl-block"
3140
+ },
3141
+ {
3142
+ "include": "#type-primitive"
3143
+ },
3144
+ {
3145
+ "match": "[_$[:alpha:]][_$[:alnum:]]*",
3146
+ "name": "storage.type.ballerina"
3147
+ }
3148
+ ]
3149
+ }
3150
+ ]
3151
+ },
3152
+ "types": {
3153
+ "patterns": [
3154
+ {
3155
+ "match": "\\b(handle|any|future|typedesc)\\b",
3156
+ "name": "storage.type.ballerina"
3157
+ },
3158
+ {
3159
+ "match": "\\b(boolean|int|string|float|decimal|byte|json|xml|anydata)\\b",
3160
+ "name": "support.type.primitive.ballerina"
3161
+ },
3162
+ {
3163
+ "match": "\\b(map|error|never|readonly|distinct)\\b",
3164
+ "name": "storage.type.ballerina"
3165
+ },
3166
+ {
3167
+ "match": "\\b(stream)\\b",
3168
+ "name": "storage.type.ballerina"
3169
+ }
3170
+ ]
3171
+ },
3172
+ "unicode-property-escape": {
3173
+ "patterns": [
3174
+ {
3175
+ "begin": "(\\\\p|\\\\P)(\\{)",
3176
+ "beginCaptures": {
3177
+ "1": {
3178
+ "name": "keyword.other.unicode-property.regexp.ballerina"
3179
+ },
3180
+ "2": {
3181
+ "name": "punctuation.other.unicode-property.begin.regexp.ballerina"
3182
+ }
3183
+ },
3184
+ "end": "(\\})",
3185
+ "endCaptures": {
3186
+ "1": {
3187
+ "name": "punctuation.other.unicode-property.end.regexp.ballerina"
3188
+ }
3189
+ },
3190
+ "name": "keyword.other.unicode-property.regexp.ballerina",
3191
+ "patterns": [
3192
+ {
3193
+ "include": "#regex-unicode-properties-general-category"
3194
+ },
3195
+ {
3196
+ "include": "#regex-unicode-property-key"
3197
+ }
3198
+ ]
3199
+ }
3200
+ ]
3201
+ },
3202
+ "unicode-values": {
3203
+ "patterns": [
3204
+ {
3205
+ "begin": "(\\\\u)(\\{)",
3206
+ "beginCaptures": {
3207
+ "1": {
3208
+ "name": "keyword.other.unicode-value.regexp.ballerina"
3209
+ },
3210
+ "2": {
3211
+ "name": "punctuation.other.unicode-value.begin.regexp.ballerina"
3212
+ }
3213
+ },
3214
+ "end": "(\\})",
3215
+ "endCaptures": {
3216
+ "1": {
3217
+ "name": "punctuation.other.unicode-value.end.regexp.ballerina"
3218
+ }
3219
+ },
3220
+ "name": "keyword.other.unicode-value.ballerina",
3221
+ "patterns": [
3222
+ {
3223
+ "match": "([0-9A-Fa-f]{1,6})",
3224
+ "name": "constant.other.unicode-value.regexp.ballerina"
3225
+ }
3226
+ ]
3227
+ }
3228
+ ]
3229
+ },
3230
+ "var-expr": {
3231
+ "patterns": [
3232
+ {
3233
+ "begin": "(?=\\b(var))",
3234
+ "beginCaptures": {
3235
+ "0": {
3236
+ "name": "storage.modifier.ballerina support.type.primitive.ballerina"
3237
+ }
3238
+ },
3239
+ "end": "(?!\\b(var))((?=;|}|;|^\\s*$|(?:^\\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|service|type|var)\\b))|((?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))(?=(if)\\s+))|((?<!^string|[^\\._$[:alnum:]]string|^int|[^\\._$[:alnum:]]int)(?=\\s*$)))",
3240
+ "name": "meta.var.expr.ballerina",
3241
+ "patterns": [
3242
+ {
3243
+ "begin": "\\b(var)(?=\\s+|\\[|\\?|\\||\\:)",
3244
+ "beginCaptures": {
3245
+ "0": {
3246
+ "name": "support.type.primitive.ballerina"
3247
+ }
3248
+ },
3249
+ "end": "(?=\\S)"
3250
+ },
3251
+ {
3252
+ "match": "\\|",
3253
+ "name": "keyword.operator.type.annotation.ballerina"
3254
+ },
3255
+ {
3256
+ "match": "\\bin\\b",
3257
+ "name": "keyword.other.ballerina"
3258
+ },
3259
+ {
3260
+ "include": "#comment"
3261
+ },
3262
+ {
3263
+ "include": "#string"
3264
+ },
3265
+ {
3266
+ "include": "#stringTemplate"
3267
+ },
3268
+ {
3269
+ "include": "#numbers"
3270
+ },
3271
+ {
3272
+ "include": "#multiType"
3273
+ },
3274
+ {
3275
+ "include": "#self-literal"
3276
+ },
3277
+ {
3278
+ "include": "#var-single-variable"
3279
+ },
3280
+ {
3281
+ "include": "#variable-initializer"
3282
+ },
3283
+ {
3284
+ "include": "#punctuation-comma"
3285
+ },
3286
+ {
3287
+ "include": "#type-annotation"
3288
+ },
3289
+ {
3290
+ "include": "#keywords"
3291
+ },
3292
+ {
3293
+ "include": "#type-tuple"
3294
+ },
3295
+ {
3296
+ "include": "#regex"
3297
+ }
3298
+ ]
3299
+ },
3300
+ {
3301
+ "include": "#punctuation-comma"
3302
+ },
3303
+ {
3304
+ "begin": "(?=\\b(const(?!\\s+enum\\b)))",
3305
+ "end": "(?!\\b(const(?!\\s+enum\\b)))((?=\\bannotation\\b|;|}|;|^\\s*$|(?:^\\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|service|type|var)\\b))|((?<!^string|[^\\._$[:alnum:]]string|^int|[^\\._$[:alnum:]]int)(?=\\s*$)))",
3306
+ "name": "meta.var.expr.ballerina",
3307
+ "patterns": [
3308
+ {
3309
+ "begin": "\\b(const(?!\\s+enum\\b))\\s+",
3310
+ "beginCaptures": {
3311
+ "0": {
3312
+ "name": "keyword.other.ballerina"
3313
+ }
3314
+ },
3315
+ "end": "(?=\\S)"
3316
+ },
3317
+ {
3318
+ "include": "#comment"
3319
+ },
3320
+ {
3321
+ "include": "#string"
3322
+ },
3323
+ {
3324
+ "include": "#stringTemplate"
3325
+ },
3326
+ {
3327
+ "include": "#var-single-const"
3328
+ },
3329
+ {
3330
+ "include": "#variable-initializer"
3331
+ },
3332
+ {
3333
+ "include": "#punctuation-comma"
3334
+ },
3335
+ {
3336
+ "include": "#type-annotation"
3337
+ }
3338
+ ]
3339
+ },
3340
+ {
3341
+ "include": "#punctuation-comma"
3342
+ },
3343
+ {
3344
+ "begin": "(string|int|boolean|float|byte|decimal|json|xml|anydata)(?=\\s+|\\[|\\?|\\||\\:)",
3345
+ "beginCaptures": {
3346
+ "0": {
3347
+ "name": "support.type.primitive.ballerina"
3348
+ }
3349
+ },
3350
+ "end": "(?!\\b(var))((?=;|}|;|^\\s*$|(?:^\\s*(?:abstract|async|class|const|declare|enum|export|function|import|interface|let|module|namespace|return|service|type|var)\\b))|((?<!^string|[^\\._$[:alnum:]]string|^int|[^\\._$[:alnum:]]int)(?=\\s*$)))",
3351
+ "name": "meta.var.expr.ballerina",
3352
+ "patterns": [
3353
+ {
3354
+ "include": "#xml"
3355
+ },
3356
+ {
3357
+ "begin": "(string|int|boolean|float|byte|decimal|json|xml|anydata)(?=\\s+|\\[|\\?|\\||\\:)",
3358
+ "beginCaptures": {
3359
+ "0": {
3360
+ "name": "support.type.primitive.ballerina"
3361
+ }
3362
+ },
3363
+ "end": "(?=\\S)"
3364
+ },
3365
+ {
3366
+ "match": "\\|",
3367
+ "name": "keyword.operator.type.annotation.ballerina"
3368
+ },
3369
+ {
3370
+ "include": "#string"
3371
+ },
3372
+ {
3373
+ "include": "#stringTemplate"
3374
+ },
3375
+ {
3376
+ "include": "#numbers"
3377
+ },
3378
+ {
3379
+ "include": "#multiType"
3380
+ },
3381
+ {
3382
+ "include": "#var-single-variable"
3383
+ },
3384
+ {
3385
+ "include": "#variable-initializer"
3386
+ },
3387
+ {
3388
+ "include": "#punctuation-comma"
3389
+ },
3390
+ {
3391
+ "include": "#type-annotation"
3392
+ },
3393
+ {
3394
+ "include": "#keywords"
3395
+ },
3396
+ {
3397
+ "include": "#type-tuple"
3398
+ },
3399
+ {
3400
+ "include": "#regex"
3401
+ }
3402
+ ]
3403
+ },
3404
+ {
3405
+ "include": "#punctuation-comma"
3406
+ }
3407
+ ]
3408
+ },
3409
+ "var-single-const": {
3410
+ "patterns": [
3411
+ {
3412
+ "name": "meta.var-single-variable.expr.ballerina"
3413
+ },
3414
+ {
3415
+ "begin": "\\b(var)\\s*",
3416
+ "beginCaptures": {
3417
+ "0": {
3418
+ "name": "support.type.primitive.ballerina"
3419
+ }
3420
+ },
3421
+ "end": "(?=\\S)"
3422
+ },
3423
+ {
3424
+ "include": "#types"
3425
+ },
3426
+ {
3427
+ "begin": "([_$[:alpha:]][_$[:alnum:]]*)",
3428
+ "beginCaptures": {
3429
+ "1": {
3430
+ "name": "meta.definition.variable.ballerina variable.other.constant.ballerina"
3431
+ }
3432
+ },
3433
+ "end": "(?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))\\s+))"
3434
+ }
3435
+ ]
3436
+ },
3437
+ "var-single-variable": {
3438
+ "patterns": [
3439
+ {
3440
+ "begin": "((string|int|boolean|float|byte|decimal|json|xml|anydata)|\\b(readonly|error|map)\\b|([_$[:alpha:]][_$[:alnum:]]*))(?=\\s+|\\;|\\>|\\|)",
3441
+ "beginCaptures": {
3442
+ "2": {
3443
+ "name": "support.type.primitive.ballerina"
3444
+ },
3445
+ "3": {
3446
+ "name": "storage.type.ballerina"
3447
+ },
3448
+ "4": {
3449
+ "name": "meta.definition.variable.ballerina variable.other.readwrite.ballerina"
3450
+ }
3451
+ },
3452
+ "end": "(?=$|^|[;,=}])",
3453
+ "endCaptures": {
3454
+ "0": {
3455
+ "name": "punctuation.terminator.statement.ballerina"
3456
+ }
3457
+ },
3458
+ "name": "meta.var-single-variable.expr.ballerina",
3459
+ "patterns": [
3460
+ {
3461
+ "include": "#call"
3462
+ },
3463
+ {
3464
+ "include": "#self-literal"
3465
+ },
3466
+ {
3467
+ "include": "#if-statement"
3468
+ },
3469
+ {
3470
+ "include": "#string"
3471
+ },
3472
+ {
3473
+ "include": "#numbers"
3474
+ },
3475
+ {
3476
+ "include": "#keywords"
3477
+ }
3478
+ ]
3479
+ },
3480
+ {
3481
+ "begin": "([_$[:alpha:]][_$[:alnum:]]*)\\s+(\\!)?",
3482
+ "beginCaptures": {
3483
+ "1": {
3484
+ "name": "meta.definition.variable.ballerina variable.other.readwrite.ballerina"
3485
+ },
3486
+ "2": {
3487
+ "name": "keyword.operator.definiteassignment.ballerina"
3488
+ }
3489
+ },
3490
+ "end": "(?=$|^|[;,=}]|((?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))\\s+))",
3491
+ "name": "meta.var-single-variable.expr.ballerina"
3492
+ }
3493
+ ]
3494
+ },
3495
+ "variable-initializer": {
3496
+ "patterns": [
3497
+ {
3498
+ "begin": "(?<!=|!)(=)(?!=|>)(?=\\s*\\S)",
3499
+ "beginCaptures": {
3500
+ "1": {
3501
+ "name": "keyword.operator.assignment.ballerina"
3502
+ }
3503
+ },
3504
+ "end": "(?=$|[,);}\\]])",
3505
+ "patterns": [
3506
+ {
3507
+ "match": "(\\')([_$[:alpha:]][_$[:alnum:]]*)",
3508
+ "name": "variable.other.property.ballerina"
3509
+ },
3510
+ {
3511
+ "include": "#xml"
3512
+ },
3513
+ {
3514
+ "include": "#function-defn"
3515
+ },
3516
+ {
3517
+ "include": "#expression"
3518
+ },
3519
+ {
3520
+ "include": "#punctuation-accessor"
3521
+ },
3522
+ {
3523
+ "include": "#regex"
3524
+ }
3525
+ ]
3526
+ },
3527
+ {
3528
+ "begin": "(?<!=|!)(=)(?!=|>)",
3529
+ "beginCaptures": {
3530
+ "1": {
3531
+ "name": "keyword.operator.assignment.ballerina"
3532
+ }
3533
+ },
3534
+ "end": "(?=[,);}\\]]|((?<![_$[:alnum:]])(?:(?<=\\.\\.\\.)|(?<!\\.))\\s+))|(?=^\\s*$)|(?<=\\S)(?<!=)(?=\\s*$)",
3535
+ "patterns": [
3536
+ {
3537
+ "include": "#expression"
3538
+ }
3539
+ ]
3540
+ }
3541
+ ]
3542
+ },
3543
+ "variableDef": {
3544
+ "patterns": [
3545
+ {
3546
+ "begin": "(?:(?!\\+)[_$[:alpha:]][_$[:alnum:]]*)(?: |\\t)|(?=\\()",
3547
+ "beginCaptures": {
3548
+ "0": {
3549
+ "name": "storage.type.ballerina"
3550
+ }
3551
+ },
3552
+ "end": "(?:[_$[:alpha:]][_$[:alnum:]]*)|(?=\\,)|(?=;)|\\.\\.\\.",
3553
+ "patterns": [
3554
+ {
3555
+ "include": "#tupleType"
3556
+ },
3557
+ {
3558
+ "include": "#constrainType"
3559
+ },
3560
+ {
3561
+ "include": "#comment"
3562
+ }
3563
+ ]
3564
+ }
3565
+ ]
3566
+ },
3567
+ "variableDefInline": {
3568
+ "patterns": [
3569
+ {
3570
+ "begin": "(?=record)|(?=object)",
3571
+ "end": "(?=;)",
3572
+ "patterns": [
3573
+ {
3574
+ "include": "#record"
3575
+ },
3576
+ {
3577
+ "include": "#objectDec"
3578
+ }
3579
+ ]
3580
+ }
3581
+ ]
3582
+ },
3583
+ "workerBody": {
3584
+ "patterns": [
3585
+ {
3586
+ "begin": "\\{",
3587
+ "end": "(?=\\})",
3588
+ "patterns": [
3589
+ {
3590
+ "include": "#code"
3591
+ }
3592
+ ]
3593
+ }
3594
+ ]
3595
+ },
3596
+ "workerDef": {
3597
+ "patterns": [
3598
+ {
3599
+ "begin": "\\bworker\\b",
3600
+ "beginCaptures": {
3601
+ "0": {
3602
+ "name": "keyword.ballerina"
3603
+ }
3604
+ },
3605
+ "end": "\\}",
3606
+ "patterns": [
3607
+ {
3608
+ "include": "#functionReturns"
3609
+ },
3610
+ {
3611
+ "include": "#workerBody"
3612
+ }
3613
+ ]
3614
+ }
3615
+ ]
3616
+ },
3617
+ "xml": {
3618
+ "patterns": [
3619
+ {
3620
+ "begin": "(\\bxml)(\\s*)(`)",
3621
+ "beginCaptures": {
3622
+ "1": {
3623
+ "name": "support.type.primitive.ballerina"
3624
+ },
3625
+ "3": {
3626
+ "name": "punctuation.definition.string.template.begin.ballerina"
3627
+ }
3628
+ },
3629
+ "end": "`",
3630
+ "endCaptures": {
3631
+ "0": {
3632
+ "name": "punctuation.definition.string.template.end.ballerina"
3633
+ }
3634
+ },
3635
+ "name": "string.template.ballerina",
3636
+ "patterns": [
3637
+ {
3638
+ "include": "#xmlTag"
3639
+ },
3640
+ {
3641
+ "include": "#xmlComment"
3642
+ },
3643
+ {
3644
+ "include": "#templateVariable"
3645
+ },
3646
+ {
3647
+ "match": ".",
3648
+ "name": "string"
3649
+ }
3650
+ ]
3651
+ }
3652
+ ]
3653
+ },
3654
+ "xmlComment": {
3655
+ "patterns": [
3656
+ {
3657
+ "begin": "<!--",
3658
+ "beginCaptures": {
3659
+ "0": {
3660
+ "name": "comment.block.xml.ballerina"
3661
+ }
3662
+ },
3663
+ "end": "-->",
3664
+ "endCaptures": {
3665
+ "0": {
3666
+ "name": "comment.block.xml.ballerina"
3667
+ }
3668
+ },
3669
+ "name": "comment.block.xml.ballerina"
3670
+ }
3671
+ ]
3672
+ },
3673
+ "xmlDoubleQuotedString": {
3674
+ "patterns": [
3675
+ {
3676
+ "begin": "\\\"",
3677
+ "beginCaptures": {
3678
+ "0": {
3679
+ "name": "string.begin.ballerina"
3680
+ }
3681
+ },
3682
+ "end": "\\\"",
3683
+ "endCaptures": {
3684
+ "0": {
3685
+ "name": "string.end.ballerina"
3686
+ }
3687
+ },
3688
+ "patterns": [
3689
+ {
3690
+ "match": "\\\\.",
3691
+ "name": "constant.character.escape.ballerina"
3692
+ },
3693
+ {
3694
+ "match": ".",
3695
+ "name": "string"
3696
+ }
3697
+ ]
3698
+ }
3699
+ ]
3700
+ },
3701
+ "xmlSingleQuotedString": {
3702
+ "patterns": [
3703
+ {
3704
+ "begin": "\\'",
3705
+ "beginCaptures": {
3706
+ "0": {
3707
+ "name": "string.begin.ballerina"
3708
+ }
3709
+ },
3710
+ "end": "\\'",
3711
+ "endCaptures": {
3712
+ "0": {
3713
+ "name": "string.end.ballerina"
3714
+ }
3715
+ },
3716
+ "patterns": [
3717
+ {
3718
+ "match": "\\\\.",
3719
+ "name": "constant.character.escape.ballerina"
3720
+ },
3721
+ {
3722
+ "match": ".",
3723
+ "name": "string"
3724
+ }
3725
+ ]
3726
+ }
3727
+ ]
3728
+ },
3729
+ "xmlTag": {
3730
+ "patterns": [
3731
+ {
3732
+ "begin": "(<\\/?\\??)\\s*([-_a-zA-Z0-9]+)",
3733
+ "beginCaptures": {
3734
+ "1": {
3735
+ "name": "punctuation.definition.tag.begin.xml.ballerina"
3736
+ },
3737
+ "2": {
3738
+ "name": "entity.name.tag.xml.ballerina"
3739
+ }
3740
+ },
3741
+ "end": "\\??\\/?>",
3742
+ "endCaptures": {
3743
+ "0": {
3744
+ "name": "punctuation.definition.tag.end.xml.ballerina"
3745
+ }
3746
+ },
3747
+ "patterns": [
3748
+ {
3749
+ "include": "#xmlSingleQuotedString"
3750
+ },
3751
+ {
3752
+ "include": "#xmlDoubleQuotedString"
3753
+ },
3754
+ {
3755
+ "match": "xmlns",
3756
+ "name": "keyword.other.ballerina"
3757
+ },
3758
+ {
3759
+ "match": "([a-zA-Z0-9-]+)",
3760
+ "name": "entity.other.attribute-name.xml.ballerina"
3761
+ }
3762
+ ]
3763
+ }
3764
+ ]
3765
+ }
3766
+ },
3767
+ "scopeName": "source.ballerina"
3768
+ }