crates/highlight/syntaxes/shellscript.json 64.9 KiB raw
1
{
2
  "displayName": "Shell",
3
  "firstLineMatch": "^#!.*\\b(bash|zsh|sh)\\b",
4
  "name": "shellscript",
5
  "patterns": [
6
    {
7
      "include": "#initial_context"
8
    }
9
  ],
10
  "repository": {
11
    "alias_statement": {
12
      "begin": "[\\t ]*+(alias)[\\t ]*+((?:((?<!\\w)-\\w+)\\b[\\t ]*+)*)[\\t ]*+((?<!\\w)[-0-9A-Z_a-z]+(?!\\w))(?:(\\[)((?:(?:\\$?(?<!\\w)[-0-9A-Z_a-z]+(?!\\w)|@)|\\*)|(-?\\d+))(]))?(?:(?:(=)|(\\+=))|(-=))",
13
      "beginCaptures": {
14
        "1": {
15
          "name": "storage.type.alias.shell"
16
        },
17
        "10": {
18
          "name": "keyword.operator.assignment.compound.shell"
19
        },
20
        "11": {
21
          "name": "keyword.operator.assignment.compound.shell"
22
        },
23
        "2": {
24
          "patterns": [
25
            {
26
              "match": "(?<!\\w)-\\w+\\b",
27
              "name": "string.unquoted.argument.shell constant.other.option.shell"
28
            }
29
          ]
30
        },
31
        "3": {
32
          "name": "string.unquoted.argument.shell constant.other.option.shell"
33
        },
34
        "4": {
35
          "name": "variable.other.assignment.shell"
36
        },
37
        "5": {
38
          "name": "punctuation.definition.array.access.shell"
39
        },
40
        "6": {
41
          "name": "variable.other.assignment.shell"
42
        },
43
        "7": {
44
          "name": "constant.numeric.shell constant.numeric.integer.shell"
45
        },
46
        "8": {
47
          "name": "punctuation.definition.array.access.shell"
48
        },
49
        "9": {
50
          "name": "keyword.operator.assignment.shell"
51
        }
52
      },
53
      "end": "(?=[\\t ]|$)|(?:(?:(?:(;)|(&&))|(\\|\\|))|(&))",
54
      "endCaptures": {
55
        "1": {
56
          "name": "punctuation.terminator.statement.semicolon.shell"
57
        },
58
        "2": {
59
          "name": "punctuation.separator.statement.and.shell"
60
        },
61
        "3": {
62
          "name": "punctuation.separator.statement.or.shell"
63
        },
64
        "4": {
65
          "name": "punctuation.separator.statement.background.shell"
66
        }
67
      },
68
      "name": "meta.expression.assignment.alias.shell",
69
      "patterns": [
70
        {
71
          "include": "#normal_context"
72
        }
73
      ]
74
    },
75
    "argument": {
76
      "begin": "[\\t ]++(?![\\n#\\&(\\[|]|$|;)",
77
      "beginCaptures": {
78
      },
79
      "end": "(?=[\\t \\&;|]|$|[\\n)`])",
80
      "endCaptures": {
81
      },
82
      "name": "meta.argument.shell",
83
      "patterns": [
84
        {
85
          "include": "#argument_context"
86
        },
87
        {
88
          "include": "#line_continuation"
89
        }
90
      ]
91
    },
92
    "argument_context": {
93
      "patterns": [
94
        {
95
          "captures": {
96
            "1": {
97
              "name": "string.unquoted.argument.shell",
98
              "patterns": [
99
                {
100
                  "match": "\\*",
101
                  "name": "variable.language.special.wildcard.shell"
102
                },
103
                {
104
                  "include": "#variable"
105
                },
106
                {
107
                  "include": "#numeric_literal"
108
                },
109
                {
110
                  "captures": {
111
                    "1": {
112
                      "name": "constant.language.$1.shell"
113
                    }
114
                  },
115
                  "match": "(?<!\\w)\\b(true|false)\\b(?!\\w)"
116
                }
117
              ]
118
            }
119
          },
120
          "match": "[\\t ]*+([^\\t\\n \"$\\&-);<>\\\\`|]+(?!>))"
121
        },
122
        {
123
          "include": "#normal_context"
124
        }
125
      ]
126
    },
127
    "arithmetic_double": {
128
      "patterns": [
129
        {
130
          "begin": "\\(\\(",
131
          "beginCaptures": {
132
            "0": {
133
              "name": "punctuation.section.arithmetic.double.shell"
134
            }
135
          },
136
          "end": "\\)\\s*\\)",
137
          "endCaptures": {
138
            "0": {
139
              "name": "punctuation.section.arithmetic.double.shell"
140
            }
141
          },
142
          "name": "meta.arithmetic.shell",
143
          "patterns": [
144
            {
145
              "include": "#math"
146
            },
147
            {
148
              "include": "#string"
149
            }
150
          ]
151
        }
152
      ]
153
    },
154
    "arithmetic_no_dollar": {
155
      "patterns": [
156
        {
157
          "begin": "\\(",
158
          "beginCaptures": {
159
            "0": {
160
              "name": "punctuation.section.arithmetic.single.shell"
161
            }
162
          },
163
          "end": "\\)",
164
          "endCaptures": {
165
            "0": {
166
              "name": "punctuation.section.arithmetic.single.shell"
167
            }
168
          },
169
          "name": "meta.arithmetic.shell",
170
          "patterns": [
171
            {
172
              "include": "#math"
173
            },
174
            {
175
              "include": "#string"
176
            }
177
          ]
178
        }
179
      ]
180
    },
181
    "array_access_inline": {
182
      "captures": {
183
        "1": {
184
          "name": "punctuation.section.array.shell"
185
        },
186
        "2": {
187
          "patterns": [
188
            {
189
              "include": "#special_expansion"
190
            },
191
            {
192
              "include": "#string"
193
            },
194
            {
195
              "include": "#variable"
196
            }
197
          ]
198
        },
199
        "3": {
200
          "name": "punctuation.section.array.shell"
201
        }
202
      },
203
      "match": "(\\[)([^]\\[]+)(])"
204
    },
205
    "array_value": {
206
      "begin": "[\\t ]*+((?<!\\w)[-0-9A-Z_a-z]+(?!\\w))(?:(\\[)((?:(?:\\$?(?<!\\w)[-0-9A-Z_a-z]+(?!\\w)|@)|\\*)|(-?\\d+))(]))?(?:(?:(=)|(\\+=))|(-=))[\\t ]*+(\\()",
207
      "beginCaptures": {
208
        "1": {
209
          "name": "variable.other.assignment.shell"
210
        },
211
        "2": {
212
          "name": "punctuation.definition.array.access.shell"
213
        },
214
        "3": {
215
          "name": "variable.other.assignment.shell"
216
        },
217
        "4": {
218
          "name": "constant.numeric.shell constant.numeric.integer.shell"
219
        },
220
        "5": {
221
          "name": "punctuation.definition.array.access.shell"
222
        },
223
        "6": {
224
          "name": "keyword.operator.assignment.shell"
225
        },
226
        "7": {
227
          "name": "keyword.operator.assignment.compound.shell"
228
        },
229
        "8": {
230
          "name": "keyword.operator.assignment.compound.shell"
231
        },
232
        "9": {
233
          "name": "punctuation.definition.array.shell"
234
        }
235
      },
236
      "end": "\\)",
237
      "endCaptures": {
238
        "0": {
239
          "name": "punctuation.definition.array.shell"
240
        }
241
      },
242
      "patterns": [
243
        {
244
          "include": "#comment"
245
        },
246
        {
247
          "captures": {
248
            "1": {
249
              "name": "variable.other.assignment.array.shell entity.other.attribute-name.shell"
250
            },
251
            "2": {
252
              "name": "keyword.operator.assignment.shell punctuation.definition.assignment.shell"
253
            }
254
          },
255
          "match": "((?<!\\w)[-0-9A-Z_a-z]+(?!\\w))(=)"
256
        },
257
        {
258
          "captures": {
259
            "1": {
260
              "name": "punctuation.definition.bracket.named-array.shell"
261
            },
262
            "2": {
263
              "name": "string.unquoted.shell entity.other.attribute-name.bracket.shell"
264
            },
265
            "3": {
266
              "name": "punctuation.definition.bracket.named-array.shell"
267
            },
268
            "4": {
269
              "name": "punctuation.definition.assignment.shell"
270
            }
271
          },
272
          "match": "(\\[)(.+?)(])(=)"
273
        },
274
        {
275
          "include": "#normal_context"
276
        },
277
        {
278
          "include": "#simple_unquoted"
279
        }
280
      ]
281
    },
282
    "assignment_statement": {
283
      "patterns": [
284
        {
285
          "include": "#array_value"
286
        },
287
        {
288
          "include": "#modified_assignment_statement"
289
        },
290
        {
291
          "include": "#normal_assignment_statement"
292
        }
293
      ]
294
    },
295
    "basic_command_name": {
296
      "captures": {
297
        "1": {
298
          "name": "storage.modifier.$1.shell"
299
        },
300
        "2": {
301
          "name": "entity.name.function.call.shell entity.name.command.shell",
302
          "patterns": [
303
            {
304
              "match": "(?<!\\w)(?:continue|return|break)(?!\\w)",
305
              "name": "keyword.control.$0.shell"
306
            },
307
            {
308
              "match": "(?<!\\w)(?:unfunction|continue|autoload|unsetopt|bindkey|builtin|getopts|command|declare|unalias|history|unlimit|typeset|suspend|source|printf|unhash|disown|ulimit|return|which|alias|break|false|print|shift|times|umask|unset|read|type|exec|eval|wait|echo|dirs|jobs|kill|hash|stat|exit|test|trap|true|let|set|pwd|cd|fg|bg|fc|[.:])(?!/)(?!\\w)(?!-)",
309
              "name": "support.function.builtin.shell"
310
            },
311
            {
312
              "include": "#variable"
313
            }
314
          ]
315
        }
316
      },
317
      "match": "(?![\\n!#\\&()<>\\[{|]|$|[\\t ;])(?!nocorrect |nocorrect\\t|nocorrect$|readonly |readonly\\t|readonly$|function |function\\t|function$|foreach |foreach\\t|foreach$|coproc |coproc\\t|coproc$|logout |logout\\t|logout$|export |export\\t|export$|select |select\\t|select$|repeat |repeat\\t|repeat$|pushd |pushd\\t|pushd$|until |until\\t|until$|while |while\\t|while$|local |local\\t|local$|case |case\\t|case$|done |done\\t|done$|elif |elif\\t|elif$|else |else\\t|else$|esac |esac\\t|esac$|popd |popd\\t|popd$|then |then\\t|then$|time |time\\t|time$|for |for\\t|for$|end |end\\t|end$|fi |fi\\t|fi$|do |do\\t|do$|in |in\\t|in$|if |if\\t|if$)(?:((?<=^|[\\t \\&;])(?:readonly|declare|typeset|export|local)(?=[\\t \\&;]|$))|((?![\"']|\\\\\\n?$)[^\\t\\n\\r !\"'<>]+?))(?:(?=[\\t ])|(?=[\\n\\&);`{|}]|[\\t ]*#|])(?<!\\\\))",
318
      "name": "meta.statement.command.name.basic.shell"
319
    },
320
    "block_comment": {
321
      "begin": "\\s*+(/\\*)",
322
      "beginCaptures": {
323
        "1": {
324
          "name": "punctuation.definition.comment.begin.shell"
325
        }
326
      },
327
      "end": "\\*/",
328
      "endCaptures": {
329
        "0": {
330
          "name": "punctuation.definition.comment.end.shell"
331
        }
332
      },
333
      "name": "comment.block.shell"
334
    },
335
    "boolean": {
336
      "match": "\\b(?:true|false)\\b",
337
      "name": "constant.language.$0.shell"
338
    },
339
    "case_statement": {
340
      "begin": "\\b(case)\\b[\\t ]*+(.+?)[\\t ]*+\\b(in)\\b",
341
      "beginCaptures": {
342
        "1": {
343
          "name": "keyword.control.case.shell"
344
        },
345
        "2": {
346
          "patterns": [
347
            {
348
              "include": "#initial_context"
349
            }
350
          ]
351
        },
352
        "3": {
353
          "name": "keyword.control.in.shell"
354
        }
355
      },
356
      "end": "\\besac\\b",
357
      "endCaptures": {
358
        "0": {
359
          "name": "keyword.control.esac.shell"
360
        }
361
      },
362
      "name": "meta.case.shell",
363
      "patterns": [
364
        {
365
          "include": "#comment"
366
        },
367
        {
368
          "captures": {
369
            "1": {
370
              "name": "keyword.operator.pattern.case.default.shell"
371
            }
372
          },
373
          "match": "[\\t ]*+(\\* *\\))"
374
        },
375
        {
376
          "begin": "(?<!\\))(?![\\t ]*+(?:esac\\b|$))",
377
          "beginCaptures": {
378
          },
379
          "end": "(?=\\besac\\b)|(\\))",
380
          "endCaptures": {
381
            "1": {
382
              "name": "keyword.operator.pattern.case.shell"
383
            }
384
          },
385
          "name": "meta.case.entry.pattern.shell",
386
          "patterns": [
387
            {
388
              "include": "#case_statement_context"
389
            }
390
          ]
391
        },
392
        {
393
          "begin": "(?<=\\))",
394
          "beginCaptures": {
395
          },
396
          "end": "(;;)|(?=\\besac\\b)",
397
          "endCaptures": {
398
            "1": {
399
              "name": "punctuation.terminator.statement.case.shell"
400
            }
401
          },
402
          "name": "meta.case.entry.body.shell",
403
          "patterns": [
404
            {
405
              "include": "#typical_statements"
406
            },
407
            {
408
              "include": "#initial_context"
409
            }
410
          ]
411
        }
412
      ]
413
    },
414
    "case_statement_context": {
415
      "patterns": [
416
        {
417
          "match": "\\*",
418
          "name": "variable.language.special.quantifier.star.shell keyword.operator.quantifier.star.shell punctuation.definition.arbitrary-repetition.shell punctuation.definition.regex.arbitrary-repetition.shell"
419
        },
420
        {
421
          "match": "\\+",
422
          "name": "variable.language.special.quantifier.plus.shell keyword.operator.quantifier.plus.shell punctuation.definition.arbitrary-repetition.shell punctuation.definition.regex.arbitrary-repetition.shell"
423
        },
424
        {
425
          "match": "\\?",
426
          "name": "variable.language.special.quantifier.question.shell keyword.operator.quantifier.question.shell punctuation.definition.arbitrary-repetition.shell punctuation.definition.regex.arbitrary-repetition.shell"
427
        },
428
        {
429
          "match": "@",
430
          "name": "variable.language.special.at.shell keyword.operator.at.shell punctuation.definition.regex.at.shell"
431
        },
432
        {
433
          "match": "\\|",
434
          "name": "keyword.operator.orvariable.language.special.or.shell keyword.operator.alternation.ruby.shell punctuation.definition.regex.alternation.shell punctuation.separator.regex.alternation.shell"
435
        },
436
        {
437
          "match": "\\\\.",
438
          "name": "constant.character.escape.shell"
439
        },
440
        {
441
          "match": "(?<=\\tin| in|[\\t ]|;;)\\(",
442
          "name": "keyword.operator.pattern.case.shell"
443
        },
444
        {
445
          "begin": "(?<=\\S)(\\()",
446
          "beginCaptures": {
447
            "1": {
448
              "name": "punctuation.definition.group.shell punctuation.definition.regex.group.shell"
449
            }
450
          },
451
          "end": "\\)",
452
          "endCaptures": {
453
            "0": {
454
              "name": "punctuation.definition.group.shell punctuation.definition.regex.group.shell"
455
            }
456
          },
457
          "name": "meta.parenthese.shell",
458
          "patterns": [
459
            {
460
              "include": "#case_statement_context"
461
            }
462
          ]
463
        },
464
        {
465
          "begin": "\\[",
466
          "beginCaptures": {
467
            "0": {
468
              "name": "punctuation.definition.character-class.shell"
469
            }
470
          },
471
          "end": "]",
472
          "endCaptures": {
473
            "0": {
474
              "name": "punctuation.definition.character-class.shell"
475
            }
476
          },
477
          "name": "string.regexp.character-class.shell",
478
          "patterns": [
479
            {
480
              "match": "\\\\.",
481
              "name": "constant.character.escape.shell"
482
            }
483
          ]
484
        },
485
        {
486
          "include": "#string"
487
        },
488
        {
489
          "match": "[^\\t\\n )*?@\\[|]",
490
          "name": "string.unquoted.pattern.shell string.regexp.unquoted.shell"
491
        }
492
      ]
493
    },
494
    "command_name_range": {
495
      "begin": "\\G",
496
      "beginCaptures": {
497
      },
498
      "end": "(?=[\\t \\&;|]|$|[\\n)`])|(?=<)",
499
      "endCaptures": {
500
      },
501
      "name": "meta.statement.command.name.shell",
502
      "patterns": [
503
        {
504
          "match": "(?<!\\w)(?:continue|return|break)(?!\\w)",
505
          "name": "entity.name.function.call.shell entity.name.command.shell keyword.control.$0.shell"
506
        },
507
        {
508
          "match": "(?<!\\w)(?:unfunction|continue|autoload|unsetopt|bindkey|builtin|getopts|command|declare|unalias|history|unlimit|typeset|suspend|source|printf|unhash|disown|ulimit|return|which|alias|break|false|print|shift|times|umask|unset|read|type|exec|eval|wait|echo|dirs|jobs|kill|hash|stat|exit|test|trap|true|let|set|pwd|cd|fg|bg|fc|[.:])(?!/)(?!\\w)(?!-)",
509
          "name": "entity.name.function.call.shell entity.name.command.shell support.function.builtin.shell"
510
        },
511
        {
512
          "include": "#variable"
513
        },
514
        {
515
          "captures": {
516
            "1": {
517
              "name": "entity.name.function.call.shell entity.name.command.shell"
518
            }
519
          },
520
          "match": "(?<!\\w)(?<=\\G|[\"')}])([^\\t\\n\\r \"\\&');->`{|]+)"
521
        },
522
        {
523
          "begin": "(?:\\G|(?<![\\t\\n #\\&;{|]))(\\$?)((\")|('))",
524
          "beginCaptures": {
525
            "1": {
526
              "name": "meta.statement.command.name.quoted.shell punctuation.definition.string.shell entity.name.function.call.shell entity.name.command.shell"
527
            },
528
            "2": {
529
            },
530
            "3": {
531
              "name": "meta.statement.command.name.quoted.shell string.quoted.double.shell punctuation.definition.string.begin.shell entity.name.function.call.shell entity.name.command.shell"
532
            },
533
            "4": {
534
              "name": "meta.statement.command.name.quoted.shell string.quoted.single.shell punctuation.definition.string.begin.shell entity.name.function.call.shell entity.name.command.shell"
535
            }
536
          },
537
          "end": "(?<!\\G)(?<=\\2)",
538
          "endCaptures": {
539
          },
540
          "patterns": [
541
            {
542
              "include": "#continuation_of_single_quoted_command_name"
543
            },
544
            {
545
              "include": "#continuation_of_double_quoted_command_name"
546
            }
547
          ]
548
        },
549
        {
550
          "include": "#line_continuation"
551
        },
552
        {
553
          "include": "#simple_unquoted"
554
        }
555
      ]
556
    },
557
    "command_statement": {
558
      "begin": "[\\t ]*+(?![\\n!#\\&()<>\\[{|]|$|[\\t ;])(?!nocorrect |nocorrect\\t|nocorrect$|readonly |readonly\\t|readonly$|function |function\\t|function$|foreach |foreach\\t|foreach$|coproc |coproc\\t|coproc$|logout |logout\\t|logout$|export |export\\t|export$|select |select\\t|select$|repeat |repeat\\t|repeat$|pushd |pushd\\t|pushd$|until |until\\t|until$|while |while\\t|while$|local |local\\t|local$|case |case\\t|case$|done |done\\t|done$|elif |elif\\t|elif$|else |else\\t|else$|esac |esac\\t|esac$|popd |popd\\t|popd$|then |then\\t|then$|time |time\\t|time$|for |for\\t|for$|end |end\\t|end$|fi |fi\\t|fi$|do |do\\t|do$|in |in\\t|in$|if |if\\t|if$)(?!\\\\\\n?$)",
559
      "beginCaptures": {
560
      },
561
      "end": "(?=[\\n\\&);`{|}]|[\\t ]*#|])(?<!\\\\)",
562
      "endCaptures": {
563
      },
564
      "name": "meta.statement.command.shell",
565
      "patterns": [
566
        {
567
          "include": "#command_name_range"
568
        },
569
        {
570
          "include": "#line_continuation"
571
        },
572
        {
573
          "include": "#option"
574
        },
575
        {
576
          "include": "#argument"
577
        },
578
        {
579
          "include": "#string"
580
        },
581
        {
582
          "include": "#heredoc"
583
        }
584
      ]
585
    },
586
    "comment": {
587
      "captures": {
588
        "1": {
589
          "name": "comment.line.number-sign.shell meta.shebang.shell"
590
        },
591
        "2": {
592
          "name": "punctuation.definition.comment.shebang.shell"
593
        },
594
        "3": {
595
          "name": "comment.line.number-sign.shell"
596
        },
597
        "4": {
598
          "name": "punctuation.definition.comment.shell"
599
        }
600
      },
601
      "match": "(?:^|[\\t ]++)(?:((#!).*)|((#).*))"
602
    },
603
    "comments": {
604
      "patterns": [
605
        {
606
          "include": "#block_comment"
607
        },
608
        {
609
          "include": "#line_comment"
610
        }
611
      ]
612
    },
613
    "compound-command": {
614
      "patterns": [
615
        {
616
          "begin": "\\[",
617
          "beginCaptures": {
618
            "0": {
619
              "name": "punctuation.definition.logical-expression.shell"
620
            }
621
          },
622
          "end": "]",
623
          "endCaptures": {
624
            "0": {
625
              "name": "punctuation.definition.logical-expression.shell"
626
            }
627
          },
628
          "name": "meta.scope.logical-expression.shell",
629
          "patterns": [
630
            {
631
              "include": "#logical-expression"
632
            },
633
            {
634
              "include": "#initial_context"
635
            }
636
          ]
637
        },
638
        {
639
          "begin": "(?<=\\s|^)\\{(?=\\s|$)",
640
          "beginCaptures": {
641
            "0": {
642
              "name": "punctuation.definition.group.shell"
643
            }
644
          },
645
          "end": "(?<=^|;)\\s*(})",
646
          "endCaptures": {
647
            "1": {
648
              "name": "punctuation.definition.group.shell"
649
            }
650
          },
651
          "name": "meta.scope.group.shell",
652
          "patterns": [
653
            {
654
              "include": "#initial_context"
655
            }
656
          ]
657
        }
658
      ]
659
    },
660
    "continuation_of_double_quoted_command_name": {
661
      "begin": "\\G(?<=\")",
662
      "beginCaptures": {
663
      },
664
      "contentName": "meta.statement.command.name.continuation string.quoted.double entity.name.function.call entity.name.command",
665
      "end": "\"",
666
      "endCaptures": {
667
        "0": {
668
          "name": "string.quoted.double.shell punctuation.definition.string.end.shell entity.name.function.call.shell entity.name.command.shell"
669
        }
670
      },
671
      "patterns": [
672
        {
673
          "match": "\\\\[\\n\"$\\\\`]",
674
          "name": "constant.character.escape.shell"
675
        },
676
        {
677
          "include": "#variable"
678
        },
679
        {
680
          "include": "#interpolation"
681
        }
682
      ]
683
    },
684
    "continuation_of_single_quoted_command_name": {
685
      "begin": "\\G(?<=')",
686
      "beginCaptures": {
687
      },
688
      "contentName": "meta.statement.command.name.continuation string.quoted.single entity.name.function.call entity.name.command",
689
      "end": "'",
690
      "endCaptures": {
691
        "0": {
692
          "name": "string.quoted.single.shell punctuation.definition.string.end.shell entity.name.function.call.shell entity.name.command.shell"
693
        }
694
      }
695
    },
696
    "custom_command_names": {
697
      "patterns": [
698
      ]
699
    },
700
    "custom_commands": {
701
      "patterns": [
702
      ]
703
    },
704
    "double_quote_context": {
705
      "patterns": [
706
        {
707
          "match": "\\\\[\\n\"$\\\\`]",
708
          "name": "constant.character.escape.shell"
709
        },
710
        {
711
          "include": "#variable"
712
        },
713
        {
714
          "include": "#interpolation"
715
        }
716
      ]
717
    },
718
    "double_quote_escape_char": {
719
      "match": "\\\\[\\n\"$\\\\`]",
720
      "name": "constant.character.escape.shell"
721
    },
722
    "floating_keyword": {
723
      "patterns": [
724
        {
725
          "match": "(?<=^|[\\t \\&;])(?:then|elif|else|done|end|do|if|fi)(?=[\\t \\&;]|$)",
726
          "name": "keyword.control.$0.shell"
727
        }
728
      ]
729
    },
730
    "for_statement": {
731
      "patterns": [
732
        {
733
          "begin": "\\b(for)\\b[\\t ]*+((?<!\\w)[-0-9A-Z_a-z]+(?!\\w))[\\t ]*+\\b(in)\\b",
734
          "beginCaptures": {
735
            "1": {
736
              "name": "keyword.control.for.shell"
737
            },
738
            "2": {
739
              "name": "variable.other.for.shell"
740
            },
741
            "3": {
742
              "name": "keyword.control.in.shell"
743
            }
744
          },
745
          "end": "(?=[\\n\\&);`{|}]|[\\t ]*#|])(?<!\\\\)",
746
          "endCaptures": {
747
          },
748
          "name": "meta.for.in.shell",
749
          "patterns": [
750
            {
751
              "include": "#string"
752
            },
753
            {
754
              "include": "#simple_unquoted"
755
            },
756
            {
757
              "include": "#normal_context"
758
            }
759
          ]
760
        },
761
        {
762
          "begin": "\\b(for)\\b",
763
          "beginCaptures": {
764
            "1": {
765
              "name": "keyword.control.for.shell"
766
            }
767
          },
768
          "end": "(?=[\\n\\&);`{|}]|[\\t ]*#|])(?<!\\\\)",
769
          "endCaptures": {
770
          },
771
          "name": "meta.for.shell",
772
          "patterns": [
773
            {
774
              "include": "#arithmetic_double"
775
            },
776
            {
777
              "include": "#normal_context"
778
            }
779
          ]
780
        }
781
      ]
782
    },
783
    "function_definition": {
784
      "applyEndPatternLast": 1,
785
      "begin": "[\\t ]*+(?:\\b(function)\\b[\\t ]*+([^\\t\\n\\r \"'()=]+)(?:(\\()[\\t ]*+(\\)))?|([^\\t\\n\\r \"'()=]+)[\\t ]*+(\\()[\\t ]*+(\\)))",
786
      "beginCaptures": {
787
        "1": {
788
          "name": "storage.type.function.shell"
789
        },
790
        "2": {
791
          "name": "entity.name.function.shell"
792
        },
793
        "3": {
794
          "name": "punctuation.definition.arguments.shell"
795
        },
796
        "4": {
797
          "name": "punctuation.definition.arguments.shell"
798
        },
799
        "5": {
800
          "name": "entity.name.function.shell"
801
        },
802
        "6": {
803
          "name": "punctuation.definition.arguments.shell"
804
        },
805
        "7": {
806
          "name": "punctuation.definition.arguments.shell"
807
        }
808
      },
809
      "end": "(?<=[)}])",
810
      "endCaptures": {
811
      },
812
      "name": "meta.function.shell",
813
      "patterns": [
814
        {
815
          "match": "\\G[\\t\\n ]"
816
        },
817
        {
818
          "begin": "\\{",
819
          "beginCaptures": {
820
            "0": {
821
              "name": "punctuation.definition.group.shell punctuation.section.function.definition.shell"
822
            }
823
          },
824
          "end": "}",
825
          "endCaptures": {
826
            "0": {
827
              "name": "punctuation.definition.group.shell punctuation.section.function.definition.shell"
828
            }
829
          },
830
          "name": "meta.function.body.shell",
831
          "patterns": [
832
            {
833
              "include": "#initial_context"
834
            }
835
          ]
836
        },
837
        {
838
          "begin": "\\(",
839
          "beginCaptures": {
840
            "0": {
841
              "name": "punctuation.definition.group.shell punctuation.section.function.definition.shell"
842
            }
843
          },
844
          "end": "\\)",
845
          "endCaptures": {
846
            "0": {
847
              "name": "punctuation.definition.group.shell punctuation.section.function.definition.shell"
848
            }
849
          },
850
          "name": "meta.function.body.shell",
851
          "patterns": [
852
            {
853
              "include": "#initial_context"
854
            }
855
          ]
856
        },
857
        {
858
          "include": "#initial_context"
859
        }
860
      ]
861
    },
862
    "heredoc": {
863
      "patterns": [
864
        {
865
          "begin": "((?<!<)<<-)[\\t ]*+([\"'])[\\t ]*+([^\"']+?)(?=[\"\\&';<\\s])(\\2)(.*)",
866
          "beginCaptures": {
867
            "1": {
868
              "name": "keyword.operator.heredoc.shell"
869
            },
870
            "2": {
871
              "name": "punctuation.definition.string.heredoc.quote.shell"
872
            },
873
            "3": {
874
              "name": "punctuation.definition.string.heredoc.delimiter.shell"
875
            },
876
            "4": {
877
              "name": "punctuation.definition.string.heredoc.quote.shell"
878
            },
879
            "5": {
880
              "patterns": [
881
                {
882
                  "include": "#redirect_fix"
883
                },
884
                {
885
                  "include": "#typical_statements"
886
                }
887
              ]
888
            }
889
          },
890
          "contentName": "string.quoted.heredoc.indent.$3",
891
          "end": "^\\t*\\3(?=[\\&;\\s]|$)",
892
          "endCaptures": {
893
            "0": {
894
              "name": "punctuation.definition.string.heredoc.$0.shell"
895
            }
896
          },
897
          "patterns": [
898
          ]
899
        },
900
        {
901
          "begin": "((?<!<)<<(?!<))[\\t ]*+([\"'])[\\t ]*+([^\"']+?)(?=[\"\\&';<\\s])(\\2)(.*)",
902
          "beginCaptures": {
903
            "1": {
904
              "name": "keyword.operator.heredoc.shell"
905
            },
906
            "2": {
907
              "name": "punctuation.definition.string.heredoc.quote.shell"
908
            },
909
            "3": {
910
              "name": "punctuation.definition.string.heredoc.delimiter.shell"
911
            },
912
            "4": {
913
              "name": "punctuation.definition.string.heredoc.quote.shell"
914
            },
915
            "5": {
916
              "patterns": [
917
                {
918
                  "include": "#redirect_fix"
919
                },
920
                {
921
                  "include": "#typical_statements"
922
                }
923
              ]
924
            }
925
          },
926
          "contentName": "string.quoted.heredoc.no-indent.$3",
927
          "end": "^\\3(?=[\\&;\\s]|$)",
928
          "endCaptures": {
929
            "0": {
930
              "name": "punctuation.definition.string.heredoc.delimiter.shell"
931
            }
932
          },
933
          "patterns": [
934
          ]
935
        },
936
        {
937
          "begin": "((?<!<)<<-)[\\t ]*+([^\\t \"']+)(?=[\"\\&';<\\s])(.*)",
938
          "beginCaptures": {
939
            "1": {
940
              "name": "keyword.operator.heredoc.shell"
941
            },
942
            "2": {
943
              "name": "punctuation.definition.string.heredoc.delimiter.shell"
944
            },
945
            "3": {
946
              "patterns": [
947
                {
948
                  "include": "#redirect_fix"
949
                },
950
                {
951
                  "include": "#typical_statements"
952
                }
953
              ]
954
            }
955
          },
956
          "contentName": "string.unquoted.heredoc.indent.$2",
957
          "end": "^\\t*\\2(?=[\\&;\\s]|$)",
958
          "endCaptures": {
959
            "0": {
960
              "name": "punctuation.definition.string.heredoc.delimiter.shell"
961
            }
962
          },
963
          "patterns": [
964
            {
965
              "include": "#double_quote_escape_char"
966
            },
967
            {
968
              "include": "#variable"
969
            },
970
            {
971
              "include": "#interpolation"
972
            }
973
          ]
974
        },
975
        {
976
          "begin": "((?<!<)<<(?!<))[\\t ]*+([^\\t \"']+)(?=[\"\\&';<\\s])(.*)",
977
          "beginCaptures": {
978
            "1": {
979
              "name": "keyword.operator.heredoc.shell"
980
            },
981
            "2": {
982
              "name": "punctuation.definition.string.heredoc.delimiter.shell"
983
            },
984
            "3": {
985
              "patterns": [
986
                {
987
                  "include": "#redirect_fix"
988
                },
989
                {
990
                  "include": "#typical_statements"
991
                }
992
              ]
993
            }
994
          },
995
          "contentName": "string.unquoted.heredoc.no-indent.$2",
996
          "end": "^\\2(?=[\\&;\\s]|$)",
997
          "endCaptures": {
998
            "0": {
999
              "name": "punctuation.definition.string.heredoc.delimiter.shell"
1000
            }
1001
          },
1002
          "patterns": [
1003
            {
1004
              "include": "#double_quote_escape_char"
1005
            },
1006
            {
1007
              "include": "#variable"
1008
            },
1009
            {
1010
              "include": "#interpolation"
1011
            }
1012
          ]
1013
        }
1014
      ]
1015
    },
1016
    "herestring": {
1017
      "patterns": [
1018
        {
1019
          "begin": "(<<<)\\s*(('))",
1020
          "beginCaptures": {
1021
            "1": {
1022
              "name": "keyword.operator.herestring.shell"
1023
            },
1024
            "2": {
1025
              "name": "string.quoted.single.shell"
1026
            },
1027
            "3": {
1028
              "name": "punctuation.definition.string.begin.shell"
1029
            }
1030
          },
1031
          "contentName": "string.quoted.single.shell",
1032
          "end": "(')",
1033
          "endCaptures": {
1034
            "0": {
1035
              "name": "string.quoted.single.shell"
1036
            },
1037
            "1": {
1038
              "name": "punctuation.definition.string.end.shell"
1039
            }
1040
          },
1041
          "name": "meta.herestring.shell"
1042
        },
1043
        {
1044
          "begin": "(<<<)\\s*((\"))",
1045
          "beginCaptures": {
1046
            "1": {
1047
              "name": "keyword.operator.herestring.shell"
1048
            },
1049
            "2": {
1050
              "name": "string.quoted.double.shell"
1051
            },
1052
            "3": {
1053
              "name": "punctuation.definition.string.begin.shell"
1054
            }
1055
          },
1056
          "contentName": "string.quoted.double.shell",
1057
          "end": "(\")",
1058
          "endCaptures": {
1059
            "0": {
1060
              "name": "string.quoted.double.shell"
1061
            },
1062
            "1": {
1063
              "name": "punctuation.definition.string.end.shell"
1064
            }
1065
          },
1066
          "name": "meta.herestring.shell",
1067
          "patterns": [
1068
            {
1069
              "include": "#double_quote_context"
1070
            }
1071
          ]
1072
        },
1073
        {
1074
          "captures": {
1075
            "1": {
1076
              "name": "keyword.operator.herestring.shell"
1077
            },
1078
            "2": {
1079
              "name": "string.unquoted.herestring.shell",
1080
              "patterns": [
1081
                {
1082
                  "include": "#initial_context"
1083
                }
1084
              ]
1085
            }
1086
          },
1087
          "match": "(<<<)\\s*(([^)\\\\\\s]|\\\\.)+)",
1088
          "name": "meta.herestring.shell"
1089
        }
1090
      ]
1091
    },
1092
    "initial_context": {
1093
      "patterns": [
1094
        {
1095
          "include": "#comment"
1096
        },
1097
        {
1098
          "include": "#pipeline"
1099
        },
1100
        {
1101
          "include": "#normal_statement_seperator"
1102
        },
1103
        {
1104
          "include": "#logical_expression_double"
1105
        },
1106
        {
1107
          "include": "#logical_expression_single"
1108
        },
1109
        {
1110
          "include": "#assignment_statement"
1111
        },
1112
        {
1113
          "include": "#case_statement"
1114
        },
1115
        {
1116
          "include": "#for_statement"
1117
        },
1118
        {
1119
          "include": "#loop"
1120
        },
1121
        {
1122
          "include": "#function_definition"
1123
        },
1124
        {
1125
          "include": "#line_continuation"
1126
        },
1127
        {
1128
          "include": "#arithmetic_double"
1129
        },
1130
        {
1131
          "include": "#misc_ranges"
1132
        },
1133
        {
1134
          "include": "#variable"
1135
        },
1136
        {
1137
          "include": "#interpolation"
1138
        },
1139
        {
1140
          "include": "#heredoc"
1141
        },
1142
        {
1143
          "include": "#herestring"
1144
        },
1145
        {
1146
          "include": "#redirection"
1147
        },
1148
        {
1149
          "include": "#pathname"
1150
        },
1151
        {
1152
          "include": "#floating_keyword"
1153
        },
1154
        {
1155
          "include": "#alias_statement"
1156
        },
1157
        {
1158
          "include": "#normal_statement"
1159
        },
1160
        {
1161
          "include": "#string"
1162
        },
1163
        {
1164
          "include": "#support"
1165
        }
1166
      ]
1167
    },
1168
    "inline_comment": {
1169
      "captures": {
1170
        "1": {
1171
          "name": "comment.block.shell punctuation.definition.comment.begin.shell"
1172
        },
1173
        "2": {
1174
          "name": "comment.block.shell"
1175
        },
1176
        "3": {
1177
          "patterns": [
1178
            {
1179
              "match": "\\*/",
1180
              "name": "comment.block.shell punctuation.definition.comment.end.shell"
1181
            },
1182
            {
1183
              "match": "\\*",
1184
              "name": "comment.block.shell"
1185
            }
1186
          ]
1187
        }
1188
      },
1189
      "match": "(/\\*)((?:[^*]|\\*++[^/])*+(\\*++/))"
1190
    },
1191
    "interpolation": {
1192
      "patterns": [
1193
        {
1194
          "include": "#arithmetic_dollar"
1195
        },
1196
        {
1197
          "include": "#subshell_dollar"
1198
        },
1199
        {
1200
          "begin": "`",
1201
          "beginCaptures": {
1202
            "0": {
1203
              "name": "punctuation.definition.evaluation.backticks.shell"
1204
            }
1205
          },
1206
          "end": "`",
1207
          "endCaptures": {
1208
            "0": {
1209
              "name": "punctuation.definition.evaluation.backticks.shell"
1210
            }
1211
          },
1212
          "name": "string.interpolated.backtick.shell",
1213
          "patterns": [
1214
            {
1215
              "match": "\\\\[$\\\\`]",
1216
              "name": "constant.character.escape.shell"
1217
            },
1218
            {
1219
              "begin": "(?<=\\W)(?=#)(?!#\\{)",
1220
              "beginCaptures": {
1221
                "1": {
1222
                  "name": "punctuation.whitespace.comment.leading.shell"
1223
                }
1224
              },
1225
              "end": "(?!\\G)",
1226
              "patterns": [
1227
                {
1228
                  "begin": "#",
1229
                  "beginCaptures": {
1230
                    "0": {
1231
                      "name": "punctuation.definition.comment.shell"
1232
                    }
1233
                  },
1234
                  "end": "(?=`)",
1235
                  "name": "comment.line.number-sign.shell"
1236
                }
1237
              ]
1238
            },
1239
            {
1240
              "include": "#initial_context"
1241
            }
1242
          ]
1243
        }
1244
      ]
1245
    },
1246
    "keyword": {
1247
      "patterns": [
1248
        {
1249
          "match": "(?<=^|[\\&;\\s])(then|else|elif|fi|for|in|do|done|select|continue|esac|while|until|return)(?=[\\&;\\s]|$)",
1250
          "name": "keyword.control.shell"
1251
        },
1252
        {
1253
          "match": "(?<=^|[\\&;\\s])(?:export|declare|typeset|local|readonly)(?=[\\&;\\s]|$)",
1254
          "name": "storage.modifier.shell"
1255
        }
1256
      ]
1257
    },
1258
    "line_comment": {
1259
      "begin": "\\s*+(//)",
1260
      "beginCaptures": {
1261
        "1": {
1262
          "name": "punctuation.definition.comment.shell"
1263
        }
1264
      },
1265
      "end": "(?<=\\n)(?<!\\\\\\n)",
1266
      "endCaptures": {
1267
      },
1268
      "name": "comment.line.double-slash.shell",
1269
      "patterns": [
1270
        {
1271
          "include": "#line_continuation_character"
1272
        }
1273
      ]
1274
    },
1275
    "line_continuation": {
1276
      "match": "\\\\(?=\\n)",
1277
      "name": "constant.character.escape.line-continuation.shell"
1278
    },
1279
    "logical-expression": {
1280
      "patterns": [
1281
        {
1282
          "include": "#arithmetic_no_dollar"
1283
        },
1284
        {
1285
          "match": "=[=~]?|!=?|[<>]|&&|\\|\\|",
1286
          "name": "keyword.operator.logical.shell"
1287
        },
1288
        {
1289
          "match": "(?<!\\S)-(nt|ot|ef|eq|ne|l[et]|g[et]|[GLNOSa-hknopr-uwxz])\\b",
1290
          "name": "keyword.operator.logical.shell"
1291
        }
1292
      ]
1293
    },
1294
    "logical_expression_context": {
1295
      "patterns": [
1296
        {
1297
          "include": "#regex_comparison"
1298
        },
1299
        {
1300
          "include": "#arithmetic_no_dollar"
1301
        },
1302
        {
1303
          "include": "#logical-expression"
1304
        },
1305
        {
1306
          "include": "#logical_expression_single"
1307
        },
1308
        {
1309
          "include": "#logical_expression_double"
1310
        },
1311
        {
1312
          "include": "#comment"
1313
        },
1314
        {
1315
          "include": "#boolean"
1316
        },
1317
        {
1318
          "include": "#redirect_number"
1319
        },
1320
        {
1321
          "include": "#numeric_literal"
1322
        },
1323
        {
1324
          "include": "#pipeline"
1325
        },
1326
        {
1327
          "include": "#normal_statement_seperator"
1328
        },
1329
        {
1330
          "include": "#string"
1331
        },
1332
        {
1333
          "include": "#variable"
1334
        },
1335
        {
1336
          "include": "#interpolation"
1337
        },
1338
        {
1339
          "include": "#heredoc"
1340
        },
1341
        {
1342
          "include": "#herestring"
1343
        },
1344
        {
1345
          "include": "#pathname"
1346
        },
1347
        {
1348
          "include": "#floating_keyword"
1349
        },
1350
        {
1351
          "include": "#support"
1352
        }
1353
      ]
1354
    },
1355
    "logical_expression_double": {
1356
      "begin": "\\[\\[",
1357
      "beginCaptures": {
1358
        "0": {
1359
          "name": "punctuation.definition.logical-expression.shell"
1360
        }
1361
      },
1362
      "end": "]]",
1363
      "endCaptures": {
1364
        "0": {
1365
          "name": "punctuation.definition.logical-expression.shell"
1366
        }
1367
      },
1368
      "name": "meta.scope.logical-expression.shell",
1369
      "patterns": [
1370
        {
1371
          "include": "#logical_expression_context"
1372
        }
1373
      ]
1374
    },
1375
    "logical_expression_single": {
1376
      "begin": "\\[",
1377
      "beginCaptures": {
1378
        "0": {
1379
          "name": "punctuation.definition.logical-expression.shell"
1380
        }
1381
      },
1382
      "end": "]",
1383
      "endCaptures": {
1384
        "0": {
1385
          "name": "punctuation.definition.logical-expression.shell"
1386
        }
1387
      },
1388
      "name": "meta.scope.logical-expression.shell",
1389
      "patterns": [
1390
        {
1391
          "include": "#logical_expression_context"
1392
        }
1393
      ]
1394
    },
1395
    "loop": {
1396
      "patterns": [
1397
        {
1398
          "begin": "(?<=^|[\\&;\\s])(for)\\s+(.+?)\\s+(in)(?=[\\&;\\s]|$)",
1399
          "beginCaptures": {
1400
            "1": {
1401
              "name": "keyword.control.shell"
1402
            },
1403
            "2": {
1404
              "name": "variable.other.loop.shell",
1405
              "patterns": [
1406
                {
1407
                  "include": "#string"
1408
                }
1409
              ]
1410
            },
1411
            "3": {
1412
              "name": "keyword.control.shell"
1413
            }
1414
          },
1415
          "end": "(?<=^|[\\&;\\s])done(?=[\\&;\\s]|$|\\))",
1416
          "endCaptures": {
1417
            "0": {
1418
              "name": "keyword.control.shell"
1419
            }
1420
          },
1421
          "name": "meta.scope.for-in-loop.shell",
1422
          "patterns": [
1423
            {
1424
              "include": "#initial_context"
1425
            }
1426
          ]
1427
        },
1428
        {
1429
          "begin": "(?<=^|[\\&;\\s])(while|until)(?=[\\&;\\s]|$)",
1430
          "beginCaptures": {
1431
            "1": {
1432
              "name": "keyword.control.shell"
1433
            }
1434
          },
1435
          "end": "(?<=^|[\\&;\\s])done(?=[\\&;\\s]|$|\\))",
1436
          "endCaptures": {
1437
            "0": {
1438
              "name": "keyword.control.shell"
1439
            }
1440
          },
1441
          "name": "meta.scope.while-loop.shell",
1442
          "patterns": [
1443
            {
1444
              "include": "#initial_context"
1445
            }
1446
          ]
1447
        },
1448
        {
1449
          "begin": "(?<=^|[\\&;\\s])(select)\\s+((?:[^\\\\\\s]|\\\\.)+)(?=[\\&;\\s]|$)",
1450
          "beginCaptures": {
1451
            "1": {
1452
              "name": "keyword.control.shell"
1453
            },
1454
            "2": {
1455
              "name": "variable.other.loop.shell"
1456
            }
1457
          },
1458
          "end": "(?<=^|[\\&;\\s])(done)(?=[\\&;\\s]|$|\\))",
1459
          "endCaptures": {
1460
            "1": {
1461
              "name": "keyword.control.shell"
1462
            }
1463
          },
1464
          "name": "meta.scope.select-block.shell",
1465
          "patterns": [
1466
            {
1467
              "include": "#initial_context"
1468
            }
1469
          ]
1470
        },
1471
        {
1472
          "begin": "(?<=^|[\\&;\\s])if(?=[\\&;\\s]|$)",
1473
          "beginCaptures": {
1474
            "0": {
1475
              "name": "keyword.control.if.shell"
1476
            }
1477
          },
1478
          "end": "(?<=^|[\\&;\\s])fi(?=[\\&;\\s]|$)",
1479
          "endCaptures": {
1480
            "0": {
1481
              "name": "keyword.control.fi.shell"
1482
            }
1483
          },
1484
          "name": "meta.scope.if-block.shell",
1485
          "patterns": [
1486
            {
1487
              "include": "#initial_context"
1488
            }
1489
          ]
1490
        }
1491
      ]
1492
    },
1493
    "math": {
1494
      "patterns": [
1495
        {
1496
          "include": "#variable"
1497
        },
1498
        {
1499
          "match": "\\+{1,2}|-{1,2}|[!~]|\\*{1,2}|[%/]|<[<=]?|>[=>]?|==|!=|^|\\|{1,2}|&{1,2}|[,:=?]|[-%\\&*+/^|]=|<<=|>>=",
1500
          "name": "keyword.operator.arithmetic.shell"
1501
        },
1502
        {
1503
          "match": "0[Xx]\\h+",
1504
          "name": "constant.numeric.hex.shell"
1505
        },
1506
        {
1507
          "match": ";",
1508
          "name": "punctuation.separator.semicolon.range"
1509
        },
1510
        {
1511
          "match": "0\\d+",
1512
          "name": "constant.numeric.octal.shell"
1513
        },
1514
        {
1515
          "match": "\\d{1,2}#[0-9@-Z_a-z]+",
1516
          "name": "constant.numeric.other.shell"
1517
        },
1518
        {
1519
          "match": "\\d+",
1520
          "name": "constant.numeric.integer.shell"
1521
        },
1522
        {
1523
          "match": "(?<!\\w)[0-9A-Z_a-z]+(?!\\w)",
1524
          "name": "variable.other.normal.shell"
1525
        }
1526
      ]
1527
    },
1528
    "math_operators": {
1529
      "patterns": [
1530
        {
1531
          "match": "\\+{1,2}|-{1,2}|[!~]|\\*{1,2}|[%/]|<[<=]?|>[=>]?|==|!=|^|\\|{1,2}|&{1,2}|[,:=?]|[-%\\&*+/^|]=|<<=|>>=",
1532
          "name": "keyword.operator.arithmetic.shell"
1533
        },
1534
        {
1535
          "match": "0[Xx]\\h+",
1536
          "name": "constant.numeric.hex.shell"
1537
        },
1538
        {
1539
          "match": "0\\d+",
1540
          "name": "constant.numeric.octal.shell"
1541
        },
1542
        {
1543
          "match": "\\d{1,2}#[0-9@-Z_a-z]+",
1544
          "name": "constant.numeric.other.shell"
1545
        },
1546
        {
1547
          "match": "\\d+",
1548
          "name": "constant.numeric.integer.shell"
1549
        }
1550
      ]
1551
    },
1552
    "misc_ranges": {
1553
      "patterns": [
1554
        {
1555
          "include": "#logical_expression_single"
1556
        },
1557
        {
1558
          "include": "#logical_expression_double"
1559
        },
1560
        {
1561
          "include": "#subshell_dollar"
1562
        },
1563
        {
1564
          "begin": "(?<![^\\t ])(\\{)(?![$\\w])",
1565
          "beginCaptures": {
1566
            "1": {
1567
              "name": "punctuation.definition.group.shell"
1568
            }
1569
          },
1570
          "end": "}",
1571
          "endCaptures": {
1572
            "0": {
1573
              "name": "punctuation.definition.group.shell"
1574
            }
1575
          },
1576
          "name": "meta.scope.group.shell",
1577
          "patterns": [
1578
            {
1579
              "include": "#initial_context"
1580
            }
1581
          ]
1582
        }
1583
      ]
1584
    },
1585
    "modified_assignment_statement": {
1586
      "begin": "(?<=^|[\\t \\&;])(?:readonly|declare|typeset|export|local)(?=[\\t \\&;]|$)",
1587
      "beginCaptures": {
1588
        "0": {
1589
          "name": "storage.modifier.$0.shell"
1590
        }
1591
      },
1592
      "end": "(?=[\\n\\&);`{|}]|[\\t ]*#|])(?<!\\\\)",
1593
      "endCaptures": {
1594
      },
1595
      "name": "meta.statement.shell meta.expression.assignment.modified.shell",
1596
      "patterns": [
1597
        {
1598
          "match": "(?<!\\w)-\\w+\\b",
1599
          "name": "string.unquoted.argument.shell constant.other.option.shell"
1600
        },
1601
        {
1602
          "include": "#array_value"
1603
        },
1604
        {
1605
          "captures": {
1606
            "1": {
1607
              "name": "variable.other.assignment.shell"
1608
            },
1609
            "10": {
1610
              "name": "constant.numeric.shell constant.numeric.octal.shell"
1611
            },
1612
            "11": {
1613
              "name": "constant.numeric.shell constant.numeric.other.shell"
1614
            },
1615
            "12": {
1616
              "name": "constant.numeric.shell constant.numeric.decimal.shell"
1617
            },
1618
            "13": {
1619
              "name": "constant.numeric.shell constant.numeric.version.shell"
1620
            },
1621
            "14": {
1622
              "name": "constant.numeric.shell constant.numeric.integer.shell"
1623
            },
1624
            "2": {
1625
              "name": "punctuation.definition.array.access.shell"
1626
            },
1627
            "3": {
1628
              "name": "variable.other.assignment.shell"
1629
            },
1630
            "4": {
1631
              "name": "constant.numeric.shell constant.numeric.integer.shell"
1632
            },
1633
            "5": {
1634
              "name": "punctuation.definition.array.access.shell"
1635
            },
1636
            "6": {
1637
              "name": "keyword.operator.assignment.shell"
1638
            },
1639
            "7": {
1640
              "name": "keyword.operator.assignment.compound.shell"
1641
            },
1642
            "8": {
1643
              "name": "keyword.operator.assignment.compound.shell"
1644
            },
1645
            "9": {
1646
              "name": "constant.numeric.shell constant.numeric.hex.shell"
1647
            }
1648
          },
1649
          "match": "((?<!\\w)[-0-9A-Z_a-z]+(?!\\w))(?:(\\[)((?:(?:\\$?(?<!\\w)[-0-9A-Z_a-z]+(?!\\w)|@)|\\*)|(-?\\d+))(]))?(?:(?:(=)|(\\+=))|(-=))?(?:(?<=[\\t =]|^|[(\\[{])(?:(?:(?:(?:(?:(0[Xx]\\h+)|(0\\d+))|(\\d{1,2}#[0-9@-Z_a-z]+))|(-?\\d+\\.\\d+))|(-?\\d+(?:\\.\\d+)+))|(-?\\d+))(?=[\\t ]|$|[);}]))?"
1650
        },
1651
        {
1652
          "include": "#normal_context"
1653
        }
1654
      ]
1655
    },
1656
    "modifiers": {
1657
      "match": "(?<=^|[\\t \\&;])(?:readonly|declare|typeset|export|local)(?=[\\t \\&;]|$)",
1658
      "name": "storage.modifier.$0.shell"
1659
    },
1660
    "normal_assignment_statement": {
1661
      "begin": "[\\t ]*+((?<!\\w)[-0-9A-Z_a-z]+(?!\\w))(?:(\\[)((?:(?:\\$?(?<!\\w)[-0-9A-Z_a-z]+(?!\\w)|@)|\\*)|(-?\\d+))(]))?(?:(?:(=)|(\\+=))|(-=))",
1662
      "beginCaptures": {
1663
        "1": {
1664
          "name": "variable.other.assignment.shell"
1665
        },
1666
        "2": {
1667
          "name": "punctuation.definition.array.access.shell"
1668
        },
1669
        "3": {
1670
          "name": "variable.other.assignment.shell"
1671
        },
1672
        "4": {
1673
          "name": "constant.numeric.shell constant.numeric.integer.shell"
1674
        },
1675
        "5": {
1676
          "name": "punctuation.definition.array.access.shell"
1677
        },
1678
        "6": {
1679
          "name": "keyword.operator.assignment.shell"
1680
        },
1681
        "7": {
1682
          "name": "keyword.operator.assignment.compound.shell"
1683
        },
1684
        "8": {
1685
          "name": "keyword.operator.assignment.compound.shell"
1686
        }
1687
      },
1688
      "end": "(?=[\\n\\&);`{|}]|[\\t ]*#|])(?<!\\\\)",
1689
      "endCaptures": {
1690
      },
1691
      "name": "meta.expression.assignment.shell",
1692
      "patterns": [
1693
        {
1694
          "include": "#comment"
1695
        },
1696
        {
1697
          "include": "#string"
1698
        },
1699
        {
1700
          "include": "#normal_assignment_statement"
1701
        },
1702
        {
1703
          "begin": "(?<=[\\t ])(?![\\t ]|\\w+=)",
1704
          "beginCaptures": {
1705
          },
1706
          "end": "(?=[\\n\\&);`{|}]|[\\t ]*#|])(?<!\\\\)",
1707
          "endCaptures": {
1708
          },
1709
          "name": "meta.statement.command.env.shell",
1710
          "patterns": [
1711
            {
1712
              "include": "#command_name_range"
1713
            },
1714
            {
1715
              "include": "#line_continuation"
1716
            },
1717
            {
1718
              "include": "#option"
1719
            },
1720
            {
1721
              "include": "#argument"
1722
            },
1723
            {
1724
              "include": "#string"
1725
            }
1726
          ]
1727
        },
1728
        {
1729
          "include": "#simple_unquoted"
1730
        },
1731
        {
1732
          "include": "#normal_context"
1733
        }
1734
      ]
1735
    },
1736
    "normal_context": {
1737
      "patterns": [
1738
        {
1739
          "include": "#comment"
1740
        },
1741
        {
1742
          "include": "#pipeline"
1743
        },
1744
        {
1745
          "include": "#normal_statement_seperator"
1746
        },
1747
        {
1748
          "include": "#misc_ranges"
1749
        },
1750
        {
1751
          "include": "#boolean"
1752
        },
1753
        {
1754
          "include": "#redirect_number"
1755
        },
1756
        {
1757
          "include": "#numeric_literal"
1758
        },
1759
        {
1760
          "include": "#string"
1761
        },
1762
        {
1763
          "include": "#variable"
1764
        },
1765
        {
1766
          "include": "#interpolation"
1767
        },
1768
        {
1769
          "include": "#heredoc"
1770
        },
1771
        {
1772
          "include": "#herestring"
1773
        },
1774
        {
1775
          "include": "#redirection"
1776
        },
1777
        {
1778
          "include": "#pathname"
1779
        },
1780
        {
1781
          "include": "#floating_keyword"
1782
        },
1783
        {
1784
          "include": "#support"
1785
        },
1786
        {
1787
          "include": "#parenthese"
1788
        }
1789
      ]
1790
    },
1791
    "normal_statement": {
1792
      "begin": "(?!^[\\t ]*+$)(?:(?<=(?:^until| until|\\tuntil|^while| while|\\twhile|^elif| elif|\\telif|^else| else|\\telse|^then| then|\\tthen|^do| do|\\tdo|^if| if|\\tif) )|(?<=^|[!\\&(;`{|]))[\\t ]*+(?!nocorrect\\W|nocorrect\\$|function\\W|function\\$|foreach\\W|foreach\\$|repeat\\W|repeat\\$|logout\\W|logout\\$|coproc\\W|coproc\\$|select\\W|select\\$|while\\W|while\\$|pushd\\W|pushd\\$|until\\W|until\\$|case\\W|case\\$|done\\W|done\\$|elif\\W|elif\\$|else\\W|else\\$|esac\\W|esac\\$|popd\\W|popd\\$|then\\W|then\\$|time\\W|time\\$|for\\W|for\\$|end\\W|end\\$|fi\\W|fi\\$|do\\W|do\\$|in\\W|in\\$|if\\W|if\\$)",
1793
      "beginCaptures": {
1794
      },
1795
      "end": "(?=[\\n\\&);`{|}]|[\\t ]*#|])(?<!\\\\)",
1796
      "endCaptures": {
1797
      },
1798
      "name": "meta.statement.shell",
1799
      "patterns": [
1800
        {
1801
          "include": "#typical_statements"
1802
        }
1803
      ]
1804
    },
1805
    "normal_statement_seperator": {
1806
      "captures": {
1807
        "1": {
1808
          "name": "punctuation.terminator.statement.semicolon.shell"
1809
        },
1810
        "2": {
1811
          "name": "punctuation.separator.statement.and.shell"
1812
        },
1813
        "3": {
1814
          "name": "punctuation.separator.statement.or.shell"
1815
        },
1816
        "4": {
1817
          "name": "punctuation.separator.statement.background.shell"
1818
        }
1819
      },
1820
      "match": "(?:(?:(;)|(&&))|(\\|\\|))|(&)"
1821
    },
1822
    "numeric_literal": {
1823
      "captures": {
1824
        "1": {
1825
          "name": "constant.numeric.shell constant.numeric.hex.shell"
1826
        },
1827
        "2": {
1828
          "name": "constant.numeric.shell constant.numeric.octal.shell"
1829
        },
1830
        "3": {
1831
          "name": "constant.numeric.shell constant.numeric.other.shell"
1832
        },
1833
        "4": {
1834
          "name": "constant.numeric.shell constant.numeric.decimal.shell"
1835
        },
1836
        "5": {
1837
          "name": "constant.numeric.shell constant.numeric.version.shell"
1838
        },
1839
        "6": {
1840
          "name": "constant.numeric.shell constant.numeric.integer.shell"
1841
        }
1842
      },
1843
      "match": "(?<=[\\t =]|^|[(\\[{])(?:(?:(?:(?:(?:(0[Xx]\\h+)|(0\\d+))|(\\d{1,2}#[0-9@-Z_a-z]+))|(-?\\d+\\.\\d+))|(-?\\d+(?:\\.\\d+)+))|(-?\\d+))(?=[\\t ]|$|[);}])"
1844
    },
1845
    "option": {
1846
      "begin": "[\\t ]++(-)((?![\\n!#\\&()<>\\[{|]|$|[\\t ;]))",
1847
      "beginCaptures": {
1848
        "1": {
1849
          "name": "string.unquoted.argument.shell constant.other.option.dash.shell"
1850
        },
1851
        "2": {
1852
          "name": "string.unquoted.argument.shell constant.other.option.shell"
1853
        }
1854
      },
1855
      "contentName": "string.unquoted.argument constant.other.option",
1856
      "end": "(?=[\\t ])|(?=[\\n\\&);`{|}]|[\\t ]*#|])(?<!\\\\)",
1857
      "endCaptures": {
1858
      },
1859
      "patterns": [
1860
        {
1861
          "include": "#option_context"
1862
        }
1863
      ]
1864
    },
1865
    "option_context": {
1866
      "patterns": [
1867
        {
1868
          "include": "#misc_ranges"
1869
        },
1870
        {
1871
          "include": "#string"
1872
        },
1873
        {
1874
          "include": "#variable"
1875
        },
1876
        {
1877
          "include": "#interpolation"
1878
        },
1879
        {
1880
          "include": "#heredoc"
1881
        },
1882
        {
1883
          "include": "#herestring"
1884
        },
1885
        {
1886
          "include": "#redirection"
1887
        },
1888
        {
1889
          "include": "#pathname"
1890
        },
1891
        {
1892
          "include": "#floating_keyword"
1893
        },
1894
        {
1895
          "include": "#support"
1896
        }
1897
      ]
1898
    },
1899
    "parenthese": {
1900
      "patterns": [
1901
        {
1902
          "begin": "\\(",
1903
          "beginCaptures": {
1904
            "0": {
1905
              "name": "punctuation.section.parenthese.shell"
1906
            }
1907
          },
1908
          "end": "\\)",
1909
          "endCaptures": {
1910
            "0": {
1911
              "name": "punctuation.section.parenthese.shell"
1912
            }
1913
          },
1914
          "name": "meta.parenthese.group.shell",
1915
          "patterns": [
1916
            {
1917
              "include": "#initial_context"
1918
            }
1919
          ]
1920
        }
1921
      ]
1922
    },
1923
    "pathname": {
1924
      "patterns": [
1925
        {
1926
          "match": "(?<=[:=\\s]|^)~",
1927
          "name": "keyword.operator.tilde.shell"
1928
        },
1929
        {
1930
          "match": "[*?]",
1931
          "name": "keyword.operator.glob.shell"
1932
        },
1933
        {
1934
          "begin": "([!*+?@])(\\()",
1935
          "beginCaptures": {
1936
            "1": {
1937
              "name": "keyword.operator.extglob.shell"
1938
            },
1939
            "2": {
1940
              "name": "punctuation.definition.extglob.shell"
1941
            }
1942
          },
1943
          "end": "\\)",
1944
          "endCaptures": {
1945
            "0": {
1946
              "name": "punctuation.definition.extglob.shell"
1947
            }
1948
          },
1949
          "name": "meta.structure.extglob.shell",
1950
          "patterns": [
1951
            {
1952
              "include": "#initial_context"
1953
            }
1954
          ]
1955
        }
1956
      ]
1957
    },
1958
    "pipeline": {
1959
      "patterns": [
1960
        {
1961
          "match": "(?<=^|[\\&;\\s])(time)(?=[\\&;\\s]|$)",
1962
          "name": "keyword.other.shell"
1963
        },
1964
        {
1965
          "match": "[!|]",
1966
          "name": "keyword.operator.pipe.shell"
1967
        }
1968
      ]
1969
    },
1970
    "redirect_fix": {
1971
      "captures": {
1972
        "1": {
1973
          "name": "keyword.operator.redirect.shell"
1974
        },
1975
        "2": {
1976
          "name": "string.unquoted.argument.shell"
1977
        }
1978
      },
1979
      "match": "(>>?)[\\t ]*+([^\\t\\n \"$\\&-);<>\\\\`|]+)"
1980
    },
1981
    "redirect_number": {
1982
      "captures": {
1983
        "1": {
1984
          "name": "keyword.operator.redirect.stdout.shell"
1985
        },
1986
        "2": {
1987
          "name": "keyword.operator.redirect.stderr.shell"
1988
        },
1989
        "3": {
1990
          "name": "keyword.operator.redirect.$3.shell"
1991
        }
1992
      },
1993
      "match": "(?<=[\\t ])(?:(1)|(2)|(\\d+))(?=>)"
1994
    },
1995
    "redirection": {
1996
      "patterns": [
1997
        {
1998
          "begin": "[<>]\\(",
1999
          "beginCaptures": {
2000
            "0": {
2001
              "name": "punctuation.definition.string.begin.shell"
2002
            }
2003
          },
2004
          "end": "\\)",
2005
          "endCaptures": {
2006
            "0": {
2007
              "name": "punctuation.definition.string.end.shell"
2008
            }
2009
          },
2010
          "name": "string.interpolated.process-substitution.shell",
2011
          "patterns": [
2012
            {
2013
              "include": "#initial_context"
2014
            }
2015
          ]
2016
        },
2017
        {
2018
          "match": "(?<![<>])(&>|\\d*>&\\d*|\\d*(>>|[<>])|\\d*<&|\\d*<>)(?![<>])",
2019
          "name": "keyword.operator.redirect.shell"
2020
        }
2021
      ]
2022
    },
2023
    "regex_comparison": {
2024
      "match": "=~",
2025
      "name": "keyword.operator.logical.regex.shell"
2026
    },
2027
    "regexp": {
2028
      "patterns": [
2029
        {
2030
          "match": ".+"
2031
        }
2032
      ]
2033
    },
2034
    "simple_options": {
2035
      "captures": {
2036
        "0": {
2037
          "patterns": [
2038
            {
2039
              "captures": {
2040
                "1": {
2041
                  "name": "string.unquoted.argument.shell constant.other.option.dash.shell"
2042
                },
2043
                "2": {
2044
                  "name": "string.unquoted.argument.shell constant.other.option.shell"
2045
                }
2046
              },
2047
              "match": "[\\t ]++(-)(\\w+)"
2048
            }
2049
          ]
2050
        }
2051
      },
2052
      "match": "(?:[\\t ]++-\\w+)*"
2053
    },
2054
    "simple_unquoted": {
2055
      "match": "[^\\t\\n \"$\\&-);<>\\\\`|]",
2056
      "name": "string.unquoted.shell"
2057
    },
2058
    "special_expansion": {
2059
      "match": "!|:[-=?]?|[*@]|##?|%%|[%/]",
2060
      "name": "keyword.operator.expansion.shell"
2061
    },
2062
    "start_of_command": {
2063
      "match": "[\\t ]*+(?![\\n!#\\&()<>\\[{|]|$|[\\t ;])(?!nocorrect |nocorrect\\t|nocorrect$|readonly |readonly\\t|readonly$|function |function\\t|function$|foreach |foreach\\t|foreach$|coproc |coproc\\t|coproc$|logout |logout\\t|logout$|export |export\\t|export$|select |select\\t|select$|repeat |repeat\\t|repeat$|pushd |pushd\\t|pushd$|until |until\\t|until$|while |while\\t|while$|local |local\\t|local$|case |case\\t|case$|done |done\\t|done$|elif |elif\\t|elif$|else |else\\t|else$|esac |esac\\t|esac$|popd |popd\\t|popd$|then |then\\t|then$|time |time\\t|time$|for |for\\t|for$|end |end\\t|end$|fi |fi\\t|fi$|do |do\\t|do$|in |in\\t|in$|if |if\\t|if$)(?!\\\\\\n?$)"
2064
    },
2065
    "string": {
2066
      "patterns": [
2067
        {
2068
          "match": "\\\\.",
2069
          "name": "constant.character.escape.shell"
2070
        },
2071
        {
2072
          "begin": "'",
2073
          "beginCaptures": {
2074
            "0": {
2075
              "name": "punctuation.definition.string.begin.shell"
2076
            }
2077
          },
2078
          "end": "'",
2079
          "endCaptures": {
2080
            "0": {
2081
              "name": "punctuation.definition.string.end.shell"
2082
            }
2083
          },
2084
          "name": "string.quoted.single.shell"
2085
        },
2086
        {
2087
          "begin": "\\$?\"",
2088
          "beginCaptures": {
2089
            "0": {
2090
              "name": "punctuation.definition.string.begin.shell"
2091
            }
2092
          },
2093
          "end": "\"",
2094
          "endCaptures": {
2095
            "0": {
2096
              "name": "punctuation.definition.string.end.shell"
2097
            }
2098
          },
2099
          "name": "string.quoted.double.shell",
2100
          "patterns": [
2101
            {
2102
              "match": "\\\\[\\n\"$\\\\`]",
2103
              "name": "constant.character.escape.shell"
2104
            },
2105
            {
2106
              "include": "#variable"
2107
            },
2108
            {
2109
              "include": "#interpolation"
2110
            }
2111
          ]
2112
        },
2113
        {
2114
          "begin": "\\$'",
2115
          "beginCaptures": {
2116
            "0": {
2117
              "name": "punctuation.definition.string.begin.shell"
2118
            }
2119
          },
2120
          "end": "'",
2121
          "endCaptures": {
2122
            "0": {
2123
              "name": "punctuation.definition.string.end.shell"
2124
            }
2125
          },
2126
          "name": "string.quoted.single.dollar.shell",
2127
          "patterns": [
2128
            {
2129
              "match": "\\\\['\\\\abefnrtv]",
2130
              "name": "constant.character.escape.ansi-c.shell"
2131
            },
2132
            {
2133
              "match": "\\\\[0-9]{3}\"",
2134
              "name": "constant.character.escape.octal.shell"
2135
            },
2136
            {
2137
              "match": "\\\\x\\h{2}\"",
2138
              "name": "constant.character.escape.hex.shell"
2139
            },
2140
            {
2141
              "match": "\\\\c.\"",
2142
              "name": "constant.character.escape.control-char.shell"
2143
            }
2144
          ]
2145
        }
2146
      ]
2147
    },
2148
    "subshell_dollar": {
2149
      "patterns": [
2150
        {
2151
          "begin": "\\$\\(",
2152
          "beginCaptures": {
2153
            "0": {
2154
              "name": "punctuation.definition.subshell.single.shell"
2155
            }
2156
          },
2157
          "end": "\\)",
2158
          "endCaptures": {
2159
            "0": {
2160
              "name": "punctuation.definition.subshell.single.shell"
2161
            }
2162
          },
2163
          "name": "meta.scope.subshell",
2164
          "patterns": [
2165
            {
2166
              "include": "#parenthese"
2167
            },
2168
            {
2169
              "include": "#initial_context"
2170
            }
2171
          ]
2172
        }
2173
      ]
2174
    },
2175
    "support": {
2176
      "patterns": [
2177
        {
2178
          "match": "(?<=^|[\\&;\\s])[.:](?=[\\&;\\s]|$)",
2179
          "name": "support.function.builtin.shell"
2180
        }
2181
      ]
2182
    },
2183
    "typical_statements": {
2184
      "patterns": [
2185
        {
2186
          "include": "#assignment_statement"
2187
        },
2188
        {
2189
          "include": "#case_statement"
2190
        },
2191
        {
2192
          "include": "#for_statement"
2193
        },
2194
        {
2195
          "include": "#while_statement"
2196
        },
2197
        {
2198
          "include": "#function_definition"
2199
        },
2200
        {
2201
          "include": "#command_statement"
2202
        },
2203
        {
2204
          "include": "#line_continuation"
2205
        },
2206
        {
2207
          "include": "#arithmetic_double"
2208
        },
2209
        {
2210
          "include": "#normal_context"
2211
        }
2212
      ]
2213
    },
2214
    "variable": {
2215
      "patterns": [
2216
        {
2217
          "captures": {
2218
            "1": {
2219
              "name": "punctuation.definition.variable.shell variable.parameter.positional.all.shell"
2220
            },
2221
            "2": {
2222
              "name": "variable.parameter.positional.all.shell"
2223
            }
2224
          },
2225
          "match": "(\\$)(@(?!\\w))"
2226
        },
2227
        {
2228
          "captures": {
2229
            "1": {
2230
              "name": "punctuation.definition.variable.shell variable.parameter.positional.shell"
2231
            },
2232
            "2": {
2233
              "name": "variable.parameter.positional.shell"
2234
            }
2235
          },
2236
          "match": "(\\$)([0-9](?!\\w))"
2237
        },
2238
        {
2239
          "captures": {
2240
            "1": {
2241
              "name": "punctuation.definition.variable.shell variable.language.special.shell"
2242
            },
2243
            "2": {
2244
              "name": "variable.language.special.shell"
2245
            }
2246
          },
2247
          "match": "(\\$)([-!#$*0?_](?!\\w))"
2248
        },
2249
        {
2250
          "begin": "(\\$)(\\{)[\\t ]*+(?=\\d)",
2251
          "beginCaptures": {
2252
            "1": {
2253
              "name": "punctuation.definition.variable.shell variable.parameter.positional.shell"
2254
            },
2255
            "2": {
2256
              "name": "punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell variable.parameter.positional.shell"
2257
            }
2258
          },
2259
          "contentName": "meta.parameter-expansion",
2260
          "end": "}",
2261
          "endCaptures": {
2262
            "0": {
2263
              "name": "punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell variable.parameter.positional.shell"
2264
            }
2265
          },
2266
          "patterns": [
2267
            {
2268
              "include": "#special_expansion"
2269
            },
2270
            {
2271
              "include": "#array_access_inline"
2272
            },
2273
            {
2274
              "match": "[0-9]+",
2275
              "name": "variable.parameter.positional.shell"
2276
            },
2277
            {
2278
              "match": "(?<!\\w)[-0-9A-Z_a-z]+(?!\\w)",
2279
              "name": "variable.other.normal.shell"
2280
            },
2281
            {
2282
              "include": "#variable"
2283
            },
2284
            {
2285
              "include": "#string"
2286
            }
2287
          ]
2288
        },
2289
        {
2290
          "begin": "(\\$)(\\{)",
2291
          "beginCaptures": {
2292
            "1": {
2293
              "name": "punctuation.definition.variable.shell"
2294
            },
2295
            "2": {
2296
              "name": "punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell"
2297
            }
2298
          },
2299
          "contentName": "meta.parameter-expansion",
2300
          "end": "}",
2301
          "endCaptures": {
2302
            "0": {
2303
              "name": "punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell"
2304
            }
2305
          },
2306
          "patterns": [
2307
            {
2308
              "include": "#special_expansion"
2309
            },
2310
            {
2311
              "include": "#array_access_inline"
2312
            },
2313
            {
2314
              "match": "(?<!\\w)[-0-9A-Z_a-z]+(?!\\w)",
2315
              "name": "variable.other.normal.shell"
2316
            },
2317
            {
2318
              "include": "#variable"
2319
            },
2320
            {
2321
              "include": "#string"
2322
            }
2323
          ]
2324
        },
2325
        {
2326
          "captures": {
2327
            "1": {
2328
              "name": "punctuation.definition.variable.shell variable.other.normal.shell"
2329
            },
2330
            "2": {
2331
              "name": "variable.other.normal.shell"
2332
            }
2333
          },
2334
          "match": "(\\$)(\\w+(?!\\w))"
2335
        }
2336
      ]
2337
    },
2338
    "while_statement": {
2339
      "patterns": [
2340
        {
2341
          "begin": "\\b(while)\\b",
2342
          "beginCaptures": {
2343
            "1": {
2344
              "name": "keyword.control.while.shell"
2345
            }
2346
          },
2347
          "end": "(?=[\\n\\&);`{|}]|[\\t ]*#|])(?<!\\\\)",
2348
          "endCaptures": {
2349
          },
2350
          "name": "meta.while.shell",
2351
          "patterns": [
2352
            {
2353
              "include": "#line_continuation"
2354
            },
2355
            {
2356
              "include": "#math_operators"
2357
            },
2358
            {
2359
              "include": "#option"
2360
            },
2361
            {
2362
              "include": "#simple_unquoted"
2363
            },
2364
            {
2365
              "include": "#normal_context"
2366
            },
2367
            {
2368
              "include": "#string"
2369
            }
2370
          ]
2371
        }
2372
      ]
2373
    }
2374
  },
2375
  "scopeName": "source.shell"
2376
}