PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.6.0
Code Block Pro – Beautiful Syntax Highlighting v1.6.0
1.27.1 1.27.2 1.27.3 1.27.4 1.27.5 1.27.6 1.27.7 1.28.0 1.3.0 1.4.0 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.8.0 1.9.0 1.9.1 1.9.2 1.9.3 trunk 1.1.0 1.10.0 1.11.0 1.11.1 All 63 releases
code-block-pro / build / shiki / languages / shellscript.tmLanguage.json

shellscript.tmLanguage.json in Code Block Pro – Beautiful Syntax Highlighting 1.6.0, at build/shiki/languages/shellscript.tmLanguage.json

1,344 lines 35.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 {
2 "information_for_contributors": [
3 "This file has been converted from https://github.com/atom/language-shellscript/blob/master/grammars/shell-unix-bash.cson",
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/atom/language-shellscript/commit/4f8d7bb5cc4d1643674551683df10fe552dd5a6f",
8 "name": "shellscript",
9 "scopeName": "source.shell",
10 "patterns": [
11 {
12 "include": "#comment"
13 },
14 {
15 "include": "#pipeline"
16 },
17 {
18 "include": "#list"
19 },
20 {
21 "include": "#compound-command"
22 },
23 {
24 "include": "#loop"
25 },
26 {
27 "include": "#string"
28 },
29 {
30 "include": "#function-definition"
31 },
32 {
33 "include": "#variable"
34 },
35 {
36 "include": "#interpolation"
37 },
38 {
39 "include": "#heredoc"
40 },
41 {
42 "include": "#herestring"
43 },
44 {
45 "include": "#redirection"
46 },
47 {
48 "include": "#pathname"
49 },
50 {
51 "include": "#keyword"
52 },
53 {
54 "include": "#support"
55 }
56 ],
57 "repository": {
58 "case-clause": {
59 "patterns": [
60 {
61 "begin": "(?=\\S)",
62 "end": ";;",
63 "endCaptures": {
64 "0": {
65 "name": "punctuation.terminator.case-clause.shell"
66 }
67 },
68 "name": "meta.scope.case-clause.shell",
69 "patterns": [
70 {
71 "begin": "\\(|(?=\\S)",
72 "beginCaptures": {
73 "0": {
74 "name": "punctuation.definition.case-pattern.shell"
75 }
76 },
77 "end": "\\)",
78 "endCaptures": {
79 "0": {
80 "name": "punctuation.definition.case-pattern.shell"
81 }
82 },
83 "name": "meta.scope.case-pattern.shell",
84 "patterns": [
85 {
86 "match": "\\|",
87 "name": "punctuation.separator.pipe-sign.shell"
88 },
89 {
90 "include": "#string"
91 },
92 {
93 "include": "#variable"
94 },
95 {
96 "include": "#interpolation"
97 },
98 {
99 "include": "#pathname"
100 }
101 ]
102 },
103 {
104 "begin": "(?<=\\))",
105 "end": "(?=;;)",
106 "name": "meta.scope.case-clause-body.shell",
107 "patterns": [
108 {
109 "include": "$self"
110 }
111 ]
112 }
113 ]
114 }
115 ]
116 },
117 "comment": {
118 "begin": "(^\\s+)?(?<=^|\\W)(?<!-)(?=#)(?!#{)",
119 "beginCaptures": {
120 "1": {
121 "name": "punctuation.whitespace.comment.leading.shell"
122 }
123 },
124 "end": "(?!\\G)",
125 "patterns": [
126 {
127 "begin": "#!",
128 "beginCaptures": {
129 "0": {
130 "name": "punctuation.definition.comment.shebang.shell"
131 }
132 },
133 "end": "$",
134 "name": "comment.line.number-sign.shebang.shell"
135 },
136 {
137 "begin": "#",
138 "beginCaptures": {
139 "0": {
140 "name": "punctuation.definition.comment.shell"
141 }
142 },
143 "end": "$",
144 "name": "comment.line.number-sign.shell"
145 }
146 ]
147 },
148 "compound-command": {
149 "patterns": [
150 {
151 "begin": "\\[{1,2}",
152 "beginCaptures": {
153 "0": {
154 "name": "punctuation.definition.logical-expression.shell"
155 }
156 },
157 "end": "\\]{1,2}",
158 "endCaptures": {
159 "0": {
160 "name": "punctuation.definition.logical-expression.shell"
161 }
162 },
163 "name": "meta.scope.logical-expression.shell",
164 "patterns": [
165 {
166 "include": "#logical-expression"
167 },
168 {
169 "include": "$self"
170 }
171 ]
172 },
173 {
174 "begin": "\\({2}",
175 "beginCaptures": {
176 "0": {
177 "name": "punctuation.definition.string.begin.shell"
178 }
179 },
180 "end": "\\){2}",
181 "endCaptures": {
182 "0": {
183 "name": "punctuation.definition.string.end.shell"
184 }
185 },
186 "name": "string.other.math.shell",
187 "patterns": [
188 {
189 "include": "#math"
190 }
191 ]
192 },
193 {
194 "begin": "\\(",
195 "beginCaptures": {
196 "0": {
197 "name": "punctuation.definition.subshell.shell"
198 }
199 },
200 "end": "\\)",
201 "endCaptures": {
202 "0": {
203 "name": "punctuation.definition.subshell.shell"
204 }
205 },
206 "name": "meta.scope.subshell.shell",
207 "patterns": [
208 {
209 "include": "$self"
210 }
211 ]
212 },
213 {
214 "begin": "(?<=\\s|^){(?=\\s|$)",
215 "beginCaptures": {
216 "0": {
217 "name": "punctuation.definition.group.shell"
218 }
219 },
220 "end": "(?<=^|;)\\s*(})",
221 "endCaptures": {
222 "1": {
223 "name": "punctuation.definition.group.shell"
224 }
225 },
226 "name": "meta.scope.group.shell",
227 "patterns": [
228 {
229 "include": "$self"
230 }
231 ]
232 }
233 ]
234 },
235 "function-definition": {
236 "patterns": [
237 {
238 "begin": "(?<=^|;|&|\\s)(function)\\s+([^\\s\\\\]+)(?:\\s*(\\(\\)))?",
239 "beginCaptures": {
240 "1": {
241 "name": "storage.type.function.shell"
242 },
243 "2": {
244 "name": "entity.name.function.shell"
245 },
246 "3": {
247 "name": "punctuation.definition.arguments.shell"
248 }
249 },
250 "end": ";|&|$",
251 "endCaptures": {
252 "0": {
253 "name": "punctuation.definition.function.shell"
254 }
255 },
256 "name": "meta.function.shell",
257 "patterns": [
258 {
259 "include": "$self"
260 }
261 ]
262 },
263 {
264 "begin": "(?<=^|;|&|\\s)([^\\s\\\\=]+)\\s*(\\(\\))",
265 "beginCaptures": {
266 "1": {
267 "name": "entity.name.function.shell"
268 },
269 "2": {
270 "name": "punctuation.definition.arguments.shell"
271 }
272 },
273 "end": ";|&|$",
274 "endCaptures": {
275 "0": {
276 "name": "punctuation.definition.function.shell"
277 }
278 },
279 "name": "meta.function.shell",
280 "patterns": [
281 {
282 "include": "$self"
283 }
284 ]
285 }
286 ]
287 },
288 "heredoc": {
289 "patterns": [
290 {
291 "begin": "(<<)-\\s*(\"|'|)\\s*(RUBY)(?=\\s|;|&|<|\"|')\\2",
292 "beginCaptures": {
293 "1": {
294 "name": "keyword.operator.heredoc.shell"
295 },
296 "3": {
297 "name": "keyword.control.heredoc-token.shell"
298 }
299 },
300 "end": "^\\t*(RUBY)(?=\\s|;|&|$)",
301 "endCaptures": {
302 "1": {
303 "name": "keyword.control.heredoc-token.shell"
304 }
305 },
306 "name": "string.unquoted.heredoc.no-indent.ruby.shell",
307 "contentName": "source.ruby.embedded.shell",
308 "patterns": [
309 {
310 "include": "source.ruby"
311 }
312 ]
313 },
314 {
315 "begin": "(<<)\\s*(\"|'|)\\s*(RUBY)(?=\\s|;|&|<|\"|')\\2",
316 "beginCaptures": {
317 "1": {
318 "name": "keyword.operator.heredoc.shell"
319 },
320 "3": {
321 "name": "keyword.control.heredoc-token.shell"
322 }
323 },
324 "end": "^(RUBY)(?=\\s|;|&|$)",
325 "endCaptures": {
326 "1": {
327 "name": "keyword.control.heredoc-token.shell"
328 }
329 },
330 "name": "string.unquoted.heredoc.ruby.shell",
331 "contentName": "source.ruby.embedded.shell",
332 "patterns": [
333 {
334 "include": "source.ruby"
335 }
336 ]
337 },
338 {
339 "begin": "(<<)-\\s*(\"|'|)\\s*(PYTHON)(?=\\s|;|&|<|\"|')\\2",
340 "beginCaptures": {
341 "1": {
342 "name": "keyword.operator.heredoc.shell"
343 },
344 "3": {
345 "name": "keyword.control.heredoc-token.shell"
346 }
347 },
348 "end": "^\\t*(PYTHON)(?=\\s|;|&|$)",
349 "endCaptures": {
350 "1": {
351 "name": "keyword.control.heredoc-token.shell"
352 }
353 },
354 "name": "string.unquoted.heredoc.no-indent.python.shell",
355 "contentName": "source.python.embedded.shell",
356 "patterns": [
357 {
358 "include": "source.python"
359 }
360 ]
361 },
362 {
363 "begin": "(<<)\\s*(\"|'|)\\s*(PYTHON)(?=\\s|;|&|<|\"|')\\2",
364 "beginCaptures": {
365 "1": {
366 "name": "keyword.operator.heredoc.shell"
367 },
368 "3": {
369 "name": "keyword.control.heredoc-token.shell"
370 }
371 },
372 "end": "^(PYTHON)(?=\\s|;|&|$)",
373 "endCaptures": {
374 "1": {
375 "name": "keyword.control.heredoc-token.shell"
376 }
377 },
378 "name": "string.unquoted.heredoc.python.shell",
379 "contentName": "source.python.embedded.shell",
380 "patterns": [
381 {
382 "include": "source.python"
383 }
384 ]
385 },
386 {
387 "begin": "(<<)-\\s*(\"|'|)\\s*(APPLESCRIPT)(?=\\s|;|&|<|\"|')\\2",
388 "beginCaptures": {
389 "1": {
390 "name": "keyword.operator.heredoc.shell"
391 },
392 "3": {
393 "name": "keyword.control.heredoc-token.shell"
394 }
395 },
396 "end": "^\\t*(APPLESCRIPT)(?=\\s|;|&|$)",
397 "endCaptures": {
398 "1": {
399 "name": "keyword.control.heredoc-token.shell"
400 }
401 },
402 "name": "string.unquoted.heredoc.no-indent.applescript.shell",
403 "contentName": "source.applescript.embedded.shell",
404 "patterns": [
405 {
406 "include": "source.applescript"
407 }
408 ]
409 },
410 {
411 "begin": "(<<)\\s*(\"|'|)\\s*(APPLESCRIPT)(?=\\s|;|&|<|\"|')\\2",
412 "beginCaptures": {
413 "1": {
414 "name": "keyword.operator.heredoc.shell"
415 },
416 "3": {
417 "name": "keyword.control.heredoc-token.shell"
418 }
419 },
420 "end": "^(APPLESCRIPT)(?=\\s|;|&|$)",
421 "endCaptures": {
422 "1": {
423 "name": "keyword.control.heredoc-token.shell"
424 }
425 },
426 "name": "string.unquoted.heredoc.applescript.shell",
427 "contentName": "source.applescript.embedded.shell",
428 "patterns": [
429 {
430 "include": "source.applescript"
431 }
432 ]
433 },
434 {
435 "begin": "(<<)-\\s*(\"|'|)\\s*(HTML)(?=\\s|;|&|<|\"|')\\2",
436 "beginCaptures": {
437 "1": {
438 "name": "keyword.operator.heredoc.shell"
439 },
440 "3": {
441 "name": "keyword.control.heredoc-token.shell"
442 }
443 },
444 "end": "^\\t*(HTML)(?=\\s|;|&|$)",
445 "endCaptures": {
446 "1": {
447 "name": "keyword.control.heredoc-token.shell"
448 }
449 },
450 "name": "string.unquoted.heredoc.no-indent.html.shell",
451 "contentName": "text.html.embedded.shell",
452 "patterns": [
453 {
454 "include": "text.html.basic"
455 }
456 ]
457 },
458 {
459 "begin": "(<<)\\s*(\"|'|)\\s*(HTML)(?=\\s|;|&|<|\"|')\\2",
460 "beginCaptures": {
461 "1": {
462 "name": "keyword.operator.heredoc.shell"
463 },
464 "3": {
465 "name": "keyword.control.heredoc-token.shell"
466 }
467 },
468 "end": "^(HTML)(?=\\s|;|&|$)",
469 "endCaptures": {
470 "1": {
471 "name": "keyword.control.heredoc-token.shell"
472 }
473 },
474 "name": "string.unquoted.heredoc.html.shell",
475 "contentName": "text.html.embedded.shell",
476 "patterns": [
477 {
478 "include": "text.html.basic"
479 }
480 ]
481 },
482 {
483 "begin": "(<<)-\\s*(\"|'|)\\s*(MARKDOWN)(?=\\s|;|&|<|\"|')\\2",
484 "beginCaptures": {
485 "1": {
486 "name": "keyword.operator.heredoc.shell"
487 },
488 "3": {
489 "name": "keyword.control.heredoc-token.shell"
490 }
491 },
492 "end": "^\\t*(MARKDOWN)(?=\\s|;|&|$)",
493 "endCaptures": {
494 "1": {
495 "name": "keyword.control.heredoc-token.shell"
496 }
497 },
498 "name": "string.unquoted.heredoc.no-indent.markdown.shell",
499 "contentName": "text.html.markdown.embedded.shell",
500 "patterns": [
501 {
502 "include": "text.html.markdown"
503 }
504 ]
505 },
506 {
507 "begin": "(<<)\\s*(\"|'|)\\s*(MARKDOWN)(?=\\s|;|&|<|\"|')\\2",
508 "beginCaptures": {
509 "1": {
510 "name": "keyword.operator.heredoc.shell"
511 },
512 "3": {
513 "name": "keyword.control.heredoc-token.shell"
514 }
515 },
516 "end": "^(MARKDOWN)(?=\\s|;|&|$)",
517 "endCaptures": {
518 "1": {
519 "name": "keyword.control.heredoc-token.shell"
520 }
521 },
522 "name": "string.unquoted.heredoc.markdown.shell",
523 "contentName": "text.html.markdown.embedded.shell",
524 "patterns": [
525 {
526 "include": "text.html.markdown"
527 }
528 ]
529 },
530 {
531 "begin": "(<<)-\\s*(\"|'|)\\s*(TEXTILE)(?=\\s|;|&|<|\"|')\\2",
532 "beginCaptures": {
533 "1": {
534 "name": "keyword.operator.heredoc.shell"
535 },
536 "3": {
537 "name": "keyword.control.heredoc-token.shell"
538 }
539 },
540 "end": "^\\t*(TEXTILE)(?=\\s|;|&|$)",
541 "endCaptures": {
542 "1": {
543 "name": "keyword.control.heredoc-token.shell"
544 }
545 },
546 "name": "string.unquoted.heredoc.no-indent.textile.shell",
547 "contentName": "text.html.textile.embedded.shell",
548 "patterns": [
549 {
550 "include": "text.html.textile"
551 }
552 ]
553 },
554 {
555 "begin": "(<<)\\s*(\"|'|)\\s*(TEXTILE)(?=\\s|;|&|<|\"|')\\2",
556 "beginCaptures": {
557 "1": {
558 "name": "keyword.operator.heredoc.shell"
559 },
560 "3": {
561 "name": "keyword.control.heredoc-token.shell"
562 }
563 },
564 "end": "^(TEXTILE)(?=\\s|;|&|$)",
565 "endCaptures": {
566 "1": {
567 "name": "keyword.control.heredoc-token.shell"
568 }
569 },
570 "name": "string.unquoted.heredoc.textile.shell",
571 "contentName": "text.html.textile.embedded.shell",
572 "patterns": [
573 {
574 "include": "text.html.textile"
575 }
576 ]
577 },
578 {
579 "begin": "(<<)-\\s*(\"|'|)\\s*(SHELL)(?=\\s|;|&|<|\"|')\\2",
580 "beginCaptures": {
581 "1": {
582 "name": "keyword.operator.heredoc.shell"
583 },
584 "3": {
585 "name": "keyword.control.heredoc-token.shell"
586 }
587 },
588 "end": "^\\t*(\\3)(?=\\s|;|&|$)",
589 "endCaptures": {
590 "1": {
591 "name": "keyword.control.heredoc-token.shell"
592 }
593 },
594 "contentName": "source.shell.embedded.shell",
595 "name": "string.unquoted.heredoc.no-indent.shell.shell",
596 "patterns": [
597 {
598 "include": "source.shell"
599 }
600 ]
601 },
602 {
603 "begin": "(<<)\\s*(\"|'|)\\s*(SHELL)(?=\\s|;|&|<|\"|')\\2",
604 "beginCaptures": {
605 "1": {
606 "name": "keyword.operator.heredoc.shell"
607 },
608 "3": {
609 "name": "keyword.control.heredoc-token.shell"
610 }
611 },
612 "end": "^(\\3)(?=\\s|;|&|$)",
613 "endCaptures": {
614 "1": {
615 "name": "keyword.control.heredoc-token.shell"
616 }
617 },
618 "name": "string.unquoted.heredoc.shell.shell",
619 "contentName": "source.shell.embedded.shell",
620 "patterns": [
621 {
622 "include": "source.shell"
623 }
624 ]
625 },
626 {
627 "begin": "(<<)-\\s*(\"|')\\s*\\\\?([^;&<\\s]+)\\2",
628 "beginCaptures": {
629 "1": {
630 "name": "keyword.operator.heredoc.shell"
631 },
632 "3": {
633 "name": "keyword.control.heredoc-token.shell"
634 }
635 },
636 "end": "^\\t*(\\3)(?=\\s|;|&|$)",
637 "endCaptures": {
638 "1": {
639 "name": "keyword.control.heredoc-token.shell"
640 }
641 },
642 "name": "string.unquoted.heredoc.no-indent.shell"
643 },
644 {
645 "begin": "(<<)\\s*(\"|')\\s*\\\\?([^;&<\\s]+)\\2",
646 "beginCaptures": {
647 "1": {
648 "name": "keyword.operator.heredoc.shell"
649 },
650 "3": {
651 "name": "keyword.control.heredoc-token.shell"
652 }
653 },
654 "end": "^(\\3)(?=\\s|;|&|$)",
655 "endCaptures": {
656 "1": {
657 "name": "keyword.control.heredoc-token.shell"
658 }
659 },
660 "name": "string.unquoted.heredoc.shell"
661 },
662 {
663 "begin": "(<<)-\\s*\\\\?([^;&<\\s]+)",
664 "beginCaptures": {
665 "1": {
666 "name": "keyword.operator.heredoc.shell"
667 },
668 "2": {
669 "name": "keyword.control.heredoc-token.shell"
670 }
671 },
672 "end": "^\\t*(\\2)(?=\\s|;|&|$)",
673 "endCaptures": {
674 "1": {
675 "name": "keyword.control.heredoc-token.shell"
676 }
677 },
678 "name": "string.unquoted.heredoc.expanded.no-indent.shell",
679 "patterns": [
680 {
681 "match": "\\\\[\\$`\\\\\\n]",
682 "name": "constant.character.escape.shell"
683 },
684 {
685 "include": "#variable"
686 },
687 {
688 "include": "#interpolation"
689 }
690 ]
691 },
692 {
693 "begin": "(<<)\\s*\\\\?([^;&<\\s]+)",
694 "beginCaptures": {
695 "1": {
696 "name": "keyword.operator.heredoc.shell"
697 },
698 "2": {
699 "name": "keyword.control.heredoc-token.shell"
700 }
701 },
702 "end": "^(\\2)(?=\\s|;|&|$)",
703 "endCaptures": {
704 "1": {
705 "name": "keyword.control.heredoc-token.shell"
706 }
707 },
708 "name": "string.unquoted.heredoc.expanded.shell",
709 "patterns": [
710 {
711 "match": "\\\\[\\$`\\\\\\n]",
712 "name": "constant.character.escape.shell"
713 },
714 {
715 "include": "#variable"
716 },
717 {
718 "include": "#interpolation"
719 }
720 ]
721 }
722 ]
723 },
724 "herestring": {
725 "patterns": [
726 {
727 "begin": "(<<<)\\s*(('))",
728 "beginCaptures": {
729 "1": {
730 "name": "keyword.operator.herestring.shell"
731 },
732 "2": {
733 "name": "string.quoted.single.shell"
734 },
735 "3": {
736 "name": "punctuation.definition.string.begin.shell"
737 }
738 },
739 "end": "(')",
740 "endCaptures": {
741 "0": {
742 "name": "string.quoted.single.shell"
743 },
744 "1": {
745 "name": "punctuation.definition.string.end.shell"
746 }
747 },
748 "name": "meta.herestring.shell",
749 "contentName": "string.quoted.single.shell"
750 },
751 {
752 "begin": "(<<<)\\s*((\"))",
753 "beginCaptures": {
754 "1": {
755 "name": "keyword.operator.herestring.shell"
756 },
757 "2": {
758 "name": "string.quoted.double.shell"
759 },
760 "3": {
761 "name": "punctuation.definition.string.begin.shell"
762 }
763 },
764 "end": "(\")",
765 "endCaptures": {
766 "0": {
767 "name": "string.quoted.double.shell"
768 },
769 "1": {
770 "name": "punctuation.definition.string.end.shell"
771 }
772 },
773 "name": "meta.herestring.shell",
774 "contentName": "string.quoted.double.shell"
775 },
776 {
777 "captures": {
778 "1": {
779 "name": "keyword.operator.herestring.shell"
780 },
781 "2": {
782 "name": "string.unquoted.herestring.shell",
783 "patterns": [
784 {
785 "include": "$self"
786 }
787 ]
788 }
789 },
790 "match": "(<<<)\\s*(([^\\s)\\\\]|\\\\.)+)",
791 "name": "meta.herestring.shell"
792 }
793 ]
794 },
795 "interpolation": {
796 "patterns": [
797 {
798 "begin": "\\$\\({2}",
799 "beginCaptures": {
800 "0": {
801 "name": "punctuation.definition.string.begin.shell"
802 }
803 },
804 "end": "\\){2}",
805 "endCaptures": {
806 "0": {
807 "name": "punctuation.definition.string.end.shell"
808 }
809 },
810 "name": "string.other.math.shell",
811 "patterns": [
812 {
813 "include": "#math"
814 }
815 ]
816 },
817 {
818 "begin": "`",
819 "beginCaptures": {
820 "0": {
821 "name": "punctuation.definition.string.begin.shell"
822 }
823 },
824 "end": "`",
825 "endCaptures": {
826 "0": {
827 "name": "punctuation.definition.string.end.shell"
828 }
829 },
830 "name": "string.interpolated.backtick.shell",
831 "patterns": [
832 {
833 "match": "\\\\[`\\\\$]",
834 "name": "constant.character.escape.shell"
835 },
836 {
837 "begin": "(?<=\\W)(?=#)(?!#{)",
838 "beginCaptures": {
839 "1": {
840 "name": "punctuation.whitespace.comment.leading.shell"
841 }
842 },
843 "end": "(?!\\G)",
844 "patterns": [
845 {
846 "begin": "#",
847 "beginCaptures": {
848 "0": {
849 "name": "punctuation.definition.comment.shell"
850 }
851 },
852 "end": "(?=`)",
853 "name": "comment.line.number-sign.shell"
854 }
855 ]
856 },
857 {
858 "include": "$self"
859 }
860 ]
861 },
862 {
863 "begin": "\\$\\(",
864 "beginCaptures": {
865 "0": {
866 "name": "punctuation.definition.string.begin.shell"
867 }
868 },
869 "end": "\\)",
870 "endCaptures": {
871 "0": {
872 "name": "punctuation.definition.string.end.shell"
873 }
874 },
875 "name": "string.interpolated.dollar.shell",
876 "patterns": [
877 {
878 "include": "$self"
879 }
880 ]
881 }
882 ]
883 },
884 "keyword": {
885 "patterns": [
886 {
887 "match": "(?<=^|;|&|\\s)(then|else|elif|fi|for|in|do|done|select|case|continue|esac|while|until|return)(?=\\s|;|&|$)",
888 "name": "keyword.control.shell"
889 },
890 {
891 "match": "(?<=^|;|&|\\s)(?:export|declare|typeset|local|readonly)(?=\\s|;|&|$)",
892 "name": "storage.modifier.shell"
893 }
894 ]
895 },
896 "list": {
897 "patterns": [
898 {
899 "match": ";|&&|&|\\|\\|",
900 "name": "keyword.operator.list.shell"
901 }
902 ]
903 },
904 "logical-expression": {
905 "patterns": [
906 {
907 "comment": "do we want a special rule for ( expr )?",
908 "match": "=[=~]?|!=?|<|>|&&|\\|\\|",
909 "name": "keyword.operator.logical.shell"
910 },
911 {
912 "match": "(?<!\\S)-(nt|ot|ef|eq|ne|l[te]|g[te]|[a-hknoprstuwxzOGLSN])",
913 "name": "keyword.operator.logical.shell"
914 }
915 ]
916 },
917 "loop": {
918 "patterns": [
919 {
920 "begin": "(?<=^|;|&|\\s)(for)\\s+(?=\\({2})",
921 "beginCaptures": {
922 "1": {
923 "name": "keyword.control.shell"
924 }
925 },
926 "end": "(?<=^|;|&|\\s)done(?=\\s|;|&|$)",
927 "endCaptures": {
928 "0": {
929 "name": "keyword.control.shell"
930 }
931 },
932 "name": "meta.scope.for-loop.shell",
933 "patterns": [
934 {
935 "include": "$self"
936 }
937 ]
938 },
939 {
940 "begin": "(?<=^|;|&|\\s)(for)\\s+(.+?)\\s+(in)(?=\\s|;|&|$)",
941 "beginCaptures": {
942 "1": {
943 "name": "keyword.control.shell"
944 },
945 "2": {
946 "name": "variable.other.loop.shell",
947 "patterns": [
948 {
949 "include": "#string"
950 }
951 ]
952 },
953 "3": {
954 "name": "keyword.control.shell"
955 }
956 },
957 "end": "(?<=^|;|&|\\s)done(?=\\s|;|&|$)",
958 "endCaptures": {
959 "0": {
960 "name": "keyword.control.shell"
961 }
962 },
963 "name": "meta.scope.for-in-loop.shell",
964 "patterns": [
965 {
966 "include": "$self"
967 }
968 ]
969 },
970 {
971 "begin": "(?<=^|;|&|\\s)(while|until)(?=\\s|;|&|$)",
972 "beginCaptures": {
973 "1": {
974 "name": "keyword.control.shell"
975 }
976 },
977 "end": "(?<=^|;|&|\\s)done(?=\\s|;|&|$)",
978 "endCaptures": {
979 "0": {
980 "name": "keyword.control.shell"
981 }
982 },
983 "name": "meta.scope.while-loop.shell",
984 "patterns": [
985 {
986 "include": "$self"
987 }
988 ]
989 },
990 {
991 "begin": "(?<=^|;|&|\\s)(select)\\s+((?:[^\\s\\\\]|\\\\.)+)(?=\\s|;|&|$)",
992 "beginCaptures": {
993 "1": {
994 "name": "keyword.control.shell"
995 },
996 "2": {
997 "name": "variable.other.loop.shell"
998 }
999 },
1000 "end": "(?<=^|;|&|\\s)(done)(?=\\s|;|&|$)",
1001 "endCaptures": {
1002 "1": {
1003 "name": "keyword.control.shell"
1004 }
1005 },
1006 "name": "meta.scope.select-block.shell",
1007 "patterns": [
1008 {
1009 "include": "$self"
1010 }
1011 ]
1012 },
1013 {
1014 "begin": "(?<=^|;|&|\\s)case(?=\\s|;|&|$)",
1015 "beginCaptures": {
1016 "0": {
1017 "name": "keyword.control.shell"
1018 }
1019 },
1020 "end": "(?<=^|;|&|\\s)esac(?=\\s|;|&|$)",
1021 "endCaptures": {
1022 "0": {
1023 "name": "keyword.control.shell"
1024 }
1025 },
1026 "name": "meta.scope.case-block.shell",
1027 "patterns": [
1028 {
1029 "begin": "(?<=^|;|&|\\s)in(?=\\s|;|&|$)",
1030 "beginCaptures": {
1031 "0": {
1032 "name": "keyword.control.shell"
1033 }
1034 },
1035 "end": "(?<=^|;|&|\\s)(?=esac(\\s|;|&|$))",
1036 "name": "meta.scope.case-body.shell",
1037 "patterns": [
1038 {
1039 "include": "#comment"
1040 },
1041 {
1042 "include": "#case-clause"
1043 },
1044 {
1045 "include": "$self"
1046 }
1047 ]
1048 },
1049 {
1050 "include": "$self"
1051 }
1052 ]
1053 },
1054 {
1055 "begin": "(?<=^|;|&|\\s)if(?=\\s|;|&|$)",
1056 "beginCaptures": {
1057 "0": {
1058 "name": "keyword.control.shell"
1059 }
1060 },
1061 "end": "(?<=^|;|&|\\s)fi(?=\\s|;|&|$)",
1062 "endCaptures": {
1063 "0": {
1064 "name": "keyword.control.shell"
1065 }
1066 },
1067 "name": "meta.scope.if-block.shell",
1068 "patterns": [
1069 {
1070 "include": "$self"
1071 }
1072 ]
1073 }
1074 ]
1075 },
1076 "math": {
1077 "patterns": [
1078 {
1079 "include": "#variable"
1080 },
1081 {
1082 "match": "\\+{1,2}|-{1,2}|!|~|\\*{1,2}|/|%|<[<=]?|>[>=]?|==|!=|^|\\|{1,2}|&{1,2}|\\?|\\:|,|=|[*/%+\\-&^|]=|<<=|>>=",
1083 "name": "keyword.operator.arithmetic.shell"
1084 },
1085 {
1086 "match": "0[xX][0-9A-Fa-f]+",
1087 "name": "constant.numeric.hex.shell"
1088 },
1089 {
1090 "match": "0\\d+",
1091 "name": "constant.numeric.octal.shell"
1092 },
1093 {
1094 "match": "\\d{1,2}#[0-9a-zA-Z@_]+",
1095 "name": "constant.numeric.other.shell"
1096 },
1097 {
1098 "match": "\\d+",
1099 "name": "constant.numeric.integer.shell"
1100 }
1101 ]
1102 },
1103 "pathname": {
1104 "patterns": [
1105 {
1106 "match": "(?<=\\s|:|=|^)~",
1107 "name": "keyword.operator.tilde.shell"
1108 },
1109 {
1110 "match": "\\*|\\?",
1111 "name": "keyword.operator.glob.shell"
1112 },
1113 {
1114 "begin": "([?*+@!])(\\()",
1115 "beginCaptures": {
1116 "1": {
1117 "name": "keyword.operator.extglob.shell"
1118 },
1119 "2": {
1120 "name": "punctuation.definition.extglob.shell"
1121 }
1122 },
1123 "end": "\\)",
1124 "endCaptures": {
1125 "0": {
1126 "name": "punctuation.definition.extglob.shell"
1127 }
1128 },
1129 "name": "meta.structure.extglob.shell",
1130 "patterns": [
1131 {
1132 "include": "$self"
1133 }
1134 ]
1135 }
1136 ]
1137 },
1138 "pipeline": {
1139 "patterns": [
1140 {
1141 "match": "(?<=^|;|&|\\s)(time)(?=\\s|;|&|$)",
1142 "name": "keyword.other.shell"
1143 },
1144 {
1145 "match": "[|!]",
1146 "name": "keyword.operator.pipe.shell"
1147 }
1148 ]
1149 },
1150 "redirection": {
1151 "patterns": [
1152 {
1153 "begin": "[><]\\(",
1154 "beginCaptures": {
1155 "0": {
1156 "name": "punctuation.definition.string.begin.shell"
1157 }
1158 },
1159 "end": "\\)",
1160 "endCaptures": {
1161 "0": {
1162 "name": "punctuation.definition.string.end.shell"
1163 }
1164 },
1165 "name": "string.interpolated.process-substitution.shell",
1166 "patterns": [
1167 {
1168 "include": "$self"
1169 }
1170 ]
1171 },
1172 {
1173 "match": "(?<![<>])(&>|\\d*>&\\d*|\\d*(>>|>|<)|\\d*<&|\\d*<>)(?![<>])",
1174 "name": "keyword.operator.redirect.shell"
1175 }
1176 ]
1177 },
1178 "string": {
1179 "patterns": [
1180 {
1181 "match": "\\\\.",
1182 "name": "constant.character.escape.shell"
1183 },
1184 {
1185 "begin": "'",
1186 "beginCaptures": {
1187 "0": {
1188 "name": "punctuation.definition.string.begin.shell"
1189 }
1190 },
1191 "end": "'",
1192 "endCaptures": {
1193 "0": {
1194 "name": "punctuation.definition.string.end.shell"
1195 }
1196 },
1197 "name": "string.quoted.single.shell"
1198 },
1199 {
1200 "begin": "\\$?\"",
1201 "beginCaptures": {
1202 "0": {
1203 "name": "punctuation.definition.string.begin.shell"
1204 }
1205 },
1206 "end": "\"",
1207 "endCaptures": {
1208 "0": {
1209 "name": "punctuation.definition.string.end.shell"
1210 }
1211 },
1212 "name": "string.quoted.double.shell",
1213 "patterns": [
1214 {
1215 "match": "\\\\[\\$`\"\\\\\\n]",
1216 "name": "constant.character.escape.shell"
1217 },
1218 {
1219 "include": "#variable"
1220 },
1221 {
1222 "include": "#interpolation"
1223 }
1224 ]
1225 },
1226 {
1227 "begin": "\\$'",
1228 "beginCaptures": {
1229 "0": {
1230 "name": "punctuation.definition.string.begin.shell"
1231 }
1232 },
1233 "end": "'",
1234 "endCaptures": {
1235 "0": {
1236 "name": "punctuation.definition.string.end.shell"
1237 }
1238 },
1239 "name": "string.quoted.single.dollar.shell",
1240 "patterns": [
1241 {
1242 "match": "\\\\(a|b|e|f|n|r|t|v|\\\\|')",
1243 "name": "constant.character.escape.ansi-c.shell"
1244 },
1245 {
1246 "match": "\\\\[0-9]{3}",
1247 "name": "constant.character.escape.octal.shell"
1248 },
1249 {
1250 "match": "\\\\x[0-9a-fA-F]{2}",
1251 "name": "constant.character.escape.hex.shell"
1252 },
1253 {
1254 "match": "\\\\c.",
1255 "name": "constant.character.escape.control-char.shell"
1256 }
1257 ]
1258 }
1259 ]
1260 },
1261 "support": {
1262 "patterns": [
1263 {
1264 "match": "(?<=^|;|&|\\s)(?::|\\.)(?=\\s|;|&|$)",
1265 "name": "support.function.builtin.shell"
1266 },
1267 {
1268 "match": "(?<=^|;|&|\\s)(?:alias|bg|bind|break|builtin|caller|cd|command|compgen|complete|dirs|disown|echo|enable|eval|exec|exit|false|fc|fg|getopts|hash|help|history|jobs|kill|let|logout|popd|printf|pushd|pwd|read|readonly|set|shift|shopt|source|suspend|test|times|trap|true|type|ulimit|umask|unalias|unset|wait)(?=\\s|;|&|$)",
1269 "name": "support.function.builtin.shell"
1270 }
1271 ]
1272 },
1273 "variable": {
1274 "patterns": [
1275 {
1276 "captures": {
1277 "1": {
1278 "name": "punctuation.definition.variable.shell"
1279 }
1280 },
1281 "match": "(\\$)[a-zA-Z_][a-zA-Z0-9_]*",
1282 "name": "variable.other.normal.shell"
1283 },
1284 {
1285 "captures": {
1286 "1": {
1287 "name": "punctuation.definition.variable.shell"
1288 }
1289 },
1290 "match": "(\\$)[-*@#?$!0_]",
1291 "name": "variable.other.special.shell"
1292 },
1293 {
1294 "captures": {
1295 "1": {
1296 "name": "punctuation.definition.variable.shell"
1297 }
1298 },
1299 "match": "(\\$)[1-9]",
1300 "name": "variable.other.positional.shell"
1301 },
1302 {
1303 "begin": "\\${",
1304 "beginCaptures": {
1305 "0": {
1306 "name": "punctuation.definition.variable.shell"
1307 }
1308 },
1309 "end": "}",
1310 "endCaptures": {
1311 "0": {
1312 "name": "punctuation.definition.variable.shell"
1313 }
1314 },
1315 "name": "variable.other.bracket.shell",
1316 "patterns": [
1317 {
1318 "match": "!|:[-=?]?|\\*|@|#{1,2}|%{1,2}|/",
1319 "name": "keyword.operator.expansion.shell"
1320 },
1321 {
1322 "captures": {
1323 "1": {
1324 "name": "punctuation.section.array.shell"
1325 },
1326 "3": {
1327 "name": "punctuation.section.array.shell"
1328 }
1329 },
1330 "match": "(\\[)([^\\]]+)(\\])"
1331 },
1332 {
1333 "include": "#variable"
1334 },
1335 {
1336 "include": "#string"
1337 }
1338 ]
1339 }
1340 ]
1341 }
1342 }
1343 }
1344