PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.13.0
Code Block Pro – Beautiful Syntax Highlighting v1.13.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
← All changes | build/shiki/languages/shellscript.tmLanguage.json +1148 -498 1.9.01.13.0 View file →
@@ -1,61 +1,185 @@
1 1 {
2 2 "information_for_contributors": [
3 - "This file has been converted from https://github.com/atom/language-shellscript/blob/master/grammars/shell-unix-bash.cson",
3 + "This file has been converted from https://github.com/jeff-hykin/better-shell-syntax/blob/master/autogenerated/shell.tmLanguage.json",
4 4 "If you want to provide a fix or improvement, please create a pull request against the original repository.",
5 5 "Once accepted there, we are happy to receive an update request."
6 6 ],
7 - "version": "https://github.com/atom/language-shellscript/commit/4f8d7bb5cc4d1643674551683df10fe552dd5a6f",
7 + "version": "https://github.com/jeff-hykin/better-shell-syntax/commit/b05618771b35b4baa25661dff91170b4924fdac8",
8 8 "name": "shellscript",
9 9 "scopeName": "source.shell",
10 10 "patterns": [
11 11 {
12 - "include": "#comment"
12 + "include": "#initial_context"
13 + }
14 + ],
15 + "repository": {
16 + "alias_statement": {
17 + "begin": "(alias)(?:\\s)+\\s*+((?<!\\w)[a-zA-Z_][a-zA-Z_0-9]*(?!\\w))(?:(\\[)((?:(?:(?:\\$)?(?<!\\w)[a-zA-Z_][a-zA-Z_0-9]*(?!\\w)|@)|\\*))(\\]))?(?:(?:(\\=)|(\\+\\=))|(\\-\\=))",
18 + "end": "(?:(?:(?:(?:(?:(;)|(&&))|(\\|\\|))|(&))|\\n)|(?= |$))",
19 + "beginCaptures": {
20 + "1": {
21 + "name": "storage.type.alias.shell"
22 + },
23 + "2": {
24 + "name": "variable.other.assignment.shell"
25 + },
26 + "3": {
27 + "name": "punctuation.definition.array.access.shell"
28 + },
29 + "4": {
30 + "name": "variable.other.assignment.shell"
31 + },
32 + "5": {
33 + "name": "punctuation.definition.array.access.shell"
34 + },
35 + "6": {
36 + "name": "keyword.operator.assignment.shell"
37 + },
38 + "7": {
39 + "name": "keyword.operator.assignment.compound.shell"
40 + },
41 + "8": {
42 + "name": "keyword.operator.assignment.compound.shell"
43 + }
44 + },
45 + "endCaptures": {
46 + "1": {
47 + "name": "punctuation.terminator.statement.semicolon.shell"
48 + },
49 + "2": {
50 + "name": "punctuation.separator.statement.and.shell"
51 + },
52 + "3": {
53 + "name": "punctuation.separator.statement.or.shell"
54 + },
55 + "4": {
56 + "name": "punctuation.separator.statement.background.shell"
57 + }
58 + },
59 + "name": "meta.expression.assignment.shell",
60 + "patterns": [
61 + {
62 + "include": "#statement_context"
63 + }
64 + ]
13 65 },
14 - {
15 - "include": "#pipeline"
66 + "argument": {
67 + "begin": "\\s++(?!(?:%|&|\\||\\(|\\[|#|\\n|$|;))",
68 + "end": "(?=\\s|;|\\||&|$|\\n|\\)|\\`)",
69 + "beginCaptures": {},
70 + "endCaptures": {},
71 + "name": "meta.argument.shell",
72 + "patterns": [
73 + {
74 + "include": "#argument_context"
75 + },
76 + {
77 + "include": "#line_continuation"
78 + }
79 + ]
16 80 },
17 - {
18 - "include": "#list"
81 + "argument_context": {
82 + "patterns": [
83 + {
84 + "match": "[^ \n'&;<>\\(\\)\\$`\\\\\"\\|]+(?!>)",
85 + "captures": {
86 + "0": {
87 + "patterns": [
88 + {
89 + "match": "\\*",
90 + "name": "variable.language.special.wildcard.shell"
91 + },
92 + {
93 + "include": "#variable"
94 + },
95 + {
96 + "include": "#numeric_literal"
97 + },
98 + {
99 + "match": "(?<!\\w)(\\b(?:true|false)\\b)(?!\\w)",
100 + "captures": {
101 + "1": {
102 + "name": "constant.language.$1.shell"
103 + }
104 + }
105 + }
106 + ]
107 + }
108 + },
109 + "name": "string.unquoted.argument.shell"
110 + },
111 + {
112 + "include": "#statement_context"
113 + }
114 + ]
19 115 },
20 - {
21 - "include": "#compound-command"
116 + "assignment": {
117 + "begin": "\\s*+((?<!\\w)[a-zA-Z_][a-zA-Z_0-9]*(?!\\w))(?:(\\[)((?:(?:(?:\\$)?(?<!\\w)[a-zA-Z_][a-zA-Z_0-9]*(?!\\w)|@)|\\*))(\\]))?(?:(?:(\\=)|(\\+\\=))|(\\-\\=))",
118 + "end": "(?:(?:(?:(?:(?:(;)|(&&))|(\\|\\|))|(&))|\\n)|(?= |$))",
119 + "beginCaptures": {
120 + "1": {
121 + "name": "variable.other.assignment.shell"
122 + },
123 + "2": {
124 + "name": "punctuation.definition.array.access.shell"
125 + },
126 + "3": {
127 + "name": "variable.other.assignment.shell"
128 + },
129 + "4": {
130 + "name": "punctuation.definition.array.access.shell"
131 + },
132 + "5": {
133 + "name": "keyword.operator.assignment.shell"
134 + },
135 + "6": {
136 + "name": "keyword.operator.assignment.compound.shell"
137 + },
138 + "7": {
139 + "name": "keyword.operator.assignment.compound.shell"
140 + }
141 + },
142 + "endCaptures": {
143 + "1": {
144 + "name": "punctuation.terminator.statement.semicolon.shell"
145 + },
146 + "2": {
147 + "name": "punctuation.separator.statement.and.shell"
148 + },
149 + "3": {
150 + "name": "punctuation.separator.statement.or.shell"
151 + },
152 + "4": {
153 + "name": "punctuation.separator.statement.background.shell"
154 + }
155 + },
156 + "name": "meta.expression.assignment.shell",
157 + "patterns": [
158 + {
159 + "include": "#argument_context"
160 + }
161 + ]
22 162 },
23 - {
24 - "include": "#loop"
163 + "block_comment": {
164 + "begin": "\\s*+(\\/\\*)",
165 + "end": "\\*\\/",
166 + "beginCaptures": {
167 + "1": {
168 + "name": "punctuation.definition.comment.begin.shell"
169 + }
170 + },
171 + "endCaptures": {
172 + "0": {
173 + "name": "punctuation.definition.comment.end.shell"
174 + }
175 + },
176 + "name": "comment.block.shell"
25 177 },
26 - {
27 - "include": "#string"
178 + "boolean": {
179 + "match": "\\b(?:true|false)\\b",
180 + "name": "constant.language.$0.shell"
28 181 },
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 182 "case-clause": {
59 183 "patterns": [
60 184 {
61 185 "begin": "(?=\\S)",
@@ -105,9 +229,9 @@
105 229 "end": "(?=;;)",
106 230 "name": "meta.scope.case-clause-body.shell",
107 231 "patterns": [
108 232 {
109 - "include": "$self"
233 + "include": "#initial_context"
110 234 }
111 235 ]
112 236 }
113 237 ]
@@ -113,37 +237,111 @@
113 237 ]
114 238 }
115 239 ]
116 240 },
117 - "comment": {
118 - "begin": "(^\\s+)?(?<=^|\\W)(?<!-)(?=#)(?!#{)",
119 - "beginCaptures": {
120 - "1": {
121 - "name": "punctuation.whitespace.comment.leading.shell"
122 - }
123 - },
124 - "end": "(?!\\G)",
241 + "command_call": {
242 + "begin": "(?!^ *+$)(?<=(?:^|;|\\||&|!|\\(|\\{|\\`))\\s*+(?!nocorrect\\W|nocorrect\\$|readonly\\W|readonly\\$|function\\W|function\\$|foreach\\W|foreach\\$|coproc\\W|coproc\\$|logout\\W|logout\\$|export\\W|export\\$|select\\W|select\\$|repeat\\W|repeat\\$|pushd\\W|pushd\\$|until\\W|until\\$|while\\W|while\\$|local\\W|local\\$|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\\$)",
243 + "end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|#|\\])(?<!\\\\)",
244 + "beginCaptures": {},
245 + "endCaptures": {},
246 + "name": "meta.statement.shell",
125 247 "patterns": [
126 248 {
127 - "begin": "#!",
249 + "begin": "\\s*+(?!(?:!|%|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|\\s))(.+?)(?:(?=\\s)|(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|#|\\])(?<!\\\\))",
250 + "end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|#|\\])(?<!\\\\)",
128 251 "beginCaptures": {
129 252 "0": {
130 - "name": "punctuation.definition.comment.shebang.shell"
253 + "name": "meta.command_name.shell"
254 + },
255 + "1": {
256 + "name": "entity.name.command.shell",
257 + "patterns": [
258 + {
259 + "match": "(?<!\\w)(?:return|break)(?!\\w)",
260 + "name": "keyword.control.$0.shell"
261 + },
262 + {
263 + "match": "(?<!\\w)(?:unfunction|unsetopt|autoload|unlimit|bindkey|builtin|command|getopts|history|declare|unalias|typeset|suspend|return|source|ulimit|unhash|disown|which|alias|break|false|print|shift|times|umask|umask|unset|read|type|exec|eval|wait|echo|dirs|hash|jobs|kill|stat|exit|test|trap|true|pwd|let|set|cd|fg|bg|fc|:|\\.)(?!\\w)",
264 + "name": "support.function.builtin.shell"
265 + },
266 + {
267 + "include": "#variable"
268 + }
269 + ]
131 270 }
132 271 },
133 - "end": "$",
134 - "name": "comment.line.number-sign.shebang.shell"
272 + "endCaptures": {},
273 + "name": "meta.command.shell",
274 + "patterns": [
275 + {
276 + "include": "#line_continuation"
277 + },
278 + {
279 + "include": "#option"
280 + },
281 + {
282 + "include": "#argument"
283 + },
284 + {
285 + "include": "#statement_context"
286 + }
287 + ]
135 288 },
136 289 {
137 - "begin": "#",
138 - "beginCaptures": {
139 - "0": {
140 - "name": "punctuation.definition.comment.shell"
290 + "include": "#line_continuation"
291 + },
292 + {
293 + "include": "#statement_context"
294 + }
295 + ]
296 + },
297 + "command_name": {
298 + "match": "\\s*+(?!(?:!|%|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|\\s))(.+?)(?:(?=\\s)|(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|#|\\])(?<!\\\\))",
299 + "captures": {
300 + "1": {
301 + "name": "entity.name.command.shell",
302 + "patterns": [
303 + {
304 + "match": "(?<!\\w)(?:return|break)(?!\\w)",
305 + "name": "keyword.control.$0.shell"
306 + },
307 + {
308 + "match": "(?<!\\w)(?:unfunction|unsetopt|autoload|unlimit|bindkey|builtin|command|getopts|history|declare|unalias|typeset|suspend|return|source|ulimit|unhash|disown|which|alias|break|false|print|shift|times|umask|umask|unset|read|type|exec|eval|wait|echo|dirs|hash|jobs|kill|stat|exit|test|trap|true|pwd|let|set|cd|fg|bg|fc|:|\\.)(?!\\w)",
309 + "name": "support.function.builtin.shell"
310 + },
311 + {
312 + "include": "#variable"
141 313 }
142 - },
143 - "end": "$",
314 + ]
315 + }
316 + },
317 + "name": "meta.command_name.shell"
318 + },
319 + "comment": {
320 + "match": "(?<=^|\\s)(?:((#!).*)|((#).*))",
321 + "captures": {
322 + "1": {
323 + "name": "comment.line.number-sign.shell meta.shebang.shell"
324 + },
325 + "2": {
326 + "name": "punctuation.definition.comment.shebang.shell"
327 + },
328 + "3": {
144 329 "name": "comment.line.number-sign.shell"
330 + },
331 + "4": {
332 + "name": "punctuation.definition.comment.shell"
145 333 }
334 + }
335 + },
336 + "comments": {
337 + "patterns": [
338 + {
339 + "include": "#block_comment"
340 + },
341 + {
342 + "include": "#line_comment"
343 + }
146 344 ]
147 345 },
148 346 "compound-command": {
149 347 "patterns": [
@@ -165,9 +363,9 @@
165 363 {
166 364 "include": "#logical-expression"
167 365 },
168 366 {
169 - "include": "$self"
367 + "include": "#initial_context"
170 368 }
171 369 ]
172 370 },
173 371 {
@@ -205,9 +403,9 @@
205 403 },
206 404 "name": "meta.scope.subshell.shell",
207 405 "patterns": [
208 406 {
209 - "include": "$self"
407 + "include": "#initial_context"
210 408 }
211 409 ]
212 410 },
213 411 {
@@ -225,18 +423,28 @@
225 423 },
226 424 "name": "meta.scope.group.shell",
227 425 "patterns": [
228 426 {
229 - "include": "$self"
427 + "include": "#initial_context"
230 428 }
231 429 ]
232 430 }
233 431 ]
234 432 },
433 + "custom_command_names": {
434 + "patterns": []
435 + },
436 + "custom_commands": {
437 + "patterns": []
438 + },
439 + "double_quote_escape_char": {
440 + "match": "\\\\[\\$`\"\\\\\\n]",
441 + "name": "constant.character.escape.shell"
442 + },
235 443 "function-definition": {
236 444 "patterns": [
237 445 {
238 - "begin": "(?<=^|;|&|\\s)(function)\\s+([^\\s\\\\]+)(?:\\s*(\\(\\)))?",
446 + "begin": "(?:^\\s*|(?<=^|;|&|\\s))(function)\\s+([^\\s\\\\]+)(?:\\s*(\\(\\)))?",
239 447 "beginCaptures": {
240 448 "1": {
241 449 "name": "storage.type.function.shell"
242 450 },
@@ -255,14 +463,14 @@
255 463 },
256 464 "name": "meta.function.shell",
257 465 "patterns": [
258 466 {
259 - "include": "$self"
467 + "include": "#initial_context"
260 468 }
261 469 ]
262 470 },
263 471 {
264 - "begin": "(?<=^|;|&|\\s)([^\\s\\\\=]+)\\s*(\\(\\))",
472 + "begin": "(?:^\\s*|(?<=^|;|&|\\s))([^\\s\\\\=]+)\\s*(\\(\\))",
265 473 "beginCaptures": {
266 474 "1": {
267 475 "name": "entity.name.function.shell"
268 476 },
@@ -278,9 +486,9 @@
278 486 },
279 487 "name": "meta.function.shell",
280 488 "patterns": [
281 489 {
282 - "include": "$self"
490 + "include": "#initial_context"
283 491 }
284 492 ]
285 493 }
286 494 ]
@@ -287,400 +495,67 @@
287 495 },
288 496 "heredoc": {
289 497 "patterns": [
290 498 {
291 - "begin": "(<<)-\\s*(\"|'|)\\s*(RUBY)(?=\\s|;|&|<|\"|')\\2",
499 + "begin": "(<<-)\\s*+(\"|')\\s*+((?<!\\w)[a-zA-Z_][a-zA-Z_0-9]*(?!\\w))(?=\\s|;|&|<|\"|')\\2",
500 + "end": "^\\t*\\3(?=\\s|;|&|$)",
292 501 "beginCaptures": {
293 502 "1": {
294 503 "name": "keyword.operator.heredoc.shell"
295 504 },
505 + "2": {},
296 506 "3": {
297 - "name": "keyword.control.heredoc-token.shell"
507 + "name": "punctuation.definition.string.heredoc.shell"
298 508 }
299 509 },
300 - "end": "^\\t*(RUBY)(?=\\s|;|&|$)",
301 510 "endCaptures": {
302 - "1": {
303 - "name": "keyword.control.heredoc-token.shell"
511 + "0": {
512 + "name": "punctuation.definition.string.heredoc.shell"
304 513 }
305 514 },
306 - "name": "string.unquoted.heredoc.no-indent.ruby.shell",
307 - "contentName": "source.ruby.embedded.shell",
308 - "patterns": [
309 - {
310 - "include": "source.ruby"
311 - }
312 - ]
515 + "name": "string.quoted.heredoc.indent.shell",
516 + "patterns": []
313 517 },
314 518 {
315 - "begin": "(<<)\\s*(\"|'|)\\s*(RUBY)(?=\\s|;|&|<|\"|')\\2",
519 + "begin": "(<<)\\s*+(\"|')\\s*+((?<!\\w)[a-zA-Z_][a-zA-Z_0-9]*(?!\\w))(?=\\s|;|&|<|\"|')\\2",
520 + "end": "^\\3(?=\\s|;|&|$)",
316 521 "beginCaptures": {
317 522 "1": {
318 523 "name": "keyword.operator.heredoc.shell"
319 524 },
525 + "2": {},
320 526 "3": {
321 - "name": "keyword.control.heredoc-token.shell"
527 + "name": "punctuation.definition.string.heredoc.shell"
322 528 }
323 529 },
324 - "end": "^(RUBY)(?=\\s|;|&|$)",
325 530 "endCaptures": {
326 - "1": {
327 - "name": "keyword.control.heredoc-token.shell"
531 + "0": {
532 + "name": "punctuation.definition.string.heredoc.shell"
328 533 }
329 534 },
330 - "name": "string.unquoted.heredoc.ruby.shell",
331 - "contentName": "source.ruby.embedded.shell",
332 - "patterns": [
333 - {
334 - "include": "source.ruby"
335 - }
336 - ]
535 + "name": "string.quoted.heredoc.no-indent.shell",
536 + "patterns": []
337 537 },
338 538 {
339 - "begin": "(<<)-\\s*(\"|'|)\\s*(PYTHON)(?=\\s|;|&|<|\"|')\\2",
539 + "begin": "(<<-)\\s*+((?<!\\w)[a-zA-Z_][a-zA-Z_0-9]*(?!\\w))(?=\\s|;|&|<|\"|')",
540 + "end": "^\\t*\\2(?=\\s|;|&|$)",
340 541 "beginCaptures": {
341 542 "1": {
342 543 "name": "keyword.operator.heredoc.shell"
343 544 },
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 545 "2": {
669 - "name": "keyword.control.heredoc-token.shell"
546 + "name": "punctuation.definition.string.heredoc.shell"
670 547 }
671 548 },
672 - "end": "^\\t*(\\2)(?=\\s|;|&|$)",
673 549 "endCaptures": {
674 - "1": {
675 - "name": "keyword.control.heredoc-token.shell"
550 + "0": {
551 + "name": "punctuation.definition.string.heredoc.shell"
676 552 }
677 553 },
678 - "name": "string.unquoted.heredoc.expanded.no-indent.shell",
554 + "name": "string.unquoted.heredoc.indent.shell",
679 555 "patterns": [
680 556 {
681 - "match": "\\\\[\\$`\\\\\\n]",
682 - "name": "constant.character.escape.shell"
557 + "include": "#double_quote_escape_char"
683 558 },
684 559 {
685 560 "include": "#variable"
686 561 },
@@ -689,28 +564,27 @@
689 564 }
690 565 ]
691 566 },
692 567 {
693 - "begin": "(<<)\\s*\\\\?([^;&<\\s]+)",
568 + "begin": "(<<)\\s*+((?<!\\w)[a-zA-Z_][a-zA-Z_0-9]*(?!\\w))(?=\\s|;|&|<|\"|')",
569 + "end": "^\\2(?=\\s|;|&|$)",
694 570 "beginCaptures": {
695 571 "1": {
696 572 "name": "keyword.operator.heredoc.shell"
697 573 },
698 574 "2": {
699 - "name": "keyword.control.heredoc-token.shell"
575 + "name": "punctuation.definition.string.heredoc.shell"
700 576 }
701 577 },
702 - "end": "^(\\2)(?=\\s|;|&|$)",
703 578 "endCaptures": {
704 - "1": {
705 - "name": "keyword.control.heredoc-token.shell"
579 + "0": {
580 + "name": "punctuation.definition.string.heredoc.shell"
706 581 }
707 582 },
708 - "name": "string.unquoted.heredoc.expanded.shell",
583 + "name": "string.unquoted.heredoc.no-indent.shell",
709 584 "patterns": [
710 585 {
711 - "match": "\\\\[\\$`\\\\\\n]",
712 - "name": "constant.character.escape.shell"
586 + "include": "#double_quote_escape_char"
713 587 },
714 588 {
715 589 "include": "#variable"
716 590 },
@@ -781,9 +655,9 @@
781 655 "2": {
782 656 "name": "string.unquoted.herestring.shell",
783 657 "patterns": [
784 658 {
785 - "include": "$self"
659 + "include": "#initial_context"
786 660 }
787 661 ]
788 662 }
789 663 },
@@ -791,8 +665,101 @@
791 665 "name": "meta.herestring.shell"
792 666 }
793 667 ]
794 668 },
669 + "initial_context": {
670 + "patterns": [
671 + {
672 + "include": "#comment"
673 + },
674 + {
675 + "include": "#boolean"
676 + },
677 + {
678 + "include": "#numeric_literal"
679 + },
680 + {
681 + "include": "#pipeline"
682 + },
683 + {
684 + "include": "#statement_seperator"
685 + },
686 + {
687 + "include": "#logical_expression_double"
688 + },
689 + {
690 + "include": "#logical_expression_single"
691 + },
692 + {
693 + "include": "#misc_ranges"
694 + },
695 + {
696 + "include": "#loop"
697 + },
698 + {
699 + "include": "#string"
700 + },
701 + {
702 + "include": "#function-definition"
703 + },
704 + {
705 + "include": "#variable"
706 + },
707 + {
708 + "include": "#interpolation"
709 + },
710 + {
711 + "include": "#heredoc"
712 + },
713 + {
714 + "include": "#herestring"
715 + },
716 + {
717 + "include": "#redirection"
718 + },
719 + {
720 + "include": "#pathname"
721 + },
722 + {
723 + "include": "#keyword"
724 + },
725 + {
726 + "include": "#alias_statement"
727 + },
728 + {
729 + "include": "#assignment"
730 + },
731 + {
732 + "include": "#command_call"
733 + },
734 + {
735 + "include": "#support"
736 + }
737 + ]
738 + },
739 + "inline_comment": {
740 + "match": "(\\/\\*)((?:[^\\*]|(?:\\*)++[^\\/])*+((?:\\*)++\\/))",
741 + "captures": {
742 + "1": {
743 + "name": "comment.block.shell punctuation.definition.comment.begin.shell"
744 + },
745 + "2": {
746 + "name": "comment.block.shell"
747 + },
748 + "3": {
749 + "patterns": [
750 + {
751 + "match": "\\*\\/",
752 + "name": "comment.block.shell punctuation.definition.comment.end.shell"
753 + },
754 + {
755 + "match": "\\*",
756 + "name": "comment.block.shell"
757 + }
758 + ]
759 + }
760 + }
761 + },
795 762 "interpolation": {
796 763 "patterns": [
797 764 {
798 765 "begin": "\\$\\({2}",
@@ -797,15 +764,15 @@
797 764 {
798 765 "begin": "\\$\\({2}",
799 766 "beginCaptures": {
800 767 "0": {
801 - "name": "punctuation.definition.string.begin.shell"
768 + "name": "punctuation.definition.evaluation.arithmetic.begin.shell"
802 769 }
803 770 },
804 - "end": "\\){2}",
771 + "end": "\\)\\s*\\)",
805 772 "endCaptures": {
806 773 "0": {
807 - "name": "punctuation.definition.string.end.shell"
774 + "name": "punctuation.definition.evaluation.arithmetic.end.shell"
808 775 }
809 776 },
810 777 "name": "string.other.math.shell",
811 778 "patterns": [
@@ -817,15 +784,15 @@
817 784 {
818 785 "begin": "`",
819 786 "beginCaptures": {
820 787 "0": {
821 - "name": "punctuation.definition.string.begin.shell"
788 + "name": "punctuation.definition.evaluation.backticks.shell"
822 789 }
823 790 },
824 791 "end": "`",
825 792 "endCaptures": {
826 793 "0": {
827 - "name": "punctuation.definition.string.end.shell"
794 + "name": "punctuation.definition.evaluation.backticks.shell"
828 795 }
829 796 },
830 797 "name": "string.interpolated.backtick.shell",
831 798 "patterns": [
@@ -854,9 +821,9 @@
854 821 }
855 822 ]
856 823 },
857 824 {
858 - "include": "$self"
825 + "include": "#initial_context"
859 826 }
860 827 ]
861 828 },
862 829 {
@@ -862,21 +829,21 @@
862 829 {
863 830 "begin": "\\$\\(",
864 831 "beginCaptures": {
865 832 "0": {
866 - "name": "punctuation.definition.string.begin.shell"
833 + "name": "punctuation.definition.evaluation.parens.begin.shell"
867 834 }
868 835 },
869 836 "end": "\\)",
870 837 "endCaptures": {
871 838 "0": {
872 - "name": "punctuation.definition.string.end.shell"
839 + "name": "punctuation.definition.evaluation.parens.end.shell"
873 840 }
874 841 },
875 842 "name": "string.interpolated.dollar.shell",
876 843 "patterns": [
877 844 {
878 - "include": "$self"
845 + "include": "#initial_context"
879 846 }
880 847 ]
881 848 }
882 849 ]
@@ -883,25 +850,37 @@
883 850 },
884 851 "keyword": {
885 852 "patterns": [
886 853 {
887 - "match": "(?<=^|;|&|\\s)(then|else|elif|fi|for|in|do|done|select|case|continue|esac|while|until|return)(?=\\s|;|&|$)",
888 - "name": "keyword.control.shell"
854 + "match": "(?<=^|;|&|\\s)(?:then|else|elif|fi|for|in|do|done|select|case|continue|esac|while|until|return)(?=\\s|;|&|$)",
855 + "name": "keyword.control.$0.shell"
889 856 },
890 857 {
891 858 "match": "(?<=^|;|&|\\s)(?:export|declare|typeset|local|readonly)(?=\\s|;|&|$)",
892 - "name": "storage.modifier.shell"
859 + "name": "storage.modifier.$0.shell"
893 860 }
894 861 ]
895 862 },
896 - "list": {
863 + "line_comment": {
864 + "begin": "\\s*+(\\/\\/)",
865 + "end": "(?<=\\n)(?<!\\\\\\n)",
866 + "beginCaptures": {
867 + "1": {
868 + "name": "punctuation.definition.comment.shell"
869 + }
870 + },
871 + "endCaptures": {},
872 + "name": "comment.line.double-slash.shell",
897 873 "patterns": [
898 874 {
899 - "match": ";|&&|&|\\|\\|",
900 - "name": "keyword.operator.list.shell"
875 + "include": "#line_continuation_character"
901 876 }
902 877 ]
903 878 },
879 + "line_continuation": {
880 + "match": "\\\\(?=\\n)",
881 + "name": "constant.character.escape.line-continuation.shell"
882 + },
904 883 "logical-expression": {
905 884 "patterns": [
906 885 {
907 886 "comment": "do we want a special rule for ( expr )?",
@@ -908,13 +887,204 @@
908 887 "match": "=[=~]?|!=?|<|>|&&|\\|\\|",
909 888 "name": "keyword.operator.logical.shell"
910 889 },
911 890 {
912 - "match": "(?<!\\S)-(nt|ot|ef|eq|ne|l[te]|g[te]|[a-hknoprstuwxzOGLSN])",
891 + "match": "(?<!\\S)-(nt|ot|ef|eq|ne|l[te]|g[te]|[a-hknoprstuwxzOGLSN])\\b",
913 892 "name": "keyword.operator.logical.shell"
914 893 }
915 894 ]
916 895 },
896 + "logical_expression_context": {
897 + "patterns": [
898 + {
899 + "include": "#regex_comparison"
900 + },
901 + {
902 + "include": "#logical-expression"
903 + },
904 + {
905 + "include": "#logical_expression_single"
906 + },
907 + {
908 + "include": "#logical_expression_double"
909 + },
910 + {
911 + "include": "#comment"
912 + },
913 + {
914 + "include": "#boolean"
915 + },
916 + {
917 + "include": "#numeric_literal"
918 + },
919 + {
920 + "include": "#pipeline"
921 + },
922 + {
923 + "include": "#statement_seperator"
924 + },
925 + {
926 + "include": "#string"
927 + },
928 + {
929 + "include": "#variable"
930 + },
931 + {
932 + "include": "#interpolation"
933 + },
934 + {
935 + "include": "#heredoc"
936 + },
937 + {
938 + "include": "#herestring"
939 + },
940 + {
941 + "include": "#pathname"
942 + },
943 + {
944 + "include": "#keyword"
945 + },
946 + {
947 + "include": "#support"
948 + }
949 + ]
950 + },
951 + "logical_expression_double": {
952 + "begin": "\\[\\[",
953 + "end": "\\]\\]",
954 + "beginCaptures": {
955 + "0": {
956 + "name": "punctuation.definition.logical-expression.shell"
957 + }
958 + },
959 + "endCaptures": {
960 + "0": {
961 + "name": "punctuation.definition.logical-expression.shell"
962 + }
963 + },
964 + "name": "meta.scope.logical-expression.shell",
965 + "patterns": [
966 + {
967 + "include": "#regex_comparison"
968 + },
969 + {
970 + "include": "#logical-expression"
971 + },
972 + {
973 + "include": "#logical_expression_single"
974 + },
975 + {
976 + "include": "#logical_expression_double"
977 + },
978 + {
979 + "include": "#comment"
980 + },
981 + {
982 + "include": "#boolean"
983 + },
984 + {
985 + "include": "#numeric_literal"
986 + },
987 + {
988 + "include": "#pipeline"
989 + },
990 + {
991 + "include": "#statement_seperator"
992 + },
993 + {
994 + "include": "#string"
995 + },
996 + {
997 + "include": "#variable"
998 + },
999 + {
1000 + "include": "#interpolation"
1001 + },
1002 + {
1003 + "include": "#heredoc"
1004 + },
1005 + {
1006 + "include": "#herestring"
1007 + },
1008 + {
1009 + "include": "#pathname"
1010 + },
1011 + {
1012 + "include": "#keyword"
1013 + },
1014 + {
1015 + "include": "#support"
1016 + }
1017 + ]
1018 + },
1019 + "logical_expression_single": {
1020 + "begin": "\\[",
1021 + "end": "\\]",
1022 + "beginCaptures": {
1023 + "0": {
1024 + "name": "punctuation.definition.logical-expression.shell"
1025 + }
1026 + },
1027 + "endCaptures": {
1028 + "0": {
1029 + "name": "punctuation.definition.logical-expression.shell"
1030 + }
1031 + },
1032 + "name": "meta.scope.logical-expression.shell",
1033 + "patterns": [
1034 + {
1035 + "include": "#regex_comparison"
1036 + },
1037 + {
1038 + "include": "#logical-expression"
1039 + },
1040 + {
1041 + "include": "#logical_expression_single"
1042 + },
1043 + {
1044 + "include": "#logical_expression_double"
1045 + },
1046 + {
1047 + "include": "#comment"
1048 + },
1049 + {
1050 + "include": "#boolean"
1051 + },
1052 + {
1053 + "include": "#numeric_literal"
1054 + },
1055 + {
1056 + "include": "#pipeline"
1057 + },
1058 + {
1059 + "include": "#statement_seperator"
1060 + },
1061 + {
1062 + "include": "#string"
1063 + },
1064 + {
1065 + "include": "#variable"
1066 + },
1067 + {
1068 + "include": "#interpolation"
1069 + },
1070 + {
1071 + "include": "#heredoc"
1072 + },
1073 + {
1074 + "include": "#herestring"
1075 + },
1076 + {
1077 + "include": "#pathname"
1078 + },
1079 + {
1080 + "include": "#keyword"
1081 + },
1082 + {
1083 + "include": "#support"
1084 + }
1085 + ]
1086 + },
917 1087 "loop": {
918 1088 "patterns": [
919 1089 {
920 1090 "begin": "(?<=^|;|&|\\s)(for)\\s+(?=\\({2})",
@@ -922,9 +1092,9 @@
922 1092 "1": {
923 1093 "name": "keyword.control.shell"
924 1094 }
925 1095 },
926 - "end": "(?<=^|;|&|\\s)done(?=\\s|;|&|$)",
1096 + "end": "(?<=^|;|&|\\s)done(?=\\s|;|&|$|\\))",
927 1097 "endCaptures": {
928 1098 "0": {
929 1099 "name": "keyword.control.shell"
930 1100 }
@@ -931,9 +1101,9 @@
931 1101 },
932 1102 "name": "meta.scope.for-loop.shell",
933 1103 "patterns": [
934 1104 {
935 - "include": "$self"
1105 + "include": "#initial_context"
936 1106 }
937 1107 ]
938 1108 },
939 1109 {
@@ -953,9 +1123,9 @@
953 1123 "3": {
954 1124 "name": "keyword.control.shell"
955 1125 }
956 1126 },
957 - "end": "(?<=^|;|&|\\s)done(?=\\s|;|&|$)",
1127 + "end": "(?<=^|;|&|\\s)done(?=\\s|;|&|$|\\))",
958 1128 "endCaptures": {
959 1129 "0": {
960 1130 "name": "keyword.control.shell"
961 1131 }
@@ -962,9 +1132,9 @@
962 1132 },
963 1133 "name": "meta.scope.for-in-loop.shell",
964 1134 "patterns": [
965 1135 {
966 - "include": "$self"
1136 + "include": "#initial_context"
967 1137 }
968 1138 ]
969 1139 },
970 1140 {
@@ -973,9 +1143,9 @@
973 1143 "1": {
974 1144 "name": "keyword.control.shell"
975 1145 }
976 1146 },
977 - "end": "(?<=^|;|&|\\s)done(?=\\s|;|&|$)",
1147 + "end": "(?<=^|;|&|\\s)done(?=\\s|;|&|$|\\))",
978 1148 "endCaptures": {
979 1149 "0": {
980 1150 "name": "keyword.control.shell"
981 1151 }
@@ -982,9 +1152,9 @@
982 1152 },
983 1153 "name": "meta.scope.while-loop.shell",
984 1154 "patterns": [
985 1155 {
986 - "include": "$self"
1156 + "include": "#initial_context"
987 1157 }
988 1158 ]
989 1159 },
990 1160 {
@@ -996,9 +1166,9 @@
996 1166 "2": {
997 1167 "name": "variable.other.loop.shell"
998 1168 }
999 1169 },
1000 - "end": "(?<=^|;|&|\\s)(done)(?=\\s|;|&|$)",
1170 + "end": "(?<=^|;|&|\\s)(done)(?=\\s|;|&|$|\\))",
1001 1171 "endCaptures": {
1002 1172 "1": {
1003 1173 "name": "keyword.control.shell"
1004 1174 }
@@ -1005,9 +1175,9 @@
1005 1175 },
1006 1176 "name": "meta.scope.select-block.shell",
1007 1177 "patterns": [
1008 1178 {
1009 - "include": "$self"
1179 + "include": "#initial_context"
1010 1180 }
1011 1181 ]
1012 1182 },
1013 1183 {
@@ -1039,16 +1209,13 @@
1039 1209 "include": "#comment"
1040 1210 },
1041 1211 {
1042 1212 "include": "#case-clause"
1043 - },
1044 - {
1045 - "include": "$self"
1046 1213 }
1047 1214 ]
1048 1215 },
1049 1216 {
1050 - "include": "$self"
1217 + "include": "#initial_context"
1051 1218 }
1052 1219 ]
1053 1220 },
1054 1221 {
@@ -1066,9 +1233,9 @@
1066 1233 },
1067 1234 "name": "meta.scope.if-block.shell",
1068 1235 "patterns": [
1069 1236 {
1070 - "include": "$self"
1237 + "include": "#initial_context"
1071 1238 }
1072 1239 ]
1073 1240 }
1074 1241 ]
@@ -1099,8 +1266,382 @@
1099 1266 "name": "constant.numeric.integer.shell"
1100 1267 }
1101 1268 ]
1102 1269 },
1270 + "misc_ranges": {
1271 + "patterns": [
1272 + {
1273 + "include": "#logical_expression_single"
1274 + },
1275 + {
1276 + "include": "#logical_expression_double"
1277 + },
1278 + {
1279 + "begin": "\\(\\(",
1280 + "end": "\\)\\)",
1281 + "beginCaptures": {
1282 + "0": {
1283 + "name": "punctuation.section.arithmetic.shell"
1284 + }
1285 + },
1286 + "endCaptures": {
1287 + "0": {
1288 + "name": "punctuation.section.arithmetic.shell"
1289 + }
1290 + },
1291 + "name": "meta.arithmetic.shell",
1292 + "patterns": [
1293 + {
1294 + "include": "#math"
1295 + }
1296 + ]
1297 + },
1298 + {
1299 + "begin": "(?<!=)\\(",
1300 + "end": "\\)",
1301 + "beginCaptures": {
1302 + "0": {
1303 + "name": "punctuation.definition.subshell"
1304 + }
1305 + },
1306 + "endCaptures": {
1307 + "0": {
1308 + "name": "punctuation.definition.subshell"
1309 + }
1310 + },
1311 + "name": "meta.scope.subshell",
1312 + "patterns": [
1313 + {
1314 + "include": "#initial_context"
1315 + }
1316 + ]
1317 + },
1318 + {
1319 + "begin": "{",
1320 + "end": "}",
1321 + "beginCaptures": {
1322 + "0": {
1323 + "name": "punctuation.definition.group.shell"
1324 + }
1325 + },
1326 + "endCaptures": {
1327 + "0": {
1328 + "name": "punctuation.definition.group.shell"
1329 + }
1330 + },
1331 + "name": "meta.scope.group.shell",
1332 + "patterns": [
1333 + {
1334 + "include": "#initial_context"
1335 + }
1336 + ]
1337 + }
1338 + ]
1339 + },
1340 + "numeric_literal": {
1341 + "match": "(?<!\\w)((?<!\\w)\\.?\\d(?:(?:[0-9a-zA-Z_\\.]|')|(?<=[eEpP])[+-])*)(?!\\w)",
1342 + "captures": {
1343 + "1": {
1344 + "patterns": [
1345 + {
1346 + "begin": "(?=.)",
1347 + "end": "$",
1348 + "beginCaptures": {},
1349 + "endCaptures": {},
1350 + "patterns": [
1351 + {
1352 + "match": "(\\G0[xX])([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)?((?:(?<=[0-9a-fA-F])\\.|\\.(?=[0-9a-fA-F])))([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)?(?:(?<!')([pP])((?:\\+)?)((?:\\-)?)([0-9](?:[0-9]|(?<=[0-9a-fA-F])'(?=[0-9a-fA-F]))*))?([lLfF](?!\\w))?$",
1353 + "captures": {
1354 + "1": {
1355 + "name": "keyword.other.unit.hexadecimal.shell"
1356 + },
1357 + "2": {
1358 + "name": "constant.numeric.hexadecimal.shell",
1359 + "patterns": [
1360 + {
1361 + "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])",
1362 + "name": "punctuation.separator.constant.numeric.shell"
1363 + }
1364 + ]
1365 + },
1366 + "3": {
1367 + "name": "punctuation.separator.constant.numeric.shell"
1368 + },
1369 + "4": {
1370 + "name": "constant.numeric.hexadecimal.shell"
1371 + },
1372 + "5": {
1373 + "name": "constant.numeric.hexadecimal.shell",
1374 + "patterns": [
1375 + {
1376 + "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])",
1377 + "name": "punctuation.separator.constant.numeric.shell"
1378 + }
1379 + ]
1380 + },
1381 + "6": {
1382 + "name": "punctuation.separator.constant.numeric.shell"
1383 + },
1384 + "7": {
1385 + "name": "keyword.other.unit.exponent.hexadecimal.shell"
1386 + },
1387 + "8": {
1388 + "name": "keyword.operator.plus.exponent.hexadecimal.shell"
1389 + },
1390 + "9": {
1391 + "name": "keyword.operator.minus.exponent.hexadecimal.shell"
1392 + },
1393 + "10": {
1394 + "name": "constant.numeric.exponent.hexadecimal.shell",
1395 + "patterns": [
1396 + {
1397 + "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])",
1398 + "name": "punctuation.separator.constant.numeric.shell"
1399 + }
1400 + ]
1401 + },
1402 + "11": {
1403 + "name": "keyword.other.unit.suffix.floating-point.shell"
1404 + }
1405 + }
1406 + },
1407 + {
1408 + "match": "\\G(?=[0-9.])(?!0[xXbB])([0-9](?:[0-9]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)?((?:(?<=[0-9])\\.|\\.(?=[0-9])))([0-9](?:[0-9]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)?(?:(?<!')([eE])((?:\\+)?)((?:\\-)?)([0-9](?:[0-9]|(?<=[0-9a-fA-F])'(?=[0-9a-fA-F]))*))?([lLfF](?!\\w))?$",
1409 + "captures": {
1410 + "1": {
1411 + "name": "constant.numeric.decimal.shell",
1412 + "patterns": [
1413 + {
1414 + "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])",
1415 + "name": "punctuation.separator.constant.numeric.shell"
1416 + }
1417 + ]
1418 + },
1419 + "2": {
1420 + "name": "punctuation.separator.constant.numeric.shell"
1421 + },
1422 + "3": {
1423 + "name": "constant.numeric.decimal.point.shell"
1424 + },
1425 + "4": {
1426 + "name": "constant.numeric.decimal.shell",
1427 + "patterns": [
1428 + {
1429 + "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])",
1430 + "name": "punctuation.separator.constant.numeric.shell"
1431 + }
1432 + ]
1433 + },
1434 + "5": {
1435 + "name": "punctuation.separator.constant.numeric.shell"
1436 + },
1437 + "6": {
1438 + "name": "keyword.other.unit.exponent.decimal.shell"
1439 + },
1440 + "7": {
1441 + "name": "keyword.operator.plus.exponent.decimal.shell"
1442 + },
1443 + "8": {
1444 + "name": "keyword.operator.minus.exponent.decimal.shell"
1445 + },
1446 + "9": {
1447 + "name": "constant.numeric.exponent.decimal.shell",
1448 + "patterns": [
1449 + {
1450 + "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])",
1451 + "name": "punctuation.separator.constant.numeric.shell"
1452 + }
1453 + ]
1454 + },
1455 + "10": {
1456 + "name": "keyword.other.unit.suffix.floating-point.shell"
1457 + }
1458 + }
1459 + },
1460 + {
1461 + "match": "(\\G0[bB])([01](?:[01]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)((?:[uU]|(?:[uU]ll?)|(?:[uU]LL?)|(?:ll?[uU]?)|(?:LL?[uU]?)|[fF])(?!\\w))?$",
1462 + "captures": {
1463 + "1": {
1464 + "name": "keyword.other.unit.binary.shell"
1465 + },
1466 + "2": {
1467 + "name": "constant.numeric.binary.shell",
1468 + "patterns": [
1469 + {
1470 + "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])",
1471 + "name": "punctuation.separator.constant.numeric.shell"
1472 + }
1473 + ]
1474 + },
1475 + "3": {
1476 + "name": "punctuation.separator.constant.numeric.shell"
1477 + },
1478 + "4": {
1479 + "name": "keyword.other.unit.suffix.integer.shell"
1480 + }
1481 + }
1482 + },
1483 + {
1484 + "match": "(\\G0)((?:[0-7]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))+)((?:[uU]|(?:[uU]ll?)|(?:[uU]LL?)|(?:ll?[uU]?)|(?:LL?[uU]?)|[fF])(?!\\w))?$",
1485 + "captures": {
1486 + "1": {
1487 + "name": "keyword.other.unit.octal.shell"
1488 + },
1489 + "2": {
1490 + "name": "constant.numeric.octal.shell",
1491 + "patterns": [
1492 + {
1493 + "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])",
1494 + "name": "punctuation.separator.constant.numeric.shell"
1495 + }
1496 + ]
1497 + },
1498 + "3": {
1499 + "name": "punctuation.separator.constant.numeric.shell"
1500 + },
1501 + "4": {
1502 + "name": "keyword.other.unit.suffix.integer.shell"
1503 + }
1504 + }
1505 + },
1506 + {
1507 + "match": "(\\G0[xX])([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)(?:(?<!')([pP])((?:\\+)?)((?:\\-)?)([0-9](?:[0-9]|(?<=[0-9a-fA-F])'(?=[0-9a-fA-F]))*))?((?:[uU]|(?:[uU]ll?)|(?:[uU]LL?)|(?:ll?[uU]?)|(?:LL?[uU]?)|[fF])(?!\\w))?$",
1508 + "captures": {
1509 + "1": {
1510 + "name": "keyword.other.unit.hexadecimal.shell"
1511 + },
1512 + "2": {
1513 + "name": "constant.numeric.hexadecimal.shell",
1514 + "patterns": [
1515 + {
1516 + "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])",
1517 + "name": "punctuation.separator.constant.numeric.shell"
1518 + }
1519 + ]
1520 + },
1521 + "3": {
1522 + "name": "punctuation.separator.constant.numeric.shell"
1523 + },
1524 + "4": {
1525 + "name": "keyword.other.unit.exponent.hexadecimal.shell"
1526 + },
1527 + "5": {
1528 + "name": "keyword.operator.plus.exponent.hexadecimal.shell"
1529 + },
1530 + "6": {
1531 + "name": "keyword.operator.minus.exponent.hexadecimal.shell"
1532 + },
1533 + "7": {
1534 + "name": "constant.numeric.exponent.hexadecimal.shell",
1535 + "patterns": [
1536 + {
1537 + "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])",
1538 + "name": "punctuation.separator.constant.numeric.shell"
1539 + }
1540 + ]
1541 + },
1542 + "8": {
1543 + "name": "keyword.other.unit.suffix.integer.shell"
1544 + }
1545 + }
1546 + },
1547 + {
1548 + "match": "\\G(?=[0-9.])(?!0[xXbB])([0-9](?:[0-9]|((?<=[0-9a-fA-F])'(?=[0-9a-fA-F])))*)(?:(?<!')([eE])((?:\\+)?)((?:\\-)?)([0-9](?:[0-9]|(?<=[0-9a-fA-F])'(?=[0-9a-fA-F]))*))?((?:[uU]|(?:[uU]ll?)|(?:[uU]LL?)|(?:ll?[uU]?)|(?:LL?[uU]?)|[fF])(?!\\w))?$",
1549 + "captures": {
1550 + "1": {
1551 + "name": "constant.numeric.decimal.shell",
1552 + "patterns": [
1553 + {
1554 + "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])",
1555 + "name": "punctuation.separator.constant.numeric.shell"
1556 + }
1557 + ]
1558 + },
1559 + "2": {
1560 + "name": "punctuation.separator.constant.numeric.shell"
1561 + },
1562 + "3": {
1563 + "name": "keyword.other.unit.exponent.decimal.shell"
1564 + },
1565 + "4": {
1566 + "name": "keyword.operator.plus.exponent.decimal.shell"
1567 + },
1568 + "5": {
1569 + "name": "keyword.operator.minus.exponent.decimal.shell"
1570 + },
1571 + "6": {
1572 + "name": "constant.numeric.exponent.decimal.shell",
1573 + "patterns": [
1574 + {
1575 + "match": "(?<=[0-9a-fA-F])'(?=[0-9a-fA-F])",
1576 + "name": "punctuation.separator.constant.numeric.shell"
1577 + }
1578 + ]
1579 + },
1580 + "7": {
1581 + "name": "keyword.other.unit.suffix.integer.shell"
1582 + }
1583 + }
1584 + }
1585 + ]
1586 + }
1587 + ]
1588 + }
1589 + }
1590 + },
1591 + "option": {
1592 + "begin": "\\s++(-)((?!(?:!|%|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|\\s)))",
1593 + "end": "(?:(?=\\s)|(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|#|\\])(?<!\\\\))",
1594 + "beginCaptures": {
1595 + "1": {
1596 + "name": "string.unquoted.argument.shell constant.other.option.dash.shell"
1597 + },
1598 + "2": {
1599 + "name": "string.unquoted.argument.shell constant.other.option.shell"
1600 + }
1601 + },
1602 + "endCaptures": {},
1603 + "contentName": "string.unquoted.argument constant.other.option",
1604 + "patterns": [
1605 + {
1606 + "include": "#option_context"
1607 + }
1608 + ]
1609 + },
1610 + "option_context": {
1611 + "patterns": [
1612 + {
1613 + "include": "#misc_ranges"
1614 + },
1615 + {
1616 + "include": "#string"
1617 + },
1618 + {
1619 + "include": "#variable"
1620 + },
1621 + {
1622 + "include": "#interpolation"
1623 + },
1624 + {
1625 + "include": "#heredoc"
1626 + },
1627 + {
1628 + "include": "#herestring"
1629 + },
1630 + {
1631 + "include": "#redirection"
1632 + },
1633 + {
1634 + "include": "#pathname"
1635 + },
1636 + {
1637 + "include": "#keyword"
1638 + },
1639 + {
1640 + "include": "#support"
1641 + }
1642 + ]
1643 + },
1103 1644 "pathname": {
1104 1645 "patterns": [
1105 1646 {
1106 1647 "match": "(?<=\\s|:|=|^)~",
@@ -1128,9 +1669,9 @@
1128 1669 },
1129 1670 "name": "meta.structure.extglob.shell",
1130 1671 "patterns": [
1131 1672 {
1132 - "include": "$self"
1673 + "include": "#initial_context"
1133 1674 }
1134 1675 ]
1135 1676 }
1136 1677 ]
@@ -1164,9 +1705,9 @@
1164 1705 },
1165 1706 "name": "string.interpolated.process-substitution.shell",
1166 1707 "patterns": [
1167 1708 {
1168 - "include": "$self"
1709 + "include": "#initial_context"
1169 1710 }
1170 1711 ]
1171 1712 },
1172 1713 {
@@ -1174,8 +1715,99 @@
1174 1715 "name": "keyword.operator.redirect.shell"
1175 1716 }
1176 1717 ]
1177 1718 },
1719 + "regex_comparison": {
1720 + "match": "\\=~",
1721 + "name": "keyword.operator.logical.regex.shell"
1722 + },
1723 + "regexp": {
1724 + "patterns": [
1725 + {
1726 + "match": ".+"
1727 + }
1728 + ]
1729 + },
1730 + "simple_options": {
1731 + "match": "(?:\\s++\\-\\w+)*",
1732 + "captures": {
1733 + "0": {
1734 + "patterns": [
1735 + {
1736 + "match": "\\s++(\\-)(\\w+)",
1737 + "captures": {
1738 + "1": {
1739 + "name": "string.unquoted.argument.shell constant.other.option.dash.shell"
1740 + },
1741 + "2": {
1742 + "name": "string.unquoted.argument.shell constant.other.option.shell"
1743 + }
1744 + }
1745 + }
1746 + ]
1747 + }
1748 + }
1749 + },
1750 + "statement_context": {
1751 + "patterns": [
1752 + {
1753 + "include": "#comment"
1754 + },
1755 + {
1756 + "include": "#pipeline"
1757 + },
1758 + {
1759 + "include": "#statement_seperator"
1760 + },
1761 + {
1762 + "include": "#misc_ranges"
1763 + },
1764 + {
1765 + "include": "#string"
1766 + },
1767 + {
1768 + "include": "#variable"
1769 + },
1770 + {
1771 + "include": "#interpolation"
1772 + },
1773 + {
1774 + "include": "#heredoc"
1775 + },
1776 + {
1777 + "include": "#herestring"
1778 + },
1779 + {
1780 + "include": "#redirection"
1781 + },
1782 + {
1783 + "include": "#pathname"
1784 + },
1785 + {
1786 + "include": "#keyword"
1787 + },
1788 + {
1789 + "include": "#support"
1790 + }
1791 + ]
1792 + },
1793 + "statement_seperator": {
1794 + "match": "(?:(?:(?:(?:(;)|(&&))|(\\|\\|))|(&))|\\n)",
1795 + "captures": {
1796 + "1": {
1797 + "name": "punctuation.terminator.statement.semicolon.shell"
1798 + },
1799 + "2": {
1800 + "name": "punctuation.separator.statement.and.shell"
1801 + },
1802 + "3": {
1803 + "name": "punctuation.separator.statement.or.shell"
1804 + },
1805 + "4": {
1806 + "name": "punctuation.separator.statement.background.shell"
1807 + }
1808 + }
1809 + },
1178 1810 "string": {
1179 1811 "patterns": [
1180 1812 {
1181 1813 "match": "\\\\.",
@@ -1196,9 +1828,9 @@
1196 1828 },
1197 1829 "name": "string.quoted.single.shell"
1198 1830 },
1199 1831 {
1200 - "begin": "\\$?\"",
1832 + "begin": " *\\$?\"",
1201 1833 "beginCaptures": {
1202 1834 "0": {
1203 1835 "name": "punctuation.definition.string.begin.shell"
1204 1836 }
@@ -1257,78 +1889,85 @@
1257 1889 ]
1258 1890 }
1259 1891 ]
1260 1892 },
1261 - "support": {
1893 + "variable": {
1262 1894 "patterns": [
1263 1895 {
1264 - "match": "(?<=^|;|&|\\s)(?::|\\.)(?=\\s|;|&|$)",
1265 - "name": "support.function.builtin.shell"
1896 + "match": "(\\$)(\\@(?!\\w))",
1897 + "captures": {
1898 + "1": {
1899 + "name": "punctuation.definition.variable.shell variable.parameter.positional.all.shell"
1900 + },
1901 + "2": {
1902 + "name": "variable.parameter.positional.all.shell"
1903 + }
1904 + }
1266 1905 },
1267 1906 {
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 - {
1907 + "match": "(\\$)([0-9](?!\\w))",
1276 1908 "captures": {
1277 1909 "1": {
1278 - "name": "punctuation.definition.variable.shell"
1910 + "name": "punctuation.definition.variable.shell variable.parameter.positional.shell"
1911 + },
1912 + "2": {
1913 + "name": "variable.parameter.positional.shell"
1279 1914 }
1280 - },
1281 - "match": "(\\$)[a-zA-Z_][a-zA-Z0-9_]*",
1282 - "name": "variable.other.normal.shell"
1915 + }
1283 1916 },
1284 1917 {
1918 + "match": "(\\$)(\\{[0-9]+\\}(?!\\w))",
1285 1919 "captures": {
1286 1920 "1": {
1287 - "name": "punctuation.definition.variable.shell"
1921 + "name": "punctuation.definition.variable.shell variable.parameter.positional.shell"
1922 + },
1923 + "2": {
1924 + "name": "variable.parameter.positional.shell"
1288 1925 }
1289 - },
1290 - "match": "(\\$)[-*@#?$!0_]",
1291 - "name": "variable.other.special.shell"
1926 + }
1292 1927 },
1293 1928 {
1929 + "match": "(\\$)([-*#?$!0_](?!\\w))",
1294 1930 "captures": {
1295 1931 "1": {
1296 - "name": "punctuation.definition.variable.shell"
1932 + "name": "punctuation.definition.variable.shell variable.language.special.shell"
1933 + },
1934 + "2": {
1935 + "name": "variable.language.special.shell"
1297 1936 }
1298 - },
1299 - "match": "(\\$)[1-9]",
1300 - "name": "variable.other.positional.shell"
1937 + }
1301 1938 },
1302 1939 {
1303 - "begin": "\\${",
1940 + "begin": "(\\$)(\\{)",
1941 + "end": "\\}",
1304 1942 "beginCaptures": {
1305 - "0": {
1306 - "name": "punctuation.definition.variable.shell"
1943 + "1": {
1944 + "name": "punctuation.definition.variable.shell punctuation.section.bracket.curly.variable.begin.shell"
1945 + },
1946 + "2": {
1947 + "name": "punctuation.section.bracket.curly.variable.begin.shell"
1307 1948 }
1308 1949 },
1309 - "end": "}",
1310 1950 "endCaptures": {
1311 1951 "0": {
1312 - "name": "punctuation.definition.variable.shell"
1952 + "name": "punctuation.section.bracket.curly.variable.end.shell"
1313 1953 }
1314 1954 },
1315 - "name": "variable.other.bracket.shell",
1316 1955 "patterns": [
1317 1956 {
1318 - "match": "!|:[-=?]?|\\*|@|#{1,2}|%{1,2}|/",
1957 + "match": "!|:[-=?]?|\\*|@|##|#|%%|%|\\/",
1319 1958 "name": "keyword.operator.expansion.shell"
1320 1959 },
1321 1960 {
1961 + "match": "(\\[)[^\\]]+(\\])",
1322 1962 "captures": {
1323 1963 "1": {
1324 1964 "name": "punctuation.section.array.shell"
1325 1965 },
1326 - "3": {
1966 + "2": {
1327 1967 "name": "punctuation.section.array.shell"
1328 1968 }
1329 - },
1330 - "match": "(\\[)([^\\]]+)(\\])"
1969 + }
1331 1970 },
1332 1971 {
1333 1972 "include": "#variable"
1334 1973 },
@@ -1335,8 +1974,19 @@
1335 1974 {
1336 1975 "include": "#string"
1337 1976 }
1338 1977 ]
1978 + },
1979 + {
1980 + "match": "(\\$)(\\w+(?!\\w))",
1981 + "captures": {
1982 + "1": {
1983 + "name": "punctuation.definition.variable.shell variable.other.normal.shell"
1984 + },
1985 + "2": {
1986 + "name": "variable.other.normal.shell"
1987 + }
1988 + }
1339 1989 }
1340 1990 ]
1341 1991 }
1342 1992 }