@robot-inventor/shell-session-syntax 1.0.0

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