crates/highlight/syntaxes/go.json 87.5 KiB raw
1
{
2
  "displayName": "Go",
3
  "name": "go",
4
  "patterns": [
5
    {
6
      "include": "#statements"
7
    }
8
  ],
9
  "repository": {
10
    "after_control_variables": {
11
      "captures": {
12
        "1": {
13
          "patterns": [
14
            {
15
              "include": "#type-declarations-without-brackets"
16
            },
17
            {
18
              "match": "\\[",
19
              "name": "punctuation.definition.begin.bracket.square.go"
20
            },
21
            {
22
              "match": "]",
23
              "name": "punctuation.definition.end.bracket.square.go"
24
            },
25
            {
26
              "match": "\\w+",
27
              "name": "variable.other.go"
28
            }
29
          ]
30
        }
31
      },
32
      "match": "(?<=\\brange\\b|;|\\bif\\b|\\bfor\\b|[<>]|<=|>=|==|!=|\\w[-%*+/]|\\w[-%*+/]=|\\|\\||&&)\\s*((?![]\\[]+)[-\\]!%*+./:<=>\\[_[:alnum:]]+)\\s*(?=\\{)"
33
    },
34
    "brackets": {
35
      "patterns": [
36
        {
37
          "begin": "\\{",
38
          "beginCaptures": {
39
            "0": {
40
              "name": "punctuation.definition.begin.bracket.curly.go"
41
            }
42
          },
43
          "end": "}",
44
          "endCaptures": {
45
            "0": {
46
              "name": "punctuation.definition.end.bracket.curly.go"
47
            }
48
          },
49
          "patterns": [
50
            {
51
              "include": "$self"
52
            }
53
          ]
54
        },
55
        {
56
          "begin": "\\(",
57
          "beginCaptures": {
58
            "0": {
59
              "name": "punctuation.definition.begin.bracket.round.go"
60
            }
61
          },
62
          "end": "\\)",
63
          "endCaptures": {
64
            "0": {
65
              "name": "punctuation.definition.end.bracket.round.go"
66
            }
67
          },
68
          "patterns": [
69
            {
70
              "include": "$self"
71
            }
72
          ]
73
        },
74
        {
75
          "begin": "\\[",
76
          "beginCaptures": {
77
            "0": {
78
              "name": "punctuation.definition.begin.bracket.square.go"
79
            }
80
          },
81
          "end": "]",
82
          "endCaptures": {
83
            "0": {
84
              "name": "punctuation.definition.end.bracket.square.go"
85
            }
86
          },
87
          "patterns": [
88
            {
89
              "include": "$self"
90
            }
91
          ]
92
        }
93
      ]
94
    },
95
    "built_in_functions": {
96
      "patterns": [
97
        {
98
          "match": "\\b(append|cap|close|complex|copy|delete|imag|len|panic|print|println|real|recover|min|max|clear)\\b(?=\\()",
99
          "name": "entity.name.function.support.builtin.go"
100
        },
101
        {
102
          "begin": "\\b(new)\\b(\\()",
103
          "beginCaptures": {
104
            "1": {
105
              "name": "entity.name.function.support.builtin.go"
106
            },
107
            "2": {
108
              "name": "punctuation.definition.begin.bracket.round.go"
109
            }
110
          },
111
          "end": "\\)",
112
          "endCaptures": {
113
            "0": {
114
              "name": "punctuation.definition.end.bracket.round.go"
115
            }
116
          },
117
          "patterns": [
118
            {
119
              "include": "#functions"
120
            },
121
            {
122
              "include": "#struct_variables_types"
123
            },
124
            {
125
              "include": "#support_functions"
126
            },
127
            {
128
              "include": "#type-declarations"
129
            },
130
            {
131
              "include": "#generic_types"
132
            },
133
            {
134
              "match": "\\w+",
135
              "name": "entity.name.type.go"
136
            },
137
            {
138
              "include": "$self"
139
            }
140
          ]
141
        },
142
        {
143
          "begin": "\\b(make)\\b(\\()((?:(?:[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+(?:\\([^)]+\\))?)?[]*\\[]+{0,1}(?:(?!\\bmap\\b)[.\\w]+)?(\\[(?:\\S+(?:,\\s*\\S+)*)?])?,?)?",
144
          "beginCaptures": {
145
            "1": {
146
              "name": "entity.name.function.support.builtin.go"
147
            },
148
            "2": {
149
              "name": "punctuation.definition.begin.bracket.round.go"
150
            },
151
            "3": {
152
              "patterns": [
153
                {
154
                  "include": "#type-declarations-without-brackets"
155
                },
156
                {
157
                  "include": "#parameter-variable-types"
158
                },
159
                {
160
                  "match": "\\w+",
161
                  "name": "entity.name.type.go"
162
                }
163
              ]
164
            }
165
          },
166
          "end": "\\)",
167
          "endCaptures": {
168
            "0": {
169
              "name": "punctuation.definition.end.bracket.round.go"
170
            }
171
          },
172
          "patterns": [
173
            {
174
              "include": "$self"
175
            }
176
          ]
177
        }
178
      ]
179
    },
180
    "comments": {
181
      "patterns": [
182
        {
183
          "begin": "(/\\*)",
184
          "beginCaptures": {
185
            "1": {
186
              "name": "punctuation.definition.comment.go"
187
            }
188
          },
189
          "end": "(\\*/)",
190
          "endCaptures": {
191
            "1": {
192
              "name": "punctuation.definition.comment.go"
193
            }
194
          },
195
          "name": "comment.block.go"
196
        },
197
        {
198
          "begin": "(//)",
199
          "beginCaptures": {
200
            "1": {
201
              "name": "punctuation.definition.comment.go"
202
            }
203
          },
204
          "end": "\\n|$",
205
          "name": "comment.line.double-slash.go"
206
        }
207
      ]
208
    },
209
    "const_assignment": {
210
      "patterns": [
211
        {
212
          "captures": {
213
            "1": {
214
              "patterns": [
215
                {
216
                  "include": "#delimiters"
217
                },
218
                {
219
                  "match": "\\w+",
220
                  "name": "variable.other.constant.go"
221
                }
222
              ]
223
            },
224
            "2": {
225
              "patterns": [
226
                {
227
                  "include": "#type-declarations-without-brackets"
228
                },
229
                {
230
                  "include": "#generic_types"
231
                },
232
                {
233
                  "match": "\\(",
234
                  "name": "punctuation.definition.begin.bracket.round.go"
235
                },
236
                {
237
                  "match": "\\)",
238
                  "name": "punctuation.definition.end.bracket.round.go"
239
                },
240
                {
241
                  "match": "\\[",
242
                  "name": "punctuation.definition.begin.bracket.square.go"
243
                },
244
                {
245
                  "match": "]",
246
                  "name": "punctuation.definition.end.bracket.square.go"
247
                },
248
                {
249
                  "match": "\\w+",
250
                  "name": "entity.name.type.go"
251
                }
252
              ]
253
            }
254
          },
255
          "match": "(?<=\\bconst\\b)\\s*\\b([.\\w]+(?:,\\s*[.\\w]+)*)\\s*((?:(?:[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+(?:\\([^)]+\\))?)?(?![]*\\[]+{0,1}\\b(?:struct|func|map)\\b)(?:[]*.\\[\\w]+(?:,\\s*[]*.\\[\\w]+)*)?\\s*=?)?"
256
        },
257
        {
258
          "begin": "(?<=\\bconst\\b)\\s*(\\()",
259
          "beginCaptures": {
260
            "1": {
261
              "name": "punctuation.definition.begin.bracket.round.go"
262
            }
263
          },
264
          "end": "\\)",
265
          "endCaptures": {
266
            "0": {
267
              "name": "punctuation.definition.end.bracket.round.go"
268
            }
269
          },
270
          "patterns": [
271
            {
272
              "captures": {
273
                "1": {
274
                  "patterns": [
275
                    {
276
                      "include": "#delimiters"
277
                    },
278
                    {
279
                      "match": "\\w+",
280
                      "name": "variable.other.constant.go"
281
                    }
282
                  ]
283
                },
284
                "2": {
285
                  "patterns": [
286
                    {
287
                      "include": "#type-declarations-without-brackets"
288
                    },
289
                    {
290
                      "include": "#generic_types"
291
                    },
292
                    {
293
                      "match": "\\(",
294
                      "name": "punctuation.definition.begin.bracket.round.go"
295
                    },
296
                    {
297
                      "match": "\\)",
298
                      "name": "punctuation.definition.end.bracket.round.go"
299
                    },
300
                    {
301
                      "match": "\\[",
302
                      "name": "punctuation.definition.begin.bracket.square.go"
303
                    },
304
                    {
305
                      "match": "]",
306
                      "name": "punctuation.definition.end.bracket.square.go"
307
                    },
308
                    {
309
                      "match": "\\w+",
310
                      "name": "entity.name.type.go"
311
                    }
312
                  ]
313
                }
314
              },
315
              "match": "^\\s*\\b([.\\w]+(?:,\\s*[.\\w]+)*)\\s*((?:(?:[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+(?:\\([^)]+\\))?)?(?![]*\\[]+{0,1}\\b(?:struct|func|map)\\b)(?:[]*.\\[\\w]+(?:,\\s*[]*.\\[\\w]+)*)?\\s*=?)?"
316
            },
317
            {
318
              "include": "$self"
319
            }
320
          ]
321
        }
322
      ]
323
    },
324
    "delimiters": {
325
      "patterns": [
326
        {
327
          "match": ",",
328
          "name": "punctuation.other.comma.go"
329
        },
330
        {
331
          "match": "\\.(?!\\.\\.)",
332
          "name": "punctuation.other.period.go"
333
        },
334
        {
335
          "match": ":(?!=)",
336
          "name": "punctuation.other.colon.go"
337
        }
338
      ]
339
    },
340
    "double_parentheses_types": {
341
      "captures": {
342
        "1": {
343
          "patterns": [
344
            {
345
              "include": "#type-declarations-without-brackets"
346
            },
347
            {
348
              "match": "\\(",
349
              "name": "punctuation.definition.begin.bracket.round.go"
350
            },
351
            {
352
              "match": "\\)",
353
              "name": "punctuation.definition.end.bracket.round.go"
354
            },
355
            {
356
              "match": "\\[",
357
              "name": "punctuation.definition.begin.bracket.square.go"
358
            },
359
            {
360
              "match": "]",
361
              "name": "punctuation.definition.end.bracket.square.go"
362
            },
363
            {
364
              "match": "\\{",
365
              "name": "punctuation.definition.begin.bracket.curly.go"
366
            },
367
            {
368
              "match": "}",
369
              "name": "punctuation.definition.end.bracket.curly.go"
370
            },
371
            {
372
              "match": "\\w+",
373
              "name": "entity.name.type.go"
374
            }
375
          ]
376
        }
377
      },
378
      "match": "(?<!\\w)(\\([]*\\[]+{0,1}[.\\w]+(?:\\[(?:[]*.\\[{}\\w]+(?:,\\s*[]*.\\[{}\\w]+)*)?])?\\))(?=\\()"
379
    },
380
    "function_declaration": {
381
      "begin": "^\\b(func)\\b\\s*(\\([^)]+\\)\\s*)?(?:(\\w+)(?=[(\\[]))?",
382
      "beginCaptures": {
383
        "1": {
384
          "name": "keyword.function.go"
385
        },
386
        "2": {
387
          "patterns": [
388
            {
389
              "begin": "\\(",
390
              "beginCaptures": {
391
                "0": {
392
                  "name": "punctuation.definition.begin.bracket.round.go"
393
                }
394
              },
395
              "end": "\\)",
396
              "endCaptures": {
397
                "0": {
398
                  "name": "punctuation.definition.end.bracket.round.go"
399
                }
400
              },
401
              "patterns": [
402
                {
403
                  "captures": {
404
                    "1": {
405
                      "name": "variable.parameter.go"
406
                    },
407
                    "2": {
408
                      "patterns": [
409
                        {
410
                          "include": "#type-declarations-without-brackets"
411
                        },
412
                        {
413
                          "include": "#parameter-variable-types"
414
                        },
415
                        {
416
                          "match": "\\w+",
417
                          "name": "entity.name.type.go"
418
                        }
419
                      ]
420
                    }
421
                  },
422
                  "match": "(\\w+\\s+)?([*.\\w]+(?:\\[(?:[*.\\w]+(?:,\\s+)?)+{0,1}])?)"
423
                },
424
                {
425
                  "include": "$self"
426
                }
427
              ]
428
            }
429
          ]
430
        },
431
        "3": {
432
          "patterns": [
433
            {
434
              "match": "\\d\\w*",
435
              "name": "invalid.illegal.identifier.go"
436
            },
437
            {
438
              "match": "\\w+",
439
              "name": "entity.name.function.go"
440
            }
441
          ]
442
        }
443
      },
444
      "end": "(?<=\\))\\s*((?:[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}(?![]*\\[]+{0,1}\\b(?:struct|interface)\\b)[-\\]*.\\[\\w]+)?\\s*(?=\\{)",
445
      "endCaptures": {
446
        "1": {
447
          "patterns": [
448
            {
449
              "include": "#type-declarations-without-brackets"
450
            },
451
            {
452
              "include": "#parameter-variable-types"
453
            },
454
            {
455
              "match": "\\w+",
456
              "name": "entity.name.type.go"
457
            }
458
          ]
459
        }
460
      },
461
      "patterns": [
462
        {
463
          "begin": "\\(",
464
          "beginCaptures": {
465
            "0": {
466
              "name": "punctuation.definition.begin.bracket.round.go"
467
            }
468
          },
469
          "end": "\\)",
470
          "endCaptures": {
471
            "0": {
472
              "name": "punctuation.definition.end.bracket.round.go"
473
            }
474
          },
475
          "patterns": [
476
            {
477
              "include": "#function_param_types"
478
            }
479
          ]
480
        },
481
        {
482
          "begin": "([*.\\w]+)?(\\[)",
483
          "beginCaptures": {
484
            "1": {
485
              "patterns": [
486
                {
487
                  "include": "#type-declarations"
488
                },
489
                {
490
                  "match": "\\w+",
491
                  "name": "entity.name.type.go"
492
                }
493
              ]
494
            },
495
            "2": {
496
              "name": "punctuation.definition.begin.bracket.square.go"
497
            }
498
          },
499
          "end": "]",
500
          "endCaptures": {
501
            "0": {
502
              "name": "punctuation.definition.end.bracket.square.go"
503
            }
504
          },
505
          "patterns": [
506
            {
507
              "include": "#generic_param_types"
508
            }
509
          ]
510
        },
511
        {
512
          "captures": {
513
            "1": {
514
              "patterns": [
515
                {
516
                  "include": "#type-declarations-without-brackets"
517
                },
518
                {
519
                  "include": "#parameter-variable-types"
520
                },
521
                {
522
                  "match": "\\w+",
523
                  "name": "entity.name.type.go"
524
                }
525
              ]
526
            }
527
          },
528
          "match": "(?<=\\))\\s*((?:\\s*[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}[-\\]*.<>\\[\\w]+\\s*(?:/[*/].*)?)$"
529
        },
530
        {
531
          "include": "$self"
532
        }
533
      ]
534
    },
535
    "function_param_types": {
536
      "patterns": [
537
        {
538
          "include": "#struct_variables_types"
539
        },
540
        {
541
          "include": "#interface_variables_types"
542
        },
543
        {
544
          "include": "#type-declarations-without-brackets"
545
        },
546
        {
547
          "captures": {
548
            "1": {
549
              "patterns": [
550
                {
551
                  "include": "#type-declarations"
552
                },
553
                {
554
                  "match": "\\w+",
555
                  "name": "variable.parameter.go"
556
                }
557
              ]
558
            }
559
          },
560
          "match": "((?:\\b\\w+,\\s*)+{0,1}\\b\\w+)\\s+(?=(?:\\s*[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}[]*\\[]+{0,1}\\b(?:struct|interface)\\b\\s*\\{)"
561
        },
562
        {
563
          "captures": {
564
            "1": {
565
              "patterns": [
566
                {
567
                  "include": "#type-declarations"
568
                },
569
                {
570
                  "match": "\\w+",
571
                  "name": "variable.parameter.go"
572
                }
573
              ]
574
            }
575
          },
576
          "match": "(?:(?<=\\()|^\\s*)((?:\\b\\w+,\\s*)+(?:/[*/].*)?)$"
577
        },
578
        {
579
          "captures": {
580
            "1": {
581
              "patterns": [
582
                {
583
                  "include": "#delimiters"
584
                },
585
                {
586
                  "match": "\\w+",
587
                  "name": "variable.parameter.go"
588
                }
589
              ]
590
            },
591
            "2": {
592
              "patterns": [
593
                {
594
                  "include": "#type-declarations-without-brackets"
595
                },
596
                {
597
                  "include": "#parameter-variable-types"
598
                },
599
                {
600
                  "match": "\\w+",
601
                  "name": "entity.name.type.go"
602
                }
603
              ]
604
            }
605
          },
606
          "match": "((?:\\b\\w+,\\s*)+{0,1}\\b\\w+)\\s+((?:\\s*[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}(?:[]*.\\[\\w]+{0,1}(?:\\bfunc\\b\\([^)]+{0,1}\\)(?:\\s*[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}\\s*)+(?:[]*.\\[\\w]+|\\([^)]+{0,1}\\))?|(?:[]*\\[]+{0,1}[*.\\w]+(?:\\[[^]]+])?[*.\\w]+{0,1})+))"
607
        },
608
        {
609
          "begin": "([*.\\w]+)?(\\[)",
610
          "beginCaptures": {
611
            "1": {
612
              "patterns": [
613
                {
614
                  "include": "#type-declarations"
615
                },
616
                {
617
                  "match": "\\w+",
618
                  "name": "entity.name.type.go"
619
                }
620
              ]
621
            },
622
            "2": {
623
              "name": "punctuation.definition.begin.bracket.square.go"
624
            }
625
          },
626
          "end": "]",
627
          "endCaptures": {
628
            "0": {
629
              "name": "punctuation.definition.end.bracket.square.go"
630
            }
631
          },
632
          "patterns": [
633
            {
634
              "include": "#generic_param_types"
635
            }
636
          ]
637
        },
638
        {
639
          "begin": "\\(",
640
          "beginCaptures": {
641
            "0": {
642
              "name": "punctuation.definition.begin.bracket.round.go"
643
            }
644
          },
645
          "end": "\\)",
646
          "endCaptures": {
647
            "0": {
648
              "name": "punctuation.definition.end.bracket.round.go"
649
            }
650
          },
651
          "patterns": [
652
            {
653
              "include": "#function_param_types"
654
            }
655
          ]
656
        },
657
        {
658
          "captures": {
659
            "1": {
660
              "patterns": [
661
                {
662
                  "include": "#type-declarations"
663
                },
664
                {
665
                  "match": "\\w+",
666
                  "name": "entity.name.type.go"
667
                }
668
              ]
669
            }
670
          },
671
          "match": "([.\\w]+)"
672
        },
673
        {
674
          "include": "$self"
675
        }
676
      ]
677
    },
678
    "functions": {
679
      "begin": "\\b(func)\\b(?=\\()",
680
      "beginCaptures": {
681
        "1": {
682
          "name": "keyword.function.go"
683
        }
684
      },
685
      "end": "(?<=\\))(\\s*(?:[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+)?(\\s*(?:[]*\\[]+{0,1}[*.\\w]+)?(?:\\[(?:[*.\\w]+{0,1}(?:\\[[^]]+{0,1}])?(?:,\\s+)?)+]|\\([^)]+{0,1}\\))?[*.\\w]+{0,1}\\s*(?=\\{)|\\s*(?:[]*\\[]+{0,1}(?!\\bfunc\\b)[*.\\w]+(?:\\[(?:[*.\\w]+{0,1}(?:\\[[^]]+{0,1}])?(?:,\\s+)?)+])?[*.\\w]+{0,1}|\\([^)]+{0,1}\\)))?",
686
      "endCaptures": {
687
        "1": {
688
          "patterns": [
689
            {
690
              "include": "#type-declarations"
691
            }
692
          ]
693
        },
694
        "2": {
695
          "patterns": [
696
            {
697
              "include": "#type-declarations-without-brackets"
698
            },
699
            {
700
              "include": "#parameter-variable-types"
701
            },
702
            {
703
              "match": "\\w+",
704
              "name": "entity.name.type.go"
705
            }
706
          ]
707
        }
708
      },
709
      "patterns": [
710
        {
711
          "include": "#parameter-variable-types"
712
        }
713
      ]
714
    },
715
    "functions_inline": {
716
      "captures": {
717
        "1": {
718
          "name": "keyword.function.go"
719
        },
720
        "2": {
721
          "patterns": [
722
            {
723
              "include": "#type-declarations-without-brackets"
724
            },
725
            {
726
              "begin": "\\(",
727
              "beginCaptures": {
728
                "0": {
729
                  "name": "punctuation.definition.begin.bracket.round.go"
730
                }
731
              },
732
              "end": "\\)",
733
              "endCaptures": {
734
                "0": {
735
                  "name": "punctuation.definition.end.bracket.round.go"
736
                }
737
              },
738
              "patterns": [
739
                {
740
                  "include": "#function_param_types"
741
                },
742
                {
743
                  "include": "$self"
744
                }
745
              ]
746
            },
747
            {
748
              "match": "\\[",
749
              "name": "punctuation.definition.begin.bracket.square.go"
750
            },
751
            {
752
              "match": "]",
753
              "name": "punctuation.definition.end.bracket.square.go"
754
            },
755
            {
756
              "match": "\\{",
757
              "name": "punctuation.definition.begin.bracket.curly.go"
758
            },
759
            {
760
              "match": "}",
761
              "name": "punctuation.definition.end.bracket.curly.go"
762
            },
763
            {
764
              "match": "\\w+",
765
              "name": "entity.name.type.go"
766
            }
767
          ]
768
        }
769
      },
770
      "match": "\\b(func)\\b(\\([^/]*?\\)\\s+\\([^/]*?\\))\\s+(?=\\{)"
771
    },
772
    "generic_param_types": {
773
      "patterns": [
774
        {
775
          "include": "#struct_variables_types"
776
        },
777
        {
778
          "include": "#interface_variables_types"
779
        },
780
        {
781
          "include": "#type-declarations-without-brackets"
782
        },
783
        {
784
          "captures": {
785
            "1": {
786
              "patterns": [
787
                {
788
                  "include": "#type-declarations"
789
                },
790
                {
791
                  "match": "\\w+",
792
                  "name": "variable.parameter.go"
793
                }
794
              ]
795
            }
796
          },
797
          "match": "((?:\\b\\w+,\\s*)+{0,1}\\b\\w+)\\s+(?=(?:\\s*[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}[]*\\[]+{0,1}\\b(?:struct|interface)\\b\\s*\\{)"
798
        },
799
        {
800
          "captures": {
801
            "1": {
802
              "patterns": [
803
                {
804
                  "include": "#type-declarations"
805
                },
806
                {
807
                  "match": "\\w+",
808
                  "name": "variable.parameter.go"
809
                }
810
              ]
811
            }
812
          },
813
          "match": "(?:(?<=\\()|^\\s*)((?:\\b\\w+,\\s*)+(?:/[*/].*)?)$"
814
        },
815
        {
816
          "captures": {
817
            "1": {
818
              "patterns": [
819
                {
820
                  "include": "#delimiters"
821
                },
822
                {
823
                  "match": "\\w+",
824
                  "name": "variable.parameter.go"
825
                }
826
              ]
827
            },
828
            "2": {
829
              "patterns": [
830
                {
831
                  "include": "#type-declarations-without-brackets"
832
                },
833
                {
834
                  "include": "#parameter-variable-types"
835
                },
836
                {
837
                  "match": "\\w+",
838
                  "name": "entity.name.type.go"
839
                }
840
              ]
841
            },
842
            "3": {
843
              "patterns": [
844
                {
845
                  "include": "#type-declarations"
846
                },
847
                {
848
                  "match": "\\w+",
849
                  "name": "entity.name.type.go"
850
                }
851
              ]
852
            }
853
          },
854
          "match": "((?:\\b\\w+,\\s*)+{0,1}\\b\\w+)\\s+((?:\\s*[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}(?:[]*.\\[\\w]+{0,1}(?:\\bfunc\\b\\([^)]+{0,1}\\)(?:\\s*[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}\\s*)+(?:[*.\\w]+|\\([^)]+{0,1}\\))?|(?:(?:[*.~\\w]+|\\[(?:[*.\\w]+{0,1}(?:\\[[^]]+{0,1}])?(?:,\\s+)?)+])[*.\\w]+{0,1})+))"
855
        },
856
        {
857
          "begin": "([*.\\w]+)?(\\[)",
858
          "beginCaptures": {
859
            "1": {
860
              "patterns": [
861
                {
862
                  "include": "#type-declarations"
863
                },
864
                {
865
                  "match": "\\w+",
866
                  "name": "entity.name.type.go"
867
                }
868
              ]
869
            },
870
            "2": {
871
              "name": "punctuation.definition.begin.bracket.square.go"
872
            }
873
          },
874
          "end": "]",
875
          "endCaptures": {
876
            "0": {
877
              "name": "punctuation.definition.end.bracket.square.go"
878
            }
879
          },
880
          "patterns": [
881
            {
882
              "include": "#generic_param_types"
883
            }
884
          ]
885
        },
886
        {
887
          "begin": "\\(",
888
          "beginCaptures": {
889
            "0": {
890
              "name": "punctuation.definition.begin.bracket.round.go"
891
            }
892
          },
893
          "end": "\\)",
894
          "endCaptures": {
895
            "0": {
896
              "name": "punctuation.definition.end.bracket.round.go"
897
            }
898
          },
899
          "patterns": [
900
            {
901
              "include": "#function_param_types"
902
            }
903
          ]
904
        },
905
        {
906
          "captures": {
907
            "1": {
908
              "patterns": [
909
                {
910
                  "include": "#type-declarations"
911
                },
912
                {
913
                  "match": "\\w+",
914
                  "name": "entity.name.type.go"
915
                }
916
              ]
917
            }
918
          },
919
          "match": "\\b([.\\w]+)"
920
        },
921
        {
922
          "include": "$self"
923
        }
924
      ]
925
    },
926
    "generic_types": {
927
      "captures": {
928
        "1": {
929
          "patterns": [
930
            {
931
              "include": "#type-declarations"
932
            },
933
            {
934
              "match": "\\w+",
935
              "name": "entity.name.type.go"
936
            }
937
          ]
938
        },
939
        "2": {
940
          "patterns": [
941
            {
942
              "include": "#parameter-variable-types"
943
            }
944
          ]
945
        }
946
      },
947
      "match": "([*.\\w]+)(\\[[^]]+{0,1}])"
948
    },
949
    "group-functions": {
950
      "patterns": [
951
        {
952
          "include": "#function_declaration"
953
        },
954
        {
955
          "include": "#functions_inline"
956
        },
957
        {
958
          "include": "#functions"
959
        },
960
        {
961
          "include": "#built_in_functions"
962
        },
963
        {
964
          "include": "#support_functions"
965
        }
966
      ]
967
    },
968
    "group-types": {
969
      "patterns": [
970
        {
971
          "include": "#other_struct_interface_expressions"
972
        },
973
        {
974
          "include": "#type_assertion_inline"
975
        },
976
        {
977
          "include": "#struct_variables_types"
978
        },
979
        {
980
          "include": "#interface_variables_types"
981
        },
982
        {
983
          "include": "#single_type"
984
        },
985
        {
986
          "include": "#multi_types"
987
        },
988
        {
989
          "include": "#struct_interface_declaration"
990
        },
991
        {
992
          "include": "#double_parentheses_types"
993
        },
994
        {
995
          "include": "#switch_types"
996
        },
997
        {
998
          "include": "#type-declarations"
999
        }
1000
      ]
1001
    },
1002
    "group-variables": {
1003
      "patterns": [
1004
        {
1005
          "include": "#const_assignment"
1006
        },
1007
        {
1008
          "include": "#var_assignment"
1009
        },
1010
        {
1011
          "include": "#variable_assignment"
1012
        },
1013
        {
1014
          "include": "#label_loop_variables"
1015
        },
1016
        {
1017
          "include": "#slice_index_variables"
1018
        },
1019
        {
1020
          "include": "#property_variables"
1021
        },
1022
        {
1023
          "include": "#switch_variables"
1024
        },
1025
        {
1026
          "include": "#other_variables"
1027
        }
1028
      ]
1029
    },
1030
    "hover": {
1031
      "patterns": [
1032
        {
1033
          "captures": {
1034
            "1": {
1035
              "patterns": [
1036
                {
1037
                  "include": "#type-declarations"
1038
                },
1039
                {
1040
                  "match": "\\w+",
1041
                  "name": "variable.other.property.go"
1042
                }
1043
              ]
1044
            },
1045
            "2": {
1046
              "patterns": [
1047
                {
1048
                  "match": "\\binvalid\\b\\s+\\btype\\b",
1049
                  "name": "invalid.field.go"
1050
                },
1051
                {
1052
                  "include": "#type-declarations-without-brackets"
1053
                },
1054
                {
1055
                  "include": "#parameter-variable-types"
1056
                },
1057
                {
1058
                  "match": "\\w+",
1059
                  "name": "entity.name.type.go"
1060
                }
1061
              ]
1062
            }
1063
          },
1064
          "match": "(?<=^\\bfield\\b)\\s+([*.\\w]+)\\s+([\\s\\S]+)"
1065
        },
1066
        {
1067
          "captures": {
1068
            "1": {
1069
              "patterns": [
1070
                {
1071
                  "include": "#type-declarations-without-brackets"
1072
                },
1073
                {
1074
                  "include": "#parameter-variable-types"
1075
                },
1076
                {
1077
                  "match": "\\w+",
1078
                  "name": "entity.name.type.go"
1079
                }
1080
              ]
1081
            }
1082
          },
1083
          "match": "(?<=^\\breturns\\b)\\s+([\\s\\S]+)"
1084
        }
1085
      ]
1086
    },
1087
    "import": {
1088
      "patterns": [
1089
        {
1090
          "begin": "\\b(import)\\s+",
1091
          "beginCaptures": {
1092
            "1": {
1093
              "name": "keyword.control.import.go"
1094
            }
1095
          },
1096
          "end": "(?!\\G)",
1097
          "patterns": [
1098
            {
1099
              "include": "#imports"
1100
            }
1101
          ]
1102
        }
1103
      ]
1104
    },
1105
    "imports": {
1106
      "patterns": [
1107
        {
1108
          "captures": {
1109
            "1": {
1110
              "patterns": [
1111
                {
1112
                  "include": "#delimiters"
1113
                },
1114
                {
1115
                  "match": "\\w+",
1116
                  "name": "variable.other.import.go"
1117
                }
1118
              ]
1119
            },
1120
            "2": {
1121
              "name": "string.quoted.double.go"
1122
            },
1123
            "3": {
1124
              "name": "punctuation.definition.string.begin.go"
1125
            },
1126
            "4": {
1127
              "name": "entity.name.import.go"
1128
            },
1129
            "5": {
1130
              "name": "punctuation.definition.string.end.go"
1131
            }
1132
          },
1133
          "match": "(\\s*[.\\w]+)?\\s*((\")([^\"]*)(\"))"
1134
        },
1135
        {
1136
          "begin": "\\(",
1137
          "beginCaptures": {
1138
            "0": {
1139
              "name": "punctuation.definition.imports.begin.bracket.round.go"
1140
            }
1141
          },
1142
          "end": "\\)",
1143
          "endCaptures": {
1144
            "0": {
1145
              "name": "punctuation.definition.imports.end.bracket.round.go"
1146
            }
1147
          },
1148
          "patterns": [
1149
            {
1150
              "include": "#comments"
1151
            },
1152
            {
1153
              "include": "#imports"
1154
            }
1155
          ]
1156
        },
1157
        {
1158
          "include": "$self"
1159
        }
1160
      ]
1161
    },
1162
    "interface_variables_types": {
1163
      "begin": "\\b(interface)\\b\\s*(\\{)",
1164
      "beginCaptures": {
1165
        "1": {
1166
          "name": "keyword.interface.go"
1167
        },
1168
        "2": {
1169
          "name": "punctuation.definition.begin.bracket.curly.go"
1170
        }
1171
      },
1172
      "end": "}",
1173
      "endCaptures": {
1174
        "0": {
1175
          "name": "punctuation.definition.end.bracket.curly.go"
1176
        }
1177
      },
1178
      "patterns": [
1179
        {
1180
          "include": "#interface_variables_types_field"
1181
        },
1182
        {
1183
          "include": "$self"
1184
        }
1185
      ]
1186
    },
1187
    "interface_variables_types_field": {
1188
      "patterns": [
1189
        {
1190
          "include": "#support_functions"
1191
        },
1192
        {
1193
          "include": "#type-declarations-without-brackets"
1194
        },
1195
        {
1196
          "begin": "([*.\\w]+)?(\\[)",
1197
          "beginCaptures": {
1198
            "1": {
1199
              "patterns": [
1200
                {
1201
                  "include": "#type-declarations"
1202
                },
1203
                {
1204
                  "match": "\\w+",
1205
                  "name": "entity.name.type.go"
1206
                }
1207
              ]
1208
            },
1209
            "2": {
1210
              "name": "punctuation.definition.begin.bracket.square.go"
1211
            }
1212
          },
1213
          "end": "]",
1214
          "endCaptures": {
1215
            "0": {
1216
              "name": "punctuation.definition.end.bracket.square.go"
1217
            }
1218
          },
1219
          "patterns": [
1220
            {
1221
              "include": "#generic_param_types"
1222
            }
1223
          ]
1224
        },
1225
        {
1226
          "begin": "\\(",
1227
          "beginCaptures": {
1228
            "0": {
1229
              "name": "punctuation.definition.begin.bracket.round.go"
1230
            }
1231
          },
1232
          "end": "\\)",
1233
          "endCaptures": {
1234
            "0": {
1235
              "name": "punctuation.definition.end.bracket.round.go"
1236
            }
1237
          },
1238
          "patterns": [
1239
            {
1240
              "include": "#function_param_types"
1241
            }
1242
          ]
1243
        },
1244
        {
1245
          "captures": {
1246
            "1": {
1247
              "patterns": [
1248
                {
1249
                  "include": "#type-declarations"
1250
                },
1251
                {
1252
                  "match": "\\w+",
1253
                  "name": "entity.name.type.go"
1254
                }
1255
              ]
1256
            }
1257
          },
1258
          "match": "([.\\w]+)"
1259
        }
1260
      ]
1261
    },
1262
    "keywords": {
1263
      "patterns": [
1264
        {
1265
          "match": "\\b(break|case|continue|default|defer|else|fallthrough|for|go|goto|if|range|return|select|switch)\\b",
1266
          "name": "keyword.control.go"
1267
        },
1268
        {
1269
          "match": "\\bchan\\b",
1270
          "name": "keyword.channel.go"
1271
        },
1272
        {
1273
          "match": "\\bconst\\b",
1274
          "name": "keyword.const.go"
1275
        },
1276
        {
1277
          "match": "\\bvar\\b",
1278
          "name": "keyword.var.go"
1279
        },
1280
        {
1281
          "match": "\\bfunc\\b",
1282
          "name": "keyword.function.go"
1283
        },
1284
        {
1285
          "match": "\\binterface\\b",
1286
          "name": "keyword.interface.go"
1287
        },
1288
        {
1289
          "match": "\\bmap\\b",
1290
          "name": "keyword.map.go"
1291
        },
1292
        {
1293
          "match": "\\bstruct\\b",
1294
          "name": "keyword.struct.go"
1295
        },
1296
        {
1297
          "match": "\\bimport\\b",
1298
          "name": "keyword.control.import.go"
1299
        },
1300
        {
1301
          "match": "\\btype\\b",
1302
          "name": "keyword.type.go"
1303
        }
1304
      ]
1305
    },
1306
    "label_loop_variables": {
1307
      "captures": {
1308
        "1": {
1309
          "patterns": [
1310
            {
1311
              "include": "#type-declarations"
1312
            },
1313
            {
1314
              "match": "\\w+",
1315
              "name": "variable.other.label.go"
1316
            }
1317
          ]
1318
        }
1319
      },
1320
      "match": "^(\\s*\\w+:\\s*|\\s*\\b(?:break|goto|continue)\\b\\s+\\w+(?:\\s*/[*/]\\s*.*)?)$"
1321
    },
1322
    "language_constants": {
1323
      "captures": {
1324
        "1": {
1325
          "name": "constant.language.boolean.go"
1326
        },
1327
        "2": {
1328
          "name": "constant.language.null.go"
1329
        },
1330
        "3": {
1331
          "name": "constant.language.iota.go"
1332
        }
1333
      },
1334
      "match": "\\b(?:(true|false)|(nil)|(iota))\\b"
1335
    },
1336
    "map_types": {
1337
      "begin": "\\b(map)\\b(\\[)",
1338
      "beginCaptures": {
1339
        "1": {
1340
          "name": "keyword.map.go"
1341
        },
1342
        "2": {
1343
          "name": "punctuation.definition.begin.bracket.square.go"
1344
        }
1345
      },
1346
      "end": "(])((?:[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}(?![]*\\[]+{0,1}\\b(?:func|struct|map)\\b)[]*\\[]+{0,1}[.\\w]+(?:\\[(?:[]*.\\[{}\\w]+(?:,\\s*[]*.\\[{}\\w]+)*)?])?)?",
1347
      "endCaptures": {
1348
        "1": {
1349
          "name": "punctuation.definition.end.bracket.square.go"
1350
        },
1351
        "2": {
1352
          "patterns": [
1353
            {
1354
              "include": "#type-declarations-without-brackets"
1355
            },
1356
            {
1357
              "match": "\\[",
1358
              "name": "punctuation.definition.begin.bracket.square.go"
1359
            },
1360
            {
1361
              "match": "]",
1362
              "name": "punctuation.definition.end.bracket.square.go"
1363
            },
1364
            {
1365
              "match": "\\w+",
1366
              "name": "entity.name.type.go"
1367
            }
1368
          ]
1369
        }
1370
      },
1371
      "patterns": [
1372
        {
1373
          "include": "#type-declarations-without-brackets"
1374
        },
1375
        {
1376
          "include": "#parameter-variable-types"
1377
        },
1378
        {
1379
          "include": "#functions"
1380
        },
1381
        {
1382
          "match": "\\[",
1383
          "name": "punctuation.definition.begin.bracket.square.go"
1384
        },
1385
        {
1386
          "match": "]",
1387
          "name": "punctuation.definition.end.bracket.square.go"
1388
        },
1389
        {
1390
          "match": "\\{",
1391
          "name": "punctuation.definition.begin.bracket.curly.go"
1392
        },
1393
        {
1394
          "match": "}",
1395
          "name": "punctuation.definition.end.bracket.curly.go"
1396
        },
1397
        {
1398
          "match": "\\(",
1399
          "name": "punctuation.definition.begin.bracket.round.go"
1400
        },
1401
        {
1402
          "match": "\\)",
1403
          "name": "punctuation.definition.end.bracket.round.go"
1404
        },
1405
        {
1406
          "match": "\\w+",
1407
          "name": "entity.name.type.go"
1408
        }
1409
      ]
1410
    },
1411
    "multi_types": {
1412
      "begin": "\\b(type)\\b\\s*(\\()",
1413
      "beginCaptures": {
1414
        "1": {
1415
          "name": "keyword.type.go"
1416
        },
1417
        "2": {
1418
          "name": "punctuation.definition.begin.bracket.round.go"
1419
        }
1420
      },
1421
      "end": "\\)",
1422
      "endCaptures": {
1423
        "0": {
1424
          "name": "punctuation.definition.end.bracket.round.go"
1425
        }
1426
      },
1427
      "patterns": [
1428
        {
1429
          "include": "#struct_variables_types"
1430
        },
1431
        {
1432
          "include": "#interface_variables_types"
1433
        },
1434
        {
1435
          "include": "#type-declarations-without-brackets"
1436
        },
1437
        {
1438
          "include": "#parameter-variable-types"
1439
        },
1440
        {
1441
          "match": "\\w+",
1442
          "name": "entity.name.type.go"
1443
        }
1444
      ]
1445
    },
1446
    "numeric_literals": {
1447
      "captures": {
1448
        "0": {
1449
          "patterns": [
1450
            {
1451
              "begin": "(?=.)",
1452
              "end": "\\n|$",
1453
              "patterns": [
1454
                {
1455
                  "captures": {
1456
                    "1": {
1457
                      "name": "constant.numeric.decimal.go",
1458
                      "patterns": [
1459
                        {
1460
                          "match": "(?<=\\h)_(?=\\h)",
1461
                          "name": "punctuation.separator.constant.numeric.go"
1462
                        }
1463
                      ]
1464
                    },
1465
                    "10": {
1466
                      "name": "keyword.other.unit.imaginary.go"
1467
                    },
1468
                    "11": {
1469
                      "name": "constant.numeric.decimal.go",
1470
                      "patterns": [
1471
                        {
1472
                          "match": "(?<=\\h)_(?=\\h)",
1473
                          "name": "punctuation.separator.constant.numeric.go"
1474
                        }
1475
                      ]
1476
                    },
1477
                    "12": {
1478
                      "name": "punctuation.separator.constant.numeric.go"
1479
                    },
1480
                    "13": {
1481
                      "name": "keyword.other.unit.exponent.decimal.go"
1482
                    },
1483
                    "14": {
1484
                      "name": "keyword.operator.plus.exponent.decimal.go"
1485
                    },
1486
                    "15": {
1487
                      "name": "keyword.operator.minus.exponent.decimal.go"
1488
                    },
1489
                    "16": {
1490
                      "name": "constant.numeric.exponent.decimal.go",
1491
                      "patterns": [
1492
                        {
1493
                          "match": "(?<=\\h)_(?=\\h)",
1494
                          "name": "punctuation.separator.constant.numeric.go"
1495
                        }
1496
                      ]
1497
                    },
1498
                    "17": {
1499
                      "name": "keyword.other.unit.imaginary.go"
1500
                    },
1501
                    "18": {
1502
                      "name": "constant.numeric.decimal.point.go"
1503
                    },
1504
                    "19": {
1505
                      "name": "constant.numeric.decimal.go",
1506
                      "patterns": [
1507
                        {
1508
                          "match": "(?<=\\h)_(?=\\h)",
1509
                          "name": "punctuation.separator.constant.numeric.go"
1510
                        }
1511
                      ]
1512
                    },
1513
                    "2": {
1514
                      "name": "punctuation.separator.constant.numeric.go"
1515
                    },
1516
                    "20": {
1517
                      "name": "punctuation.separator.constant.numeric.go"
1518
                    },
1519
                    "21": {
1520
                      "name": "keyword.other.unit.exponent.decimal.go"
1521
                    },
1522
                    "22": {
1523
                      "name": "keyword.operator.plus.exponent.decimal.go"
1524
                    },
1525
                    "23": {
1526
                      "name": "keyword.operator.minus.exponent.decimal.go"
1527
                    },
1528
                    "24": {
1529
                      "name": "constant.numeric.exponent.decimal.go",
1530
                      "patterns": [
1531
                        {
1532
                          "match": "(?<=\\h)_(?=\\h)",
1533
                          "name": "punctuation.separator.constant.numeric.go"
1534
                        }
1535
                      ]
1536
                    },
1537
                    "25": {
1538
                      "name": "keyword.other.unit.imaginary.go"
1539
                    },
1540
                    "26": {
1541
                      "name": "keyword.other.unit.hexadecimal.go"
1542
                    },
1543
                    "27": {
1544
                      "name": "constant.numeric.hexadecimal.go",
1545
                      "patterns": [
1546
                        {
1547
                          "match": "(?<=\\h)_(?=\\h)",
1548
                          "name": "punctuation.separator.constant.numeric.go"
1549
                        }
1550
                      ]
1551
                    },
1552
                    "28": {
1553
                      "name": "punctuation.separator.constant.numeric.go"
1554
                    },
1555
                    "29": {
1556
                      "name": "constant.numeric.hexadecimal.go"
1557
                    },
1558
                    "3": {
1559
                      "name": "constant.numeric.decimal.point.go"
1560
                    },
1561
                    "30": {
1562
                      "name": "constant.numeric.hexadecimal.go",
1563
                      "patterns": [
1564
                        {
1565
                          "match": "(?<=\\h)_(?=\\h)",
1566
                          "name": "punctuation.separator.constant.numeric.go"
1567
                        }
1568
                      ]
1569
                    },
1570
                    "31": {
1571
                      "name": "punctuation.separator.constant.numeric.go"
1572
                    },
1573
                    "32": {
1574
                      "name": "keyword.other.unit.exponent.hexadecimal.go"
1575
                    },
1576
                    "33": {
1577
                      "name": "keyword.operator.plus.exponent.hexadecimal.go"
1578
                    },
1579
                    "34": {
1580
                      "name": "keyword.operator.minus.exponent.hexadecimal.go"
1581
                    },
1582
                    "35": {
1583
                      "name": "constant.numeric.exponent.hexadecimal.go",
1584
                      "patterns": [
1585
                        {
1586
                          "match": "(?<=\\h)_(?=\\h)",
1587
                          "name": "punctuation.separator.constant.numeric.go"
1588
                        }
1589
                      ]
1590
                    },
1591
                    "36": {
1592
                      "name": "keyword.other.unit.imaginary.go"
1593
                    },
1594
                    "37": {
1595
                      "name": "keyword.other.unit.hexadecimal.go"
1596
                    },
1597
                    "38": {
1598
                      "name": "constant.numeric.hexadecimal.go",
1599
                      "patterns": [
1600
                        {
1601
                          "match": "(?<=\\h)_(?=\\h)",
1602
                          "name": "punctuation.separator.constant.numeric.go"
1603
                        }
1604
                      ]
1605
                    },
1606
                    "39": {
1607
                      "name": "punctuation.separator.constant.numeric.go"
1608
                    },
1609
                    "4": {
1610
                      "name": "constant.numeric.decimal.go",
1611
                      "patterns": [
1612
                        {
1613
                          "match": "(?<=\\h)_(?=\\h)",
1614
                          "name": "punctuation.separator.constant.numeric.go"
1615
                        }
1616
                      ]
1617
                    },
1618
                    "40": {
1619
                      "name": "keyword.other.unit.exponent.hexadecimal.go"
1620
                    },
1621
                    "41": {
1622
                      "name": "keyword.operator.plus.exponent.hexadecimal.go"
1623
                    },
1624
                    "42": {
1625
                      "name": "keyword.operator.minus.exponent.hexadecimal.go"
1626
                    },
1627
                    "43": {
1628
                      "name": "constant.numeric.exponent.hexadecimal.go",
1629
                      "patterns": [
1630
                        {
1631
                          "match": "(?<=\\h)_(?=\\h)",
1632
                          "name": "punctuation.separator.constant.numeric.go"
1633
                        }
1634
                      ]
1635
                    },
1636
                    "44": {
1637
                      "name": "keyword.other.unit.imaginary.go"
1638
                    },
1639
                    "45": {
1640
                      "name": "keyword.other.unit.hexadecimal.go"
1641
                    },
1642
                    "46": {
1643
                      "name": "constant.numeric.hexadecimal.go"
1644
                    },
1645
                    "47": {
1646
                      "name": "constant.numeric.hexadecimal.go",
1647
                      "patterns": [
1648
                        {
1649
                          "match": "(?<=\\h)_(?=\\h)",
1650
                          "name": "punctuation.separator.constant.numeric.go"
1651
                        }
1652
                      ]
1653
                    },
1654
                    "48": {
1655
                      "name": "punctuation.separator.constant.numeric.go"
1656
                    },
1657
                    "49": {
1658
                      "name": "keyword.other.unit.exponent.hexadecimal.go"
1659
                    },
1660
                    "5": {
1661
                      "name": "punctuation.separator.constant.numeric.go"
1662
                    },
1663
                    "50": {
1664
                      "name": "keyword.operator.plus.exponent.hexadecimal.go"
1665
                    },
1666
                    "51": {
1667
                      "name": "keyword.operator.minus.exponent.hexadecimal.go"
1668
                    },
1669
                    "52": {
1670
                      "name": "constant.numeric.exponent.hexadecimal.go",
1671
                      "patterns": [
1672
                        {
1673
                          "match": "(?<=\\h)_(?=\\h)",
1674
                          "name": "punctuation.separator.constant.numeric.go"
1675
                        }
1676
                      ]
1677
                    },
1678
                    "53": {
1679
                      "name": "keyword.other.unit.imaginary.go"
1680
                    },
1681
                    "6": {
1682
                      "name": "keyword.other.unit.exponent.decimal.go"
1683
                    },
1684
                    "7": {
1685
                      "name": "keyword.operator.plus.exponent.decimal.go"
1686
                    },
1687
                    "8": {
1688
                      "name": "keyword.operator.minus.exponent.decimal.go"
1689
                    },
1690
                    "9": {
1691
                      "name": "constant.numeric.exponent.decimal.go",
1692
                      "patterns": [
1693
                        {
1694
                          "match": "(?<=\\h)_(?=\\h)",
1695
                          "name": "punctuation.separator.constant.numeric.go"
1696
                        }
1697
                      ]
1698
                    }
1699
                  },
1700
                  "match": "\\G(?:(?:(?:(?:(?:(?=[.0-9])(?!0[BOXbox])([0-9](?:[0-9]|((?<=\\h)_(?=\\h)))*)((?<=[0-9])\\.|\\.(?=[0-9]))([0-9](?:[0-9]|((?<=\\h)_(?=\\h)))*)?(?:(?<!_)([Ee])(\\+?)(-?)([0-9](?:[0-9]|(?<=\\h)_(?=\\h))*))?(i(?!\\w))?(?:\\n|$)|(?=[.0-9])(?!0[BOXbox])([0-9](?:[0-9]|((?<=\\h)_(?=\\h)))*)(?<!_)([Ee])(\\+?)(-?)([0-9](?:[0-9]|(?<=\\h)_(?=\\h))*)(i(?!\\w))?(?:\\n|$))|((?<=[0-9])\\.|\\.(?=[0-9]))([0-9](?:[0-9]|((?<=\\h)_(?=\\h)))*)(?:(?<!_)([Ee])(\\+?)(-?)([0-9](?:[0-9]|(?<=\\h)_(?=\\h))*))?(i(?!\\w))?(?:\\n|$))|(0[Xx])_?(\\h(?:\\h|((?<=\\h)_(?=\\h)))*)((?<=\\h)\\.|\\.(?=\\h))(\\h(?:\\h|((?<=\\h)_(?=\\h)))*)?(?<!_)([Pp])(\\+?)(-?)([0-9](?:[0-9]|(?<=\\h)_(?=\\h))*)(i(?!\\w))?(?:\\n|$))|(0[Xx])_?(\\h(?:\\h|((?<=\\h)_(?=\\h)))*)(?<!_)([Pp])(\\+?)(-?)([0-9](?:[0-9]|(?<=\\h)_(?=\\h))*)(i(?!\\w))?(?:\\n|$))|(0[Xx])((?<=\\h)\\.|\\.(?=\\h))(\\h(?:\\h|((?<=\\h)_(?=\\h)))*)(?<!_)([Pp])(\\+?)(-?)([0-9](?:[0-9]|(?<=\\h)_(?=\\h))*)(i(?!\\w))?(?:\\n|$))"
1701
                },
1702
                {
1703
                  "captures": {
1704
                    "1": {
1705
                      "name": "constant.numeric.decimal.go",
1706
                      "patterns": [
1707
                        {
1708
                          "match": "(?<=\\h)_(?=\\h)",
1709
                          "name": "punctuation.separator.constant.numeric.go"
1710
                        }
1711
                      ]
1712
                    },
1713
                    "10": {
1714
                      "name": "punctuation.separator.constant.numeric.go"
1715
                    },
1716
                    "11": {
1717
                      "name": "keyword.other.unit.imaginary.go"
1718
                    },
1719
                    "12": {
1720
                      "name": "keyword.other.unit.hexadecimal.go"
1721
                    },
1722
                    "13": {
1723
                      "name": "constant.numeric.hexadecimal.go",
1724
                      "patterns": [
1725
                        {
1726
                          "match": "(?<=\\h)_(?=\\h)",
1727
                          "name": "punctuation.separator.constant.numeric.go"
1728
                        }
1729
                      ]
1730
                    },
1731
                    "14": {
1732
                      "name": "punctuation.separator.constant.numeric.go"
1733
                    },
1734
                    "15": {
1735
                      "name": "keyword.other.unit.imaginary.go"
1736
                    },
1737
                    "2": {
1738
                      "name": "punctuation.separator.constant.numeric.go"
1739
                    },
1740
                    "3": {
1741
                      "name": "keyword.other.unit.imaginary.go"
1742
                    },
1743
                    "4": {
1744
                      "name": "keyword.other.unit.binary.go"
1745
                    },
1746
                    "5": {
1747
                      "name": "constant.numeric.binary.go",
1748
                      "patterns": [
1749
                        {
1750
                          "match": "(?<=\\h)_(?=\\h)",
1751
                          "name": "punctuation.separator.constant.numeric.go"
1752
                        }
1753
                      ]
1754
                    },
1755
                    "6": {
1756
                      "name": "punctuation.separator.constant.numeric.go"
1757
                    },
1758
                    "7": {
1759
                      "name": "keyword.other.unit.imaginary.go"
1760
                    },
1761
                    "8": {
1762
                      "name": "keyword.other.unit.octal.go"
1763
                    },
1764
                    "9": {
1765
                      "name": "constant.numeric.octal.go",
1766
                      "patterns": [
1767
                        {
1768
                          "match": "(?<=\\h)_(?=\\h)",
1769
                          "name": "punctuation.separator.constant.numeric.go"
1770
                        }
1771
                      ]
1772
                    }
1773
                  },
1774
                  "match": "\\G(?:(?:(?:(?=[.0-9])(?!0[BOXbox])([0-9](?:[0-9]|((?<=\\h)_(?=\\h)))*)(i(?!\\w))?(?:\\n|$)|(0[Bb])_?([01](?:[01]|((?<=\\h)_(?=\\h)))*)(i(?!\\w))?(?:\\n|$))|(0[Oo]?)_?((?:[0-7]|((?<=\\h)_(?=\\h)))+)(i(?!\\w))?(?:\\n|$))|(0[Xx])_?(\\h(?:\\h|((?<=\\h)_(?=\\h)))*)(i(?!\\w))?(?:\\n|$))"
1775
                },
1776
                {
1777
                  "match": "(?:[.0-9A-Z_a-z]|(?<=[EPep])[-+])+",
1778
                  "name": "invalid.illegal.constant.numeric.go"
1779
                }
1780
              ]
1781
            }
1782
          ]
1783
        }
1784
      },
1785
      "match": "(?<!\\w)\\.?\\d(?:[.0-9A-Z_a-z]|(?<=[EPep])[-+])*"
1786
    },
1787
    "operators": {
1788
      "patterns": [
1789
        {
1790
          "match": "(?<!\\w)[\\&*]+(?!\\d)(?=[]\\[\\w]|<-)",
1791
          "name": "keyword.operator.address.go"
1792
        },
1793
        {
1794
          "match": "<-",
1795
          "name": "keyword.operator.channel.go"
1796
        },
1797
        {
1798
          "match": "--",
1799
          "name": "keyword.operator.decrement.go"
1800
        },
1801
        {
1802
          "match": "\\+\\+",
1803
          "name": "keyword.operator.increment.go"
1804
        },
1805
        {
1806
          "match": "(==|!=|<=|>=|<(?!<)|>(?!>))",
1807
          "name": "keyword.operator.comparison.go"
1808
        },
1809
        {
1810
          "match": "(&&|\\|\\||!)",
1811
          "name": "keyword.operator.logical.go"
1812
        },
1813
        {
1814
          "match": "((?:|[-%*+/:^|]|<<|>>|&\\^?)=)",
1815
          "name": "keyword.operator.assignment.go"
1816
        },
1817
        {
1818
          "match": "([-%*+/])",
1819
          "name": "keyword.operator.arithmetic.go"
1820
        },
1821
        {
1822
          "match": "(&(?!\\^)|[\\^|]|&\\^|<<|>>|~)",
1823
          "name": "keyword.operator.arithmetic.bitwise.go"
1824
        },
1825
        {
1826
          "match": "\\.\\.\\.",
1827
          "name": "keyword.operator.ellipsis.go"
1828
        }
1829
      ]
1830
    },
1831
    "other_struct_interface_expressions": {
1832
      "patterns": [
1833
        {
1834
          "include": "#after_control_variables"
1835
        },
1836
        {
1837
          "captures": {
1838
            "1": {
1839
              "patterns": [
1840
                {
1841
                  "include": "#type-declarations"
1842
                },
1843
                {
1844
                  "match": "\\w+",
1845
                  "name": "entity.name.type.go"
1846
                }
1847
              ]
1848
            },
1849
            "2": {
1850
              "patterns": [
1851
                {
1852
                  "include": "#type-declarations-without-brackets"
1853
                },
1854
                {
1855
                  "match": "\\[",
1856
                  "name": "punctuation.definition.begin.bracket.square.go"
1857
                },
1858
                {
1859
                  "match": "]",
1860
                  "name": "punctuation.definition.end.bracket.square.go"
1861
                },
1862
                {
1863
                  "match": "\\{",
1864
                  "name": "punctuation.definition.begin.bracket.curly.go"
1865
                },
1866
                {
1867
                  "match": "}",
1868
                  "name": "punctuation.definition.end.bracket.curly.go"
1869
                },
1870
                {
1871
                  "match": "\\w+",
1872
                  "name": "entity.name.type.go"
1873
                }
1874
              ]
1875
            }
1876
          },
1877
          "match": "\\b(?!(?:struct|interface)\\b)([.\\w]+)(?<brackets>\\[(?:[^]\\[]|\\g<brackets>)*])?(?=\\{)"
1878
        }
1879
      ]
1880
    },
1881
    "other_variables": {
1882
      "match": "\\w+",
1883
      "name": "variable.other.go"
1884
    },
1885
    "package_name": {
1886
      "patterns": [
1887
        {
1888
          "begin": "\\b(package)\\s+",
1889
          "beginCaptures": {
1890
            "1": {
1891
              "name": "keyword.package.go"
1892
            }
1893
          },
1894
          "end": "(?!\\G)",
1895
          "patterns": [
1896
            {
1897
              "match": "\\d\\w*",
1898
              "name": "invalid.illegal.identifier.go"
1899
            },
1900
            {
1901
              "match": "\\w+",
1902
              "name": "entity.name.type.package.go"
1903
            }
1904
          ]
1905
        }
1906
      ]
1907
    },
1908
    "parameter-variable-types": {
1909
      "patterns": [
1910
        {
1911
          "match": "\\{",
1912
          "name": "punctuation.definition.begin.bracket.curly.go"
1913
        },
1914
        {
1915
          "match": "}",
1916
          "name": "punctuation.definition.end.bracket.curly.go"
1917
        },
1918
        {
1919
          "begin": "([*.\\w]+)?(\\[)",
1920
          "beginCaptures": {
1921
            "1": {
1922
              "patterns": [
1923
                {
1924
                  "include": "#type-declarations"
1925
                },
1926
                {
1927
                  "match": "\\w+",
1928
                  "name": "entity.name.type.go"
1929
                }
1930
              ]
1931
            },
1932
            "2": {
1933
              "name": "punctuation.definition.begin.bracket.square.go"
1934
            }
1935
          },
1936
          "end": "]",
1937
          "endCaptures": {
1938
            "0": {
1939
              "name": "punctuation.definition.end.bracket.square.go"
1940
            }
1941
          },
1942
          "patterns": [
1943
            {
1944
              "include": "#generic_param_types"
1945
            }
1946
          ]
1947
        },
1948
        {
1949
          "begin": "\\(",
1950
          "beginCaptures": {
1951
            "0": {
1952
              "name": "punctuation.definition.begin.bracket.round.go"
1953
            }
1954
          },
1955
          "end": "\\)",
1956
          "endCaptures": {
1957
            "0": {
1958
              "name": "punctuation.definition.end.bracket.round.go"
1959
            }
1960
          },
1961
          "patterns": [
1962
            {
1963
              "include": "#function_param_types"
1964
            }
1965
          ]
1966
        }
1967
      ]
1968
    },
1969
    "property_variables": {
1970
      "captures": {
1971
        "1": {
1972
          "patterns": [
1973
            {
1974
              "include": "#type-declarations"
1975
            },
1976
            {
1977
              "match": "\\w+",
1978
              "name": "variable.other.property.go"
1979
            }
1980
          ]
1981
        }
1982
      },
1983
      "match": "\\b([.\\w]+:(?!=))"
1984
    },
1985
    "raw_string_literals": {
1986
      "begin": "`",
1987
      "beginCaptures": {
1988
        "0": {
1989
          "name": "punctuation.definition.string.begin.go"
1990
        }
1991
      },
1992
      "end": "`",
1993
      "endCaptures": {
1994
        "0": {
1995
          "name": "punctuation.definition.string.end.go"
1996
        }
1997
      },
1998
      "name": "string.quoted.raw.go",
1999
      "patterns": [
2000
        {
2001
          "include": "#string_placeholder"
2002
        }
2003
      ]
2004
    },
2005
    "runes": {
2006
      "patterns": [
2007
        {
2008
          "begin": "'",
2009
          "beginCaptures": {
2010
            "0": {
2011
              "name": "punctuation.definition.string.begin.go"
2012
            }
2013
          },
2014
          "end": "'",
2015
          "endCaptures": {
2016
            "0": {
2017
              "name": "punctuation.definition.string.end.go"
2018
            }
2019
          },
2020
          "name": "string.quoted.rune.go",
2021
          "patterns": [
2022
            {
2023
              "match": "\\G(\\\\([0-7]{3}|[\"'\\\\abfnrtv]|x\\h{2}|u\\h{4}|U\\h{8})|.)(?=')",
2024
              "name": "constant.other.rune.go"
2025
            },
2026
            {
2027
              "match": "[^']+",
2028
              "name": "invalid.illegal.unknown-rune.go"
2029
            }
2030
          ]
2031
        }
2032
      ]
2033
    },
2034
    "single_type": {
2035
      "patterns": [
2036
        {
2037
          "captures": {
2038
            "1": {
2039
              "name": "keyword.type.go"
2040
            },
2041
            "2": {
2042
              "patterns": [
2043
                {
2044
                  "include": "#type-declarations"
2045
                },
2046
                {
2047
                  "match": "\\w+",
2048
                  "name": "entity.name.type.go"
2049
                }
2050
              ]
2051
            },
2052
            "3": {
2053
              "patterns": [
2054
                {
2055
                  "begin": "\\(",
2056
                  "beginCaptures": {
2057
                    "0": {
2058
                      "name": "punctuation.definition.begin.bracket.round.go"
2059
                    }
2060
                  },
2061
                  "end": "\\)",
2062
                  "endCaptures": {
2063
                    "0": {
2064
                      "name": "punctuation.definition.end.bracket.round.go"
2065
                    }
2066
                  },
2067
                  "patterns": [
2068
                    {
2069
                      "include": "#function_param_types"
2070
                    },
2071
                    {
2072
                      "include": "$self"
2073
                    }
2074
                  ]
2075
                },
2076
                {
2077
                  "include": "#type-declarations"
2078
                },
2079
                {
2080
                  "include": "#generic_types"
2081
                },
2082
                {
2083
                  "match": "\\w+",
2084
                  "name": "entity.name.type.go"
2085
                }
2086
              ]
2087
            }
2088
          },
2089
          "match": "^\\s*\\b(type)\\b\\s*([*.\\w]+)\\s+(?!(?:=\\s*)?[]*\\[]+{0,1}\\b(?:struct|interface)\\b)([\\s\\S]+)"
2090
        },
2091
        {
2092
          "begin": "(?:^|\\s+)\\b(type)\\b\\s*([*.\\w]+)(?=\\[)",
2093
          "beginCaptures": {
2094
            "1": {
2095
              "name": "keyword.type.go"
2096
            },
2097
            "2": {
2098
              "patterns": [
2099
                {
2100
                  "include": "#type-declarations-without-brackets"
2101
                },
2102
                {
2103
                  "match": "\\w+",
2104
                  "name": "entity.name.type.go"
2105
                }
2106
              ]
2107
            }
2108
          },
2109
          "end": "(?<=])(\\s+(?:=\\s*)?(?:[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}(?![]*\\[]+{0,1}\\b(?:struct|interface|func)\\b)[-\\]*.\\[\\w]+(?:,\\s*[]*.\\[\\w]+)*)?",
2110
          "endCaptures": {
2111
            "1": {
2112
              "patterns": [
2113
                {
2114
                  "include": "#type-declarations-without-brackets"
2115
                },
2116
                {
2117
                  "match": "\\[",
2118
                  "name": "punctuation.definition.begin.bracket.square.go"
2119
                },
2120
                {
2121
                  "match": "]",
2122
                  "name": "punctuation.definition.end.bracket.square.go"
2123
                },
2124
                {
2125
                  "match": "\\w+",
2126
                  "name": "entity.name.type.go"
2127
                }
2128
              ]
2129
            }
2130
          },
2131
          "patterns": [
2132
            {
2133
              "include": "#struct_variables_types"
2134
            },
2135
            {
2136
              "include": "#type-declarations-without-brackets"
2137
            },
2138
            {
2139
              "include": "#parameter-variable-types"
2140
            },
2141
            {
2142
              "match": "\\[",
2143
              "name": "punctuation.definition.begin.bracket.square.go"
2144
            },
2145
            {
2146
              "match": "]",
2147
              "name": "punctuation.definition.end.bracket.square.go"
2148
            },
2149
            {
2150
              "match": "\\{",
2151
              "name": "punctuation.definition.begin.bracket.curly.go"
2152
            },
2153
            {
2154
              "match": "}",
2155
              "name": "punctuation.definition.end.bracket.curly.go"
2156
            },
2157
            {
2158
              "match": "\\(",
2159
              "name": "punctuation.definition.begin.bracket.round.go"
2160
            },
2161
            {
2162
              "match": "\\)",
2163
              "name": "punctuation.definition.end.bracket.round.go"
2164
            },
2165
            {
2166
              "match": "\\w+",
2167
              "name": "entity.name.type.go"
2168
            }
2169
          ]
2170
        }
2171
      ]
2172
    },
2173
    "slice_index_variables": {
2174
      "captures": {
2175
        "1": {
2176
          "patterns": [
2177
            {
2178
              "include": "#type-declarations"
2179
            },
2180
            {
2181
              "match": "\\w+",
2182
              "name": "variable.other.go"
2183
            }
2184
          ]
2185
        }
2186
      },
2187
      "match": "(?<=\\w\\[)((?:\\b[-%\\&*+./<>|\\w]+:|:\\b[-%\\&*+./<>|\\w]+)(?:\\b[-%\\&*+./<>|\\w]+)?(?::\\b[-%\\&*+./<>|\\w]+)?)(?=])"
2188
    },
2189
    "statements": {
2190
      "patterns": [
2191
        {
2192
          "include": "#package_name"
2193
        },
2194
        {
2195
          "include": "#import"
2196
        },
2197
        {
2198
          "include": "#syntax_errors"
2199
        },
2200
        {
2201
          "include": "#group-functions"
2202
        },
2203
        {
2204
          "include": "#group-types"
2205
        },
2206
        {
2207
          "include": "#group-variables"
2208
        },
2209
        {
2210
          "include": "#hover"
2211
        }
2212
      ]
2213
    },
2214
    "storage_types": {
2215
      "patterns": [
2216
        {
2217
          "match": "\\bbool\\b",
2218
          "name": "storage.type.boolean.go"
2219
        },
2220
        {
2221
          "match": "\\bbyte\\b",
2222
          "name": "storage.type.byte.go"
2223
        },
2224
        {
2225
          "match": "\\berror\\b",
2226
          "name": "storage.type.error.go"
2227
        },
2228
        {
2229
          "match": "\\b(complex(64|128)|float(32|64)|u?int(8|16|32|64)?)\\b",
2230
          "name": "storage.type.numeric.go"
2231
        },
2232
        {
2233
          "match": "\\brune\\b",
2234
          "name": "storage.type.rune.go"
2235
        },
2236
        {
2237
          "match": "\\bstring\\b",
2238
          "name": "storage.type.string.go"
2239
        },
2240
        {
2241
          "match": "\\buintptr\\b",
2242
          "name": "storage.type.uintptr.go"
2243
        },
2244
        {
2245
          "match": "\\bany\\b",
2246
          "name": "entity.name.type.any.go"
2247
        },
2248
        {
2249
          "match": "\\bcomparable\\b",
2250
          "name": "entity.name.type.comparable.go"
2251
        }
2252
      ]
2253
    },
2254
    "string_escaped_char": {
2255
      "patterns": [
2256
        {
2257
          "match": "\\\\([0-7]{3}|[\"'\\\\abfnrtv]|x\\h{2}|u\\h{4}|U\\h{8})",
2258
          "name": "constant.character.escape.go"
2259
        },
2260
        {
2261
          "match": "\\\\[^\"'0-7Uabfnrtuvx]",
2262
          "name": "invalid.illegal.unknown-escape.go"
2263
        }
2264
      ]
2265
    },
2266
    "string_literals": {
2267
      "patterns": [
2268
        {
2269
          "begin": "\"",
2270
          "beginCaptures": {
2271
            "0": {
2272
              "name": "punctuation.definition.string.begin.go"
2273
            }
2274
          },
2275
          "end": "\"",
2276
          "endCaptures": {
2277
            "0": {
2278
              "name": "punctuation.definition.string.end.go"
2279
            }
2280
          },
2281
          "name": "string.quoted.double.go",
2282
          "patterns": [
2283
            {
2284
              "include": "#string_escaped_char"
2285
            },
2286
            {
2287
              "include": "#string_placeholder"
2288
            }
2289
          ]
2290
        }
2291
      ]
2292
    },
2293
    "string_placeholder": {
2294
      "patterns": [
2295
        {
2296
          "match": "%(\\[\\d+])?([- #+0]{0,2}((\\d+|\\*)?(\\.?(\\d+|\\*|(\\[\\d+])\\*?)?(\\[\\d+])?)?))?[%EFGTUXb-gopqstvwx]",
2297
          "name": "constant.other.placeholder.go"
2298
        }
2299
      ]
2300
    },
2301
    "struct_interface_declaration": {
2302
      "captures": {
2303
        "1": {
2304
          "name": "keyword.type.go"
2305
        },
2306
        "2": {
2307
          "patterns": [
2308
            {
2309
              "include": "#type-declarations"
2310
            },
2311
            {
2312
              "match": "\\w+",
2313
              "name": "entity.name.type.go"
2314
            }
2315
          ]
2316
        }
2317
      },
2318
      "match": "^\\s*\\b(type)\\b\\s*([.\\w]+)"
2319
    },
2320
    "struct_variable_types_fields_multi": {
2321
      "patterns": [
2322
        {
2323
          "begin": "\\b(\\w+(?:,\\s*\\b\\w+)*(?:\\s*[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}\\s*[]*\\[]+{0,1})\\b(struct)\\b\\s*(\\{)",
2324
          "beginCaptures": {
2325
            "1": {
2326
              "patterns": [
2327
                {
2328
                  "include": "#type-declarations"
2329
                },
2330
                {
2331
                  "match": "\\w+",
2332
                  "name": "variable.other.property.go"
2333
                }
2334
              ]
2335
            },
2336
            "2": {
2337
              "name": "keyword.struct.go"
2338
            },
2339
            "3": {
2340
              "name": "punctuation.definition.begin.bracket.curly.go"
2341
            }
2342
          },
2343
          "end": "}",
2344
          "endCaptures": {
2345
            "0": {
2346
              "name": "punctuation.definition.end.bracket.curly.go"
2347
            }
2348
          },
2349
          "patterns": [
2350
            {
2351
              "include": "#struct_variables_types_fields"
2352
            },
2353
            {
2354
              "include": "$self"
2355
            }
2356
          ]
2357
        },
2358
        {
2359
          "begin": "\\b(\\w+(?:,\\s*\\b\\w+)*(?:\\s*[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}\\s*[]*\\[]+{0,1})\\b(interface)\\b\\s*(\\{)",
2360
          "beginCaptures": {
2361
            "1": {
2362
              "patterns": [
2363
                {
2364
                  "include": "#type-declarations"
2365
                },
2366
                {
2367
                  "match": "\\w+",
2368
                  "name": "variable.other.property.go"
2369
                }
2370
              ]
2371
            },
2372
            "2": {
2373
              "name": "keyword.interface.go"
2374
            },
2375
            "3": {
2376
              "name": "punctuation.definition.begin.bracket.curly.go"
2377
            }
2378
          },
2379
          "end": "}",
2380
          "endCaptures": {
2381
            "0": {
2382
              "name": "punctuation.definition.end.bracket.curly.go"
2383
            }
2384
          },
2385
          "patterns": [
2386
            {
2387
              "include": "#interface_variables_types_field"
2388
            },
2389
            {
2390
              "include": "$self"
2391
            }
2392
          ]
2393
        },
2394
        {
2395
          "begin": "\\b(\\w+(?:,\\s*\\b\\w+)*(?:\\s*[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}\\s*[]*\\[]+{0,1})\\b(func)\\b\\s*(\\()",
2396
          "beginCaptures": {
2397
            "1": {
2398
              "patterns": [
2399
                {
2400
                  "include": "#type-declarations"
2401
                },
2402
                {
2403
                  "match": "\\w+",
2404
                  "name": "variable.other.property.go"
2405
                }
2406
              ]
2407
            },
2408
            "2": {
2409
              "name": "keyword.function.go"
2410
            },
2411
            "3": {
2412
              "name": "punctuation.definition.begin.bracket.round.go"
2413
            }
2414
          },
2415
          "end": "\\)",
2416
          "endCaptures": {
2417
            "0": {
2418
              "name": "punctuation.definition.end.bracket.round.go"
2419
            }
2420
          },
2421
          "patterns": [
2422
            {
2423
              "include": "#function_param_types"
2424
            },
2425
            {
2426
              "include": "$self"
2427
            }
2428
          ]
2429
        },
2430
        {
2431
          "include": "#parameter-variable-types"
2432
        }
2433
      ]
2434
    },
2435
    "struct_variables_types": {
2436
      "begin": "\\b(struct)\\b\\s*(\\{)",
2437
      "beginCaptures": {
2438
        "1": {
2439
          "name": "keyword.struct.go"
2440
        },
2441
        "2": {
2442
          "name": "punctuation.definition.begin.bracket.curly.go"
2443
        }
2444
      },
2445
      "end": "}",
2446
      "endCaptures": {
2447
        "0": {
2448
          "name": "punctuation.definition.end.bracket.curly.go"
2449
        }
2450
      },
2451
      "patterns": [
2452
        {
2453
          "include": "#struct_variables_types_fields"
2454
        },
2455
        {
2456
          "include": "$self"
2457
        }
2458
      ]
2459
    },
2460
    "struct_variables_types_fields": {
2461
      "patterns": [
2462
        {
2463
          "include": "#struct_variable_types_fields_multi"
2464
        },
2465
        {
2466
          "captures": {
2467
            "1": {
2468
              "patterns": [
2469
                {
2470
                  "include": "#type-declarations"
2471
                },
2472
                {
2473
                  "match": "\\w+",
2474
                  "name": "entity.name.type.go"
2475
                }
2476
              ]
2477
            }
2478
          },
2479
          "match": "(?<=\\{)\\s*((?:\\s*[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}[]*.\\[\\w]+)\\s*(?=})"
2480
        },
2481
        {
2482
          "captures": {
2483
            "1": {
2484
              "patterns": [
2485
                {
2486
                  "include": "#type-declarations"
2487
                },
2488
                {
2489
                  "match": "\\w+",
2490
                  "name": "variable.other.property.go"
2491
                }
2492
              ]
2493
            },
2494
            "2": {
2495
              "patterns": [
2496
                {
2497
                  "include": "#type-declarations"
2498
                },
2499
                {
2500
                  "match": "\\w+",
2501
                  "name": "entity.name.type.go"
2502
                }
2503
              ]
2504
            }
2505
          },
2506
          "match": "(?<=\\{)\\s*((?:\\w+,\\s*)+{0,1}\\w+\\s+)((?:\\s*[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}[]*.\\[\\w]+)\\s*(?=})"
2507
        },
2508
        {
2509
          "captures": {
2510
            "1": {
2511
              "patterns": [
2512
                {
2513
                  "captures": {
2514
                    "1": {
2515
                      "patterns": [
2516
                        {
2517
                          "include": "#type-declarations"
2518
                        },
2519
                        {
2520
                          "match": "\\w+",
2521
                          "name": "variable.other.property.go"
2522
                        }
2523
                      ]
2524
                    },
2525
                    "2": {
2526
                      "patterns": [
2527
                        {
2528
                          "include": "#type-declarations"
2529
                        },
2530
                        {
2531
                          "match": "\\w+",
2532
                          "name": "entity.name.type.go"
2533
                        }
2534
                      ]
2535
                    }
2536
                  },
2537
                  "match": "((?:\\w+,\\s*)+{0,1}\\w+\\s+)?((?:\\s*[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}[^\"/`\\s]+;?)"
2538
                }
2539
              ]
2540
            }
2541
          },
2542
          "match": "(?<=\\{)((?:\\s*(?:(?:\\w+,\\s*)+{0,1}\\w+\\s+)?(?:\\s*[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}[^\"/`\\s]+;?)+)\\s*(?=})"
2543
        },
2544
        {
2545
          "captures": {
2546
            "1": {
2547
              "patterns": [
2548
                {
2549
                  "include": "#type-declarations"
2550
                },
2551
                {
2552
                  "match": "\\w+",
2553
                  "name": "entity.name.type.go"
2554
                }
2555
              ]
2556
            }
2557
          },
2558
          "match": "((?:\\s*[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}[*.\\w]+\\s*)(?:(?=[\"/`])|$)"
2559
        },
2560
        {
2561
          "captures": {
2562
            "1": {
2563
              "patterns": [
2564
                {
2565
                  "include": "#type-declarations"
2566
                },
2567
                {
2568
                  "match": "\\w+",
2569
                  "name": "variable.other.property.go"
2570
                }
2571
              ]
2572
            },
2573
            "2": {
2574
              "patterns": [
2575
                {
2576
                  "include": "#type-declarations-without-brackets"
2577
                },
2578
                {
2579
                  "include": "#parameter-variable-types"
2580
                },
2581
                {
2582
                  "match": "\\w+",
2583
                  "name": "entity.name.type.go"
2584
                }
2585
              ]
2586
            }
2587
          },
2588
          "match": "\\b(\\w+(?:\\s*,\\s*\\b\\w+)*)\\s*([^\"/`]+)"
2589
        }
2590
      ]
2591
    },
2592
    "support_functions": {
2593
      "captures": {
2594
        "1": {
2595
          "name": "entity.name.function.support.go"
2596
        },
2597
        "2": {
2598
          "patterns": [
2599
            {
2600
              "include": "#type-declarations"
2601
            },
2602
            {
2603
              "match": "\\d\\w*",
2604
              "name": "invalid.illegal.identifier.go"
2605
            },
2606
            {
2607
              "match": "\\w+",
2608
              "name": "entity.name.function.support.go"
2609
            }
2610
          ]
2611
        },
2612
        "3": {
2613
          "patterns": [
2614
            {
2615
              "include": "#type-declarations-without-brackets"
2616
            },
2617
            {
2618
              "match": "\\[",
2619
              "name": "punctuation.definition.begin.bracket.square.go"
2620
            },
2621
            {
2622
              "match": "]",
2623
              "name": "punctuation.definition.end.bracket.square.go"
2624
            },
2625
            {
2626
              "match": "\\{",
2627
              "name": "punctuation.definition.begin.bracket.curly.go"
2628
            },
2629
            {
2630
              "match": "}",
2631
              "name": "punctuation.definition.end.bracket.curly.go"
2632
            },
2633
            {
2634
              "match": "\\w+",
2635
              "name": "entity.name.type.go"
2636
            }
2637
          ]
2638
        }
2639
      },
2640
      "match": "(?:((?<=\\.)\\b\\w+)|\\b(\\w+))(?<brackets>\\[(?:[^]\\[]|\\g<brackets>)*])?(?=\\()"
2641
    },
2642
    "switch_types": {
2643
      "begin": "(?<=\\bswitch\\b)\\s*(\\w+\\s*:=)?\\s*([-\\]%\\&(-+./<>\\[|\\w]+)(\\.\\(\\btype\\b\\)\\s*)(\\{)",
2644
      "beginCaptures": {
2645
        "1": {
2646
          "patterns": [
2647
            {
2648
              "include": "#operators"
2649
            },
2650
            {
2651
              "match": "\\w+",
2652
              "name": "variable.other.assignment.go"
2653
            }
2654
          ]
2655
        },
2656
        "2": {
2657
          "patterns": [
2658
            {
2659
              "include": "#support_functions"
2660
            },
2661
            {
2662
              "include": "#type-declarations"
2663
            },
2664
            {
2665
              "match": "\\w+",
2666
              "name": "variable.other.go"
2667
            }
2668
          ]
2669
        },
2670
        "3": {
2671
          "patterns": [
2672
            {
2673
              "include": "#delimiters"
2674
            },
2675
            {
2676
              "include": "#brackets"
2677
            },
2678
            {
2679
              "match": "\\btype\\b",
2680
              "name": "keyword.type.go"
2681
            }
2682
          ]
2683
        },
2684
        "4": {
2685
          "name": "punctuation.definition.begin.bracket.curly.go"
2686
        }
2687
      },
2688
      "end": "}",
2689
      "endCaptures": {
2690
        "0": {
2691
          "name": "punctuation.definition.end.bracket.curly.go"
2692
        }
2693
      },
2694
      "patterns": [
2695
        {
2696
          "captures": {
2697
            "1": {
2698
              "name": "keyword.control.go"
2699
            },
2700
            "2": {
2701
              "patterns": [
2702
                {
2703
                  "include": "#type-declarations"
2704
                },
2705
                {
2706
                  "match": "\\w+",
2707
                  "name": "entity.name.type.go"
2708
                }
2709
              ]
2710
            },
2711
            "3": {
2712
              "name": "punctuation.other.colon.go"
2713
            },
2714
            "4": {
2715
              "patterns": [
2716
                {
2717
                  "include": "#comments"
2718
                }
2719
              ]
2720
            }
2721
          },
2722
          "match": "^\\s*\\b(case)\\b\\s+([!*,.<=>\\w\\s]+)(:)(\\s*/[*/]\\s*.*)?$"
2723
        },
2724
        {
2725
          "begin": "\\bcase\\b",
2726
          "beginCaptures": {
2727
            "0": {
2728
              "name": "keyword.control.go"
2729
            }
2730
          },
2731
          "end": ":",
2732
          "endCaptures": {
2733
            "0": {
2734
              "name": "punctuation.other.colon.go"
2735
            }
2736
          },
2737
          "patterns": [
2738
            {
2739
              "include": "#type-declarations"
2740
            },
2741
            {
2742
              "match": "\\w+",
2743
              "name": "entity.name.type.go"
2744
            }
2745
          ]
2746
        },
2747
        {
2748
          "include": "$self"
2749
        }
2750
      ]
2751
    },
2752
    "switch_variables": {
2753
      "patterns": [
2754
        {
2755
          "captures": {
2756
            "1": {
2757
              "name": "keyword.control.go"
2758
            },
2759
            "2": {
2760
              "patterns": [
2761
                {
2762
                  "include": "#type-declarations"
2763
                },
2764
                {
2765
                  "include": "#support_functions"
2766
                },
2767
                {
2768
                  "include": "#variable_assignment"
2769
                },
2770
                {
2771
                  "match": "\\w+",
2772
                  "name": "variable.other.go"
2773
                }
2774
              ]
2775
            }
2776
          },
2777
          "match": "^\\s*\\b(case)\\b\\s+([\\s\\S]+:\\s*(?:/[*/].*)?)$"
2778
        },
2779
        {
2780
          "begin": "(?<=\\bswitch\\b)\\s*((?:[.\\w]+(?:\\s*[-!%\\&+,/:<=>|]+\\s*[.\\w]+)*\\s*[-!%\\&+,/:<=>|]+)?\\s*[-\\]%\\&(-+./<>\\[|\\w]+{0,1}\\s*(?:;\\s*[-\\]%\\&(-+./<>\\[|\\w]+\\s*)?)(\\{)",
2781
          "beginCaptures": {
2782
            "1": {
2783
              "patterns": [
2784
                {
2785
                  "include": "#support_functions"
2786
                },
2787
                {
2788
                  "include": "#type-declarations"
2789
                },
2790
                {
2791
                  "include": "#variable_assignment"
2792
                },
2793
                {
2794
                  "match": "\\w+",
2795
                  "name": "variable.other.go"
2796
                }
2797
              ]
2798
            },
2799
            "2": {
2800
              "name": "punctuation.definition.begin.bracket.curly.go"
2801
            }
2802
          },
2803
          "end": "}",
2804
          "endCaptures": {
2805
            "0": {
2806
              "name": "punctuation.definition.end.bracket.curly.go"
2807
            }
2808
          },
2809
          "patterns": [
2810
            {
2811
              "begin": "\\bcase\\b",
2812
              "beginCaptures": {
2813
                "0": {
2814
                  "name": "keyword.control.go"
2815
                }
2816
              },
2817
              "end": ":",
2818
              "endCaptures": {
2819
                "0": {
2820
                  "name": "punctuation.other.colon.go"
2821
                }
2822
              },
2823
              "patterns": [
2824
                {
2825
                  "include": "#support_functions"
2826
                },
2827
                {
2828
                  "include": "#type-declarations"
2829
                },
2830
                {
2831
                  "include": "#variable_assignment"
2832
                },
2833
                {
2834
                  "match": "\\w+",
2835
                  "name": "variable.other.go"
2836
                }
2837
              ]
2838
            },
2839
            {
2840
              "include": "$self"
2841
            }
2842
          ]
2843
        }
2844
      ]
2845
    },
2846
    "syntax_errors": {
2847
      "patterns": [
2848
        {
2849
          "captures": {
2850
            "1": {
2851
              "name": "invalid.illegal.slice.go"
2852
            }
2853
          },
2854
          "match": "\\[](\\s+)"
2855
        },
2856
        {
2857
          "match": "\\b0[0-7]*[89]\\d*\\b",
2858
          "name": "invalid.illegal.numeric.go"
2859
        }
2860
      ]
2861
    },
2862
    "terminators": {
2863
      "match": ";",
2864
      "name": "punctuation.terminator.go"
2865
    },
2866
    "type-declarations": {
2867
      "patterns": [
2868
        {
2869
          "include": "#language_constants"
2870
        },
2871
        {
2872
          "include": "#comments"
2873
        },
2874
        {
2875
          "include": "#map_types"
2876
        },
2877
        {
2878
          "include": "#brackets"
2879
        },
2880
        {
2881
          "include": "#delimiters"
2882
        },
2883
        {
2884
          "include": "#keywords"
2885
        },
2886
        {
2887
          "include": "#operators"
2888
        },
2889
        {
2890
          "include": "#runes"
2891
        },
2892
        {
2893
          "include": "#storage_types"
2894
        },
2895
        {
2896
          "include": "#raw_string_literals"
2897
        },
2898
        {
2899
          "include": "#string_literals"
2900
        },
2901
        {
2902
          "include": "#numeric_literals"
2903
        },
2904
        {
2905
          "include": "#terminators"
2906
        }
2907
      ]
2908
    },
2909
    "type-declarations-without-brackets": {
2910
      "patterns": [
2911
        {
2912
          "include": "#language_constants"
2913
        },
2914
        {
2915
          "include": "#comments"
2916
        },
2917
        {
2918
          "include": "#map_types"
2919
        },
2920
        {
2921
          "include": "#delimiters"
2922
        },
2923
        {
2924
          "include": "#keywords"
2925
        },
2926
        {
2927
          "include": "#operators"
2928
        },
2929
        {
2930
          "include": "#runes"
2931
        },
2932
        {
2933
          "include": "#storage_types"
2934
        },
2935
        {
2936
          "include": "#raw_string_literals"
2937
        },
2938
        {
2939
          "include": "#string_literals"
2940
        },
2941
        {
2942
          "include": "#numeric_literals"
2943
        },
2944
        {
2945
          "include": "#terminators"
2946
        }
2947
      ]
2948
    },
2949
    "type_assertion_inline": {
2950
      "captures": {
2951
        "1": {
2952
          "name": "keyword.type.go"
2953
        },
2954
        "2": {
2955
          "patterns": [
2956
            {
2957
              "include": "#type-declarations-without-brackets"
2958
            },
2959
            {
2960
              "match": "\\(",
2961
              "name": "punctuation.definition.begin.bracket.round.go"
2962
            },
2963
            {
2964
              "match": "\\)",
2965
              "name": "punctuation.definition.end.bracket.round.go"
2966
            },
2967
            {
2968
              "match": "\\[",
2969
              "name": "punctuation.definition.begin.bracket.square.go"
2970
            },
2971
            {
2972
              "match": "]",
2973
              "name": "punctuation.definition.end.bracket.square.go"
2974
            },
2975
            {
2976
              "match": "\\{",
2977
              "name": "punctuation.definition.begin.bracket.curly.go"
2978
            },
2979
            {
2980
              "match": "}",
2981
              "name": "punctuation.definition.end.bracket.curly.go"
2982
            },
2983
            {
2984
              "match": "\\w+",
2985
              "name": "entity.name.type.go"
2986
            }
2987
          ]
2988
        }
2989
      },
2990
      "match": "(?<=\\.\\()(?:\\b(type)\\b|((?:\\s*[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+{0,1}[]*\\[]+{0,1}[.\\w]+(?:\\[(?:[]*.\\[{}\\w]+(?:,\\s*[]*.\\[{}\\w]+)*)?])?))(?=\\))"
2991
    },
2992
    "var_assignment": {
2993
      "patterns": [
2994
        {
2995
          "captures": {
2996
            "1": {
2997
              "patterns": [
2998
                {
2999
                  "include": "#delimiters"
3000
                },
3001
                {
3002
                  "match": "\\w+",
3003
                  "name": "variable.other.assignment.go"
3004
                }
3005
              ]
3006
            },
3007
            "2": {
3008
              "patterns": [
3009
                {
3010
                  "include": "#type-declarations-without-brackets"
3011
                },
3012
                {
3013
                  "include": "#generic_types"
3014
                },
3015
                {
3016
                  "match": "\\(",
3017
                  "name": "punctuation.definition.begin.bracket.round.go"
3018
                },
3019
                {
3020
                  "match": "\\)",
3021
                  "name": "punctuation.definition.end.bracket.round.go"
3022
                },
3023
                {
3024
                  "match": "\\[",
3025
                  "name": "punctuation.definition.begin.bracket.square.go"
3026
                },
3027
                {
3028
                  "match": "]",
3029
                  "name": "punctuation.definition.end.bracket.square.go"
3030
                },
3031
                {
3032
                  "match": "\\w+",
3033
                  "name": "entity.name.type.go"
3034
                }
3035
              ]
3036
            }
3037
          },
3038
          "match": "(?<=\\bvar\\b)\\s*\\b([.\\w]+(?:,\\s*[.\\w]+)*)\\s*((?:(?:[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+(?:\\([^)]+\\))?)?(?![]*\\[]+{0,1}\\b(?:struct|func|map)\\b)(?:[]*.\\[\\w]+(?:,\\s*[]*.\\[\\w]+)*)?\\s*=?)?"
3039
        },
3040
        {
3041
          "begin": "(?<=\\bvar\\b)\\s*(\\()",
3042
          "beginCaptures": {
3043
            "1": {
3044
              "name": "punctuation.definition.begin.bracket.round.go"
3045
            }
3046
          },
3047
          "end": "\\)",
3048
          "endCaptures": {
3049
            "0": {
3050
              "name": "punctuation.definition.end.bracket.round.go"
3051
            }
3052
          },
3053
          "patterns": [
3054
            {
3055
              "captures": {
3056
                "1": {
3057
                  "patterns": [
3058
                    {
3059
                      "include": "#delimiters"
3060
                    },
3061
                    {
3062
                      "match": "\\w+",
3063
                      "name": "variable.other.assignment.go"
3064
                    }
3065
                  ]
3066
                },
3067
                "2": {
3068
                  "patterns": [
3069
                    {
3070
                      "include": "#type-declarations-without-brackets"
3071
                    },
3072
                    {
3073
                      "include": "#generic_types"
3074
                    },
3075
                    {
3076
                      "match": "\\(",
3077
                      "name": "punctuation.definition.begin.bracket.round.go"
3078
                    },
3079
                    {
3080
                      "match": "\\)",
3081
                      "name": "punctuation.definition.end.bracket.round.go"
3082
                    },
3083
                    {
3084
                      "match": "\\[",
3085
                      "name": "punctuation.definition.begin.bracket.square.go"
3086
                    },
3087
                    {
3088
                      "match": "]",
3089
                      "name": "punctuation.definition.end.bracket.square.go"
3090
                    },
3091
                    {
3092
                      "match": "\\w+",
3093
                      "name": "entity.name.type.go"
3094
                    }
3095
                  ]
3096
                }
3097
              },
3098
              "match": "^\\s*\\b([.\\w]+(?:,\\s*[.\\w]+)*)\\s*((?:(?:[]*\\[]+{0,1}(?:<-\\s*)?\\bchan\\b(?:\\s*<-)?\\s*)+(?:\\([^)]+\\))?)?(?![]*\\[]+{0,1}\\b(?:struct|func|map)\\b)(?:[]*.\\[\\w]+(?:,\\s*[]*.\\[\\w]+)*)?\\s*=?)?"
3099
            },
3100
            {
3101
              "include": "$self"
3102
            }
3103
          ]
3104
        }
3105
      ]
3106
    },
3107
    "variable_assignment": {
3108
      "patterns": [
3109
        {
3110
          "captures": {
3111
            "0": {
3112
              "patterns": [
3113
                {
3114
                  "include": "#delimiters"
3115
                },
3116
                {
3117
                  "match": "\\d\\w*",
3118
                  "name": "invalid.illegal.identifier.go"
3119
                },
3120
                {
3121
                  "match": "\\w+",
3122
                  "name": "variable.other.assignment.go"
3123
                }
3124
              ]
3125
            }
3126
          },
3127
          "match": "\\b\\w+(?:,\\s*\\w+)*(?=\\s*:=)"
3128
        },
3129
        {
3130
          "captures": {
3131
            "0": {
3132
              "patterns": [
3133
                {
3134
                  "include": "#delimiters"
3135
                },
3136
                {
3137
                  "include": "#operators"
3138
                },
3139
                {
3140
                  "match": "\\d\\w*",
3141
                  "name": "invalid.illegal.identifier.go"
3142
                },
3143
                {
3144
                  "match": "\\w+",
3145
                  "name": "variable.other.assignment.go"
3146
                }
3147
              ]
3148
            }
3149
          },
3150
          "match": "\\b[*.\\w]+(?:,\\s*[*.\\w]+)*(?=\\s*=(?!=))"
3151
        }
3152
      ]
3153
    }
3154
  },
3155
  "scopeName": "source.go"
3156
}