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