tm-grammars 1.6.4 → 1.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,24 +8,15 @@
8
8
  ],
9
9
  "repository": {
10
10
  "alias_statement": {
11
- "begin": "(?:(alias)(?:[ \\t]*+)((?:(?:((?<!\\w)-\\w+\\b)(?:[ \\t]*+))*))(?:(?:[ \\t]*+)(?:(?:((?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$))(?:[ \\t]*+)((?:(?:((?<!\\w)-\\w+\\b)(?:[ \\t]*+))*)))?)(?:((?<!\\w)(?:[a-zA-Z_0-9-]+)(?!\\w))(?:(?:(\\[)((?:(?:(?:(?:\\$?)(?:(?<!\\w)(?:[a-zA-Z_0-9-]+)(?!\\w))|@)|\\*)|(-?\\d+)))(\\]))?))(?:(?:(\\=)|(\\+\\=))|(\\-\\=))))",
11
+ "begin": "(?:(alias)(?:[ \\t]*+)((?:(?:((?<!\\w)-\\w+\\b)(?:[ \\t]*+))*))(?:(?:[ \\t]*+)(?:((?<!\\w)(?:[a-zA-Z_0-9-]+)(?!\\w))(?:(?:(\\[)((?:(?:(?:(?:\\$?)(?:(?<!\\w)(?:[a-zA-Z_0-9-]+)(?!\\w))|@)|\\*)|(-?\\d+)))(\\]))?))(?:(?:(\\=)|(\\+\\=))|(\\-\\=))))",
12
12
  "beginCaptures": {
13
13
  "1": {
14
14
  "name": "storage.type.alias.shell"
15
15
  },
16
16
  "10": {
17
- "name": "constant.numeric.shell constant.numeric.integer.shell"
18
- },
19
- "11": {
20
- "name": "punctuation.definition.array.access.shell"
21
- },
22
- "12": {
23
- "name": "keyword.operator.assignment.shell"
24
- },
25
- "13": {
26
17
  "name": "keyword.operator.assignment.compound.shell"
27
18
  },
28
- "14": {
19
+ "11": {
29
20
  "name": "keyword.operator.assignment.compound.shell"
30
21
  },
31
22
  "2": {
@@ -40,27 +31,22 @@
40
31
  "name": "string.unquoted.argument.shell constant.other.option.shell"
41
32
  },
42
33
  "4": {
43
- "name": "storage.modifier.$4.shell"
34
+ "name": "variable.other.assignment.shell"
44
35
  },
45
36
  "5": {
46
- "patterns": [
47
- {
48
- "match": "(?<!\\w)-\\w+\\b",
49
- "name": "string.unquoted.argument.shell constant.other.option.shell"
50
- }
51
- ]
37
+ "name": "punctuation.definition.array.access.shell"
52
38
  },
53
39
  "6": {
54
- "name": "string.unquoted.argument.shell constant.other.option.shell"
40
+ "name": "variable.other.assignment.shell"
55
41
  },
56
42
  "7": {
57
- "name": "variable.other.assignment.shell"
43
+ "name": "constant.numeric.shell constant.numeric.integer.shell"
58
44
  },
59
45
  "8": {
60
46
  "name": "punctuation.definition.array.access.shell"
61
47
  },
62
48
  "9": {
63
- "name": "variable.other.assignment.shell"
49
+ "name": "keyword.operator.assignment.shell"
64
50
  }
65
51
  },
66
52
  "end": "(?:(?= |\\t|$)|(?:(?:(?:(;)|(&&))|(\\|\\|))|(&)))",
@@ -78,10 +64,10 @@
78
64
  "name": "punctuation.separator.statement.background.shell"
79
65
  }
80
66
  },
81
- "name": "meta.expression.assignment.shell",
67
+ "name": "meta.expression.assignment.alias.shell",
82
68
  "patterns": [
83
69
  {
84
- "include": "#normal_statement_context"
70
+ "include": "#normal_context"
85
71
  }
86
72
  ]
87
73
  },
@@ -133,53 +119,117 @@
133
119
  "match": "(?:[ \\t]*+)((?:[^ \\t\\n'&;<>\\(\\)\\$`\\\\\"\\|]+)(?!>))"
134
120
  },
135
121
  {
136
- "include": "#normal_statement_context"
122
+ "include": "#normal_context"
137
123
  }
138
124
  ]
139
125
  },
140
- "array_value": {
141
- "begin": "(?:[ \\t]*+)(?:(?:((?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$))(?:[ \\t]*+)((?:(?:((?<!\\w)-\\w+\\b)(?:[ \\t]*+))*)))?)(?:((?<!\\w)(?:[a-zA-Z_0-9-]+)(?!\\w))(?:(?:(\\[)((?:(?:(?:(?:\\$?)(?:(?<!\\w)(?:[a-zA-Z_0-9-]+)(?!\\w))|@)|\\*)|(-?\\d+)))(\\]))?))(?:(?:(\\=)|(\\+\\=))|(\\-\\=))(?:[ \\t]*+)(\\()",
142
- "beginCaptures": {
126
+ "arithmetic_double": {
127
+ "patterns": [
128
+ {
129
+ "begin": "\\(\\(",
130
+ "beginCaptures": {
131
+ "0": {
132
+ "name": "punctuation.section.arithmetic.double.shell"
133
+ }
134
+ },
135
+ "end": "\\)(?:\\s*)\\)",
136
+ "endCaptures": {
137
+ "0": {
138
+ "name": "punctuation.section.arithmetic.double.shell"
139
+ }
140
+ },
141
+ "name": "meta.arithmetic.shell",
142
+ "patterns": [
143
+ {
144
+ "include": "#math"
145
+ },
146
+ {
147
+ "include": "#string"
148
+ }
149
+ ]
150
+ }
151
+ ]
152
+ },
153
+ "arithmetic_no_dollar": {
154
+ "patterns": [
155
+ {
156
+ "begin": "\\(",
157
+ "beginCaptures": {
158
+ "0": {
159
+ "name": "punctuation.section.arithmetic.single.shell"
160
+ }
161
+ },
162
+ "end": "\\)",
163
+ "endCaptures": {
164
+ "0": {
165
+ "name": "punctuation.section.arithmetic.single.shell"
166
+ }
167
+ },
168
+ "name": "meta.arithmetic.shell",
169
+ "patterns": [
170
+ {
171
+ "include": "#math"
172
+ },
173
+ {
174
+ "include": "#string"
175
+ }
176
+ ]
177
+ }
178
+ ]
179
+ },
180
+ "array_access_inline": {
181
+ "captures": {
143
182
  "1": {
144
- "name": "storage.modifier.$1.shell"
145
- },
146
- "10": {
147
- "name": "keyword.operator.assignment.compound.shell"
148
- },
149
- "11": {
150
- "name": "keyword.operator.assignment.compound.shell"
151
- },
152
- "12": {
153
- "name": "punctuation.definition.array.shell"
183
+ "name": "punctuation.section.array.shell"
154
184
  },
155
185
  "2": {
156
186
  "patterns": [
157
187
  {
158
- "match": "(?<!\\w)-\\w+\\b",
159
- "name": "string.unquoted.argument.shell constant.other.option.shell"
188
+ "include": "#special_expansion"
189
+ },
190
+ {
191
+ "include": "#string"
192
+ },
193
+ {
194
+ "include": "#variable"
160
195
  }
161
196
  ]
162
197
  },
163
198
  "3": {
164
- "name": "string.unquoted.argument.shell constant.other.option.shell"
199
+ "name": "punctuation.section.array.shell"
200
+ }
201
+ },
202
+ "match": "(?:(\\[)([^\\[\\]]+)(\\]))"
203
+ },
204
+ "array_value": {
205
+ "begin": "(?:[ \\t]*+)(?:((?<!\\w)(?:[a-zA-Z_0-9-]+)(?!\\w))(?:(?:(\\[)((?:(?:(?:(?:\\$?)(?:(?<!\\w)(?:[a-zA-Z_0-9-]+)(?!\\w))|@)|\\*)|(-?\\d+)))(\\]))?))(?:(?:(\\=)|(\\+\\=))|(\\-\\=))(?:[ \\t]*+)(\\()",
206
+ "beginCaptures": {
207
+ "1": {
208
+ "name": "variable.other.assignment.shell"
165
209
  },
166
- "4": {
210
+ "2": {
211
+ "name": "punctuation.definition.array.access.shell"
212
+ },
213
+ "3": {
167
214
  "name": "variable.other.assignment.shell"
168
215
  },
216
+ "4": {
217
+ "name": "constant.numeric.shell constant.numeric.integer.shell"
218
+ },
169
219
  "5": {
170
220
  "name": "punctuation.definition.array.access.shell"
171
221
  },
172
222
  "6": {
173
- "name": "variable.other.assignment.shell"
223
+ "name": "keyword.operator.assignment.shell"
174
224
  },
175
225
  "7": {
176
- "name": "constant.numeric.shell constant.numeric.integer.shell"
226
+ "name": "keyword.operator.assignment.compound.shell"
177
227
  },
178
228
  "8": {
179
- "name": "punctuation.definition.array.access.shell"
229
+ "name": "keyword.operator.assignment.compound.shell"
180
230
  },
181
231
  "9": {
182
- "name": "keyword.operator.assignment.shell"
232
+ "name": "punctuation.definition.array.shell"
183
233
  }
184
234
  },
185
235
  "end": "\\)",
@@ -195,13 +245,24 @@
195
245
  {
196
246
  "captures": {
197
247
  "1": {
198
- "name": "punctuation.definition.bracket.shell"
248
+ "name": "variable.other.assignment.array.shell entity.other.attribute-name.shell"
249
+ },
250
+ "2": {
251
+ "name": "keyword.operator.assignment.shell punctuation.definition.assignment.shell"
252
+ }
253
+ },
254
+ "match": "(?:((?<!\\w)(?:[a-zA-Z_0-9-]+)(?!\\w))(\\=))"
255
+ },
256
+ {
257
+ "captures": {
258
+ "1": {
259
+ "name": "punctuation.definition.bracket.named-array.shell"
199
260
  },
200
261
  "2": {
201
- "name": "string.unquoted.shell entity.other.attribute-name.shell"
262
+ "name": "string.unquoted.shell entity.other.attribute-name.bracket.shell"
202
263
  },
203
264
  "3": {
204
- "name": "punctuation.definition.bracket.shell"
265
+ "name": "punctuation.definition.bracket.named-array.shell"
205
266
  },
206
267
  "4": {
207
268
  "name": "punctuation.definition.assignment.shell"
@@ -210,84 +271,23 @@
210
271
  "match": "(?:(\\[)(.+?)(\\])(\\=))"
211
272
  },
212
273
  {
213
- "include": "#normal_statement_context"
274
+ "include": "#normal_context"
214
275
  },
215
276
  {
216
277
  "include": "#simple_unquoted"
217
278
  }
218
279
  ]
219
280
  },
220
- "assignment": {
281
+ "assignment_statement": {
221
282
  "patterns": [
222
283
  {
223
284
  "include": "#array_value"
224
285
  },
225
286
  {
226
- "begin": "(?:[ \\t]*+)(?:(?:((?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$))(?:[ \\t]*+)((?:(?:((?<!\\w)-\\w+\\b)(?:[ \\t]*+))*)))?)(?:((?<!\\w)(?:[a-zA-Z_0-9-]+)(?!\\w))(?:(?:(\\[)((?:(?:(?:(?:\\$?)(?:(?<!\\w)(?:[a-zA-Z_0-9-]+)(?!\\w))|@)|\\*)|(-?\\d+)))(\\]))?))(?:(?:(\\=)|(\\+\\=))|(\\-\\=))",
227
- "beginCaptures": {
228
- "1": {
229
- "name": "storage.modifier.$1.shell"
230
- },
231
- "10": {
232
- "name": "keyword.operator.assignment.compound.shell"
233
- },
234
- "11": {
235
- "name": "keyword.operator.assignment.compound.shell"
236
- },
237
- "2": {
238
- "patterns": [
239
- {
240
- "match": "(?<!\\w)-\\w+\\b",
241
- "name": "string.unquoted.argument.shell constant.other.option.shell"
242
- }
243
- ]
244
- },
245
- "3": {
246
- "name": "string.unquoted.argument.shell constant.other.option.shell"
247
- },
248
- "4": {
249
- "name": "variable.other.assignment.shell"
250
- },
251
- "5": {
252
- "name": "punctuation.definition.array.access.shell"
253
- },
254
- "6": {
255
- "name": "variable.other.assignment.shell"
256
- },
257
- "7": {
258
- "name": "constant.numeric.shell constant.numeric.integer.shell"
259
- },
260
- "8": {
261
- "name": "punctuation.definition.array.access.shell"
262
- },
263
- "9": {
264
- "name": "keyword.operator.assignment.shell"
265
- }
266
- },
267
- "end": "(?:(?= |\\t|$)|(?:(?:(?:(;)|(&&))|(\\|\\|))|(&)))",
268
- "endCaptures": {
269
- "1": {
270
- "name": "punctuation.terminator.statement.semicolon.shell"
271
- },
272
- "2": {
273
- "name": "punctuation.separator.statement.and.shell"
274
- },
275
- "3": {
276
- "name": "punctuation.separator.statement.or.shell"
277
- },
278
- "4": {
279
- "name": "punctuation.separator.statement.background.shell"
280
- }
281
- },
282
- "name": "meta.expression.assignment.shell",
283
- "patterns": [
284
- {
285
- "include": "#comment"
286
- },
287
- {
288
- "include": "#argument_context"
289
- }
290
- ]
287
+ "include": "#modified_assignment_statement"
288
+ },
289
+ {
290
+ "include": "#normal_assignment_statement"
291
291
  }
292
292
  ]
293
293
  },
@@ -304,7 +304,7 @@
304
304
  "name": "keyword.control.$0.shell"
305
305
  },
306
306
  {
307
- "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)",
307
+ "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)(?!-)",
308
308
  "name": "support.function.builtin.shell"
309
309
  },
310
310
  {
@@ -313,7 +313,7 @@
313
313
  ]
314
314
  }
315
315
  },
316
- "match": "(?:(?:(?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t]))(?!foreach\\b(?!\\/)|select\\b(?!\\/)|repeat\\b(?!\\/)|until\\b(?!\\/)|while\\b(?!\\/)|case\\b(?!\\/)|done\\b(?!\\/)|elif\\b(?!\\/)|else\\b(?!\\/)|esac\\b(?!\\/)|then\\b(?!\\/)|for\\b(?!\\/)|end\\b(?!\\/)|in\\b(?!\\/)|fi\\b(?!\\/)|do\\b(?!\\/)|if\\b(?!\\/)))(?:((?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$))|((?!\"|'|\\\\\\n?$)(?:[^!'\" \\t\\n\\r]+?)))(?:(?= |\\t)|(?:(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?<!\\\\))))",
316
+ "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]*#|\\])(?<!\\\\))))",
317
317
  "name": "meta.statement.command.name.basic.shell"
318
318
  },
319
319
  "block_comment": {
@@ -336,7 +336,7 @@
336
336
  "name": "constant.language.$0.shell"
337
337
  },
338
338
  "case_statement": {
339
- "begin": "(?:(\\bcase\\b)(?:[ \\t]*+)(.+)(?:[ \\t]*+)(\\bin\\b))",
339
+ "begin": "(?:(\\bcase\\b)(?:[ \\t]*+)(.+?)(?:[ \\t]*+)(\\bin\\b))",
340
340
  "beginCaptures": {
341
341
  "1": {
342
342
  "name": "keyword.control.case.shell"
@@ -401,7 +401,7 @@
401
401
  "name": "meta.case.entry.body.shell",
402
402
  "patterns": [
403
403
  {
404
- "include": "#normal_statement_inner"
404
+ "include": "#typical_statements"
405
405
  },
406
406
  {
407
407
  "include": "#initial_context"
@@ -482,6 +482,95 @@
482
482
  }
483
483
  ]
484
484
  },
485
+ "command_name_range": {
486
+ "begin": "\\G",
487
+ "beginCaptures": {
488
+ },
489
+ "end": "(?= |\\t|;|\\||&|$|\\n|\\)|\\`)",
490
+ "endCaptures": {
491
+ },
492
+ "name": "meta.statement.command.name.shell",
493
+ "patterns": [
494
+ {
495
+ "match": "(?<!\\w)(?:continue|return|break)(?!\\w)",
496
+ "name": "entity.name.function.call.shell entity.name.command.shell keyword.control.$0.shell"
497
+ },
498
+ {
499
+ "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)(?!-)",
500
+ "name": "entity.name.function.call.shell entity.name.command.shell support.function.builtin.shell"
501
+ },
502
+ {
503
+ "include": "#variable"
504
+ },
505
+ {
506
+ "captures": {
507
+ "1": {
508
+ "name": "entity.name.function.call.shell entity.name.command.shell"
509
+ }
510
+ },
511
+ "match": "(?:(?<!\\w)(?<=\\G|'|\"|\\}|\\))([^ \\n\\t\\r\"'=;&\\|`\\)\\{]+))"
512
+ },
513
+ {
514
+ "begin": "(?:(?:\\G|(?<! |\\t|;|\\||&|\\n|\\{|#))(?:(\\$?)((?:(\")|(')))))",
515
+ "beginCaptures": {
516
+ "1": {
517
+ "name": "meta.statement.command.name.quoted.shell punctuation.definition.string.shell entity.name.function.call.shell entity.name.command.shell"
518
+ },
519
+ "2": {
520
+ },
521
+ "3": {
522
+ "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"
523
+ },
524
+ "4": {
525
+ "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"
526
+ }
527
+ },
528
+ "end": "(?<!\\G)(?<=(?:\\2))",
529
+ "endCaptures": {
530
+ },
531
+ "patterns": [
532
+ {
533
+ "include": "#continuation_of_single_quoted_command_name"
534
+ },
535
+ {
536
+ "include": "#continuation_of_double_quoted_command_name"
537
+ }
538
+ ]
539
+ },
540
+ {
541
+ "include": "#line_continuation"
542
+ },
543
+ {
544
+ "include": "#simple_unquoted"
545
+ }
546
+ ]
547
+ },
548
+ "command_statement": {
549
+ "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?$)))",
550
+ "beginCaptures": {
551
+ },
552
+ "end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?<!\\\\)",
553
+ "endCaptures": {
554
+ },
555
+ "name": "meta.statement.command.shell",
556
+ "patterns": [
557
+ {
558
+ "include": "#command_name_range"
559
+ },
560
+ {
561
+ "include": "#line_continuation"
562
+ },
563
+ {
564
+ "include": "#option"
565
+ },
566
+ {
567
+ "include": "#argument"
568
+ },
569
+ {
570
+ "include": "#string"
571
+ }
572
+ ]
573
+ },
485
574
  "comment": {
486
575
  "captures": {
487
576
  "1": {
@@ -512,13 +601,13 @@
512
601
  "compound-command": {
513
602
  "patterns": [
514
603
  {
515
- "begin": "\\[{1,2}",
604
+ "begin": "\\[",
516
605
  "beginCaptures": {
517
606
  "0": {
518
607
  "name": "punctuation.definition.logical-expression.shell"
519
608
  }
520
609
  },
521
- "end": "\\]{1,2}",
610
+ "end": "\\]",
522
611
  "endCaptures": {
523
612
  "0": {
524
613
  "name": "punctuation.definition.logical-expression.shell"
@@ -534,45 +623,6 @@
534
623
  }
535
624
  ]
536
625
  },
537
- {
538
- "captures": {
539
- "1": {
540
- "name": "punctuation.definition.evaluation.arithmetic.begin.shell"
541
- },
542
- "2": {
543
- "name": "string.other.math.shell",
544
- "patterns": [
545
- {
546
- "include": "#math"
547
- }
548
- ]
549
- },
550
- "3": {
551
- "name": "punctuation.definition.evaluation.arithmetic.end.shell"
552
- }
553
- },
554
- "match": "(\\$\\({2})(.+)(\\)\\s*\\))"
555
- },
556
- {
557
- "begin": "\\(",
558
- "beginCaptures": {
559
- "0": {
560
- "name": "punctuation.definition.subshell.shell"
561
- }
562
- },
563
- "end": "\\)",
564
- "endCaptures": {
565
- "0": {
566
- "name": "punctuation.definition.subshell.shell"
567
- }
568
- },
569
- "name": "meta.scope.subshell.shell",
570
- "patterns": [
571
- {
572
- "include": "#initial_context"
573
- }
574
- ]
575
- },
576
626
  {
577
627
  "begin": "(?<=\\s|^){(?=\\s|$)",
578
628
  "beginCaptures": {
@@ -657,6 +707,67 @@
657
707
  "match": "\\\\[\\$`\"\\\\\\n]",
658
708
  "name": "constant.character.escape.shell"
659
709
  },
710
+ "floating_keyword": {
711
+ "patterns": [
712
+ {
713
+ "match": "(?<=^|;|&| |\\t)(?:then|elif|else|done|end|do|if|fi)(?= |\\t|;|&|$)",
714
+ "name": "keyword.control.$0.shell"
715
+ }
716
+ ]
717
+ },
718
+ "for_statement": {
719
+ "patterns": [
720
+ {
721
+ "begin": "(?:(\\bfor\\b)(?:(?:[ \\t]*+)((?<!\\w)(?:[a-zA-Z_0-9-]+)(?!\\w))(?:[ \\t]*+)(\\bin\\b)))",
722
+ "beginCaptures": {
723
+ "1": {
724
+ "name": "keyword.control.for.shell"
725
+ },
726
+ "2": {
727
+ "name": "variable.other.for.shell"
728
+ },
729
+ "3": {
730
+ "name": "keyword.control.in.shell"
731
+ }
732
+ },
733
+ "end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?<!\\\\)",
734
+ "endCaptures": {
735
+ },
736
+ "name": "meta.for.in.shell",
737
+ "patterns": [
738
+ {
739
+ "include": "#string"
740
+ },
741
+ {
742
+ "include": "#simple_unquoted"
743
+ },
744
+ {
745
+ "include": "#normal_context"
746
+ }
747
+ ]
748
+ },
749
+ {
750
+ "begin": "(\\bfor\\b)",
751
+ "beginCaptures": {
752
+ "1": {
753
+ "name": "keyword.control.for.shell"
754
+ }
755
+ },
756
+ "end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?<!\\\\)",
757
+ "endCaptures": {
758
+ },
759
+ "name": "meta.for.shell",
760
+ "patterns": [
761
+ {
762
+ "include": "#arithmetic_double"
763
+ },
764
+ {
765
+ "include": "#normal_context"
766
+ }
767
+ ]
768
+ }
769
+ ]
770
+ },
660
771
  "function_definition": {
661
772
  "applyEndPatternLast": 1,
662
773
  "begin": "(?:[ \\t]*+)(?:(?:(\\bfunction\\b)(?:[ \\t]*+)([^ \\t\\n\\r\\(\\)=\"']+)(?:(?:(\\()(?:[ \\t]*+)(\\)))?))|(?:([^ \\t\\n\\r\\(\\)=\"']+)(?:[ \\t]*+)(\\()(?:[ \\t]*+)(\\))))",
@@ -739,64 +850,72 @@
739
850
  "heredoc": {
740
851
  "patterns": [
741
852
  {
742
- "begin": "(?:((?<!<)(?:<<-))(?:[ \\t]*+)(\"|')(?:[ \\t]*+)([^\"']+?)(?=\\s|;|&|<|\"|')(?:\\2)(.*))",
853
+ "begin": "(?:((?<!<)(?:<<-))(?:[ \\t]*+)(\"|')(?:[ \\t]*+)([^\"']+?)(?=\\s|;|&|<|\"|')((?:\\2))(.*))",
743
854
  "beginCaptures": {
744
855
  "1": {
745
856
  "name": "keyword.operator.heredoc.shell"
746
857
  },
747
858
  "2": {
859
+ "name": "punctuation.definition.string.heredoc.quote.shell"
748
860
  },
749
861
  "3": {
750
- "name": "punctuation.definition.string.heredoc.shell"
862
+ "name": "punctuation.definition.string.heredoc.delimiter.shell"
751
863
  },
752
864
  "4": {
865
+ "name": "punctuation.definition.string.heredoc.quote.shell"
866
+ },
867
+ "5": {
753
868
  "patterns": [
754
869
  {
755
870
  "include": "#redirect_fix"
756
871
  },
757
872
  {
758
- "include": "#normal_statement_inner"
873
+ "include": "#typical_statements"
759
874
  }
760
875
  ]
761
876
  }
762
877
  },
763
- "contentName": "string.quoted.heredoc.indent",
878
+ "contentName": "string.quoted.heredoc.indent.$3",
764
879
  "end": "(?:(?:^\\t*)(?:\\3)(?=\\s|;|&|$))",
765
880
  "endCaptures": {
766
881
  "0": {
767
- "name": "punctuation.definition.string.heredoc.shell"
882
+ "name": "punctuation.definition.string.heredoc.delimiter.shell"
768
883
  }
769
884
  },
770
885
  "patterns": [
771
886
  ]
772
887
  },
773
888
  {
774
- "begin": "(?:((?<!<)(?:<<)(?!<))(?:[ \\t]*+)(\"|')(?:[ \\t]*+)([^\"']+?)(?=\\s|;|&|<|\"|')(?:\\2)(.*))",
889
+ "begin": "(?:((?<!<)(?:<<)(?!<))(?:[ \\t]*+)(\"|')(?:[ \\t]*+)([^\"']+?)(?=\\s|;|&|<|\"|')((?:\\2))(.*))",
775
890
  "beginCaptures": {
776
891
  "1": {
777
892
  "name": "keyword.operator.heredoc.shell"
778
893
  },
779
894
  "2": {
895
+ "name": "punctuation.definition.string.heredoc.quote.shell"
780
896
  },
781
897
  "3": {
782
- "name": "punctuation.definition.string.heredoc.shell"
898
+ "name": "punctuation.definition.string.heredoc.delimiter.shell"
783
899
  },
784
900
  "4": {
901
+ "name": "punctuation.definition.string.heredoc.quote.shell"
902
+ },
903
+ "5": {
785
904
  "patterns": [
786
905
  {
787
906
  "include": "#redirect_fix"
788
907
  },
789
908
  {
790
- "include": "#normal_statement_inner"
909
+ "include": "#typical_statements"
791
910
  }
792
911
  ]
793
912
  }
794
913
  },
795
- "contentName": "string.quoted.heredoc.no-indent",
914
+ "contentName": "string.quoted.heredoc.no-indent.$3",
796
915
  "end": "(?:^(?:\\3)(?=\\s|;|&|$))",
797
916
  "endCaptures": {
798
917
  "0": {
799
- "name": "punctuation.definition.string.heredoc.shell"
918
+ "name": "punctuation.definition.string.heredoc.delimiter.shell"
800
919
  }
801
920
  },
802
921
  "patterns": [
@@ -809,7 +928,7 @@
809
928
  "name": "keyword.operator.heredoc.shell"
810
929
  },
811
930
  "2": {
812
- "name": "punctuation.definition.string.heredoc.shell"
931
+ "name": "punctuation.definition.string.heredoc.delimiter.shell"
813
932
  },
814
933
  "3": {
815
934
  "patterns": [
@@ -817,16 +936,16 @@
817
936
  "include": "#redirect_fix"
818
937
  },
819
938
  {
820
- "include": "#normal_statement_inner"
939
+ "include": "#typical_statements"
821
940
  }
822
941
  ]
823
942
  }
824
943
  },
825
- "contentName": "string.unquoted.heredoc.indent",
944
+ "contentName": "string.unquoted.heredoc.indent.$2",
826
945
  "end": "(?:(?:^\\t*)(?:\\2)(?=\\s|;|&|$))",
827
946
  "endCaptures": {
828
947
  "0": {
829
- "name": "punctuation.definition.string.heredoc.shell"
948
+ "name": "punctuation.definition.string.heredoc.delimiter.shell"
830
949
  }
831
950
  },
832
951
  "patterns": [
@@ -848,7 +967,7 @@
848
967
  "name": "keyword.operator.heredoc.shell"
849
968
  },
850
969
  "2": {
851
- "name": "punctuation.definition.string.heredoc.shell"
970
+ "name": "punctuation.definition.string.heredoc.delimiter.shell"
852
971
  },
853
972
  "3": {
854
973
  "patterns": [
@@ -856,16 +975,16 @@
856
975
  "include": "#redirect_fix"
857
976
  },
858
977
  {
859
- "include": "#normal_statement_inner"
978
+ "include": "#typical_statements"
860
979
  }
861
980
  ]
862
981
  }
863
982
  },
864
- "contentName": "string.unquoted.heredoc.no-indent",
983
+ "contentName": "string.unquoted.heredoc.no-indent.$2",
865
984
  "end": "(?:^(?:\\2)(?=\\s|;|&|$))",
866
985
  "endCaptures": {
867
986
  "0": {
868
- "name": "punctuation.definition.string.heredoc.shell"
987
+ "name": "punctuation.definition.string.heredoc.delimiter.shell"
869
988
  }
870
989
  },
871
990
  "patterns": [
@@ -976,13 +1095,13 @@
976
1095
  "include": "#logical_expression_single"
977
1096
  },
978
1097
  {
979
- "include": "#keyword_var_statement"
1098
+ "include": "#assignment_statement"
980
1099
  },
981
1100
  {
982
1101
  "include": "#case_statement"
983
1102
  },
984
1103
  {
985
- "include": "#misc_ranges"
1104
+ "include": "#for_statement"
986
1105
  },
987
1106
  {
988
1107
  "include": "#loop"
@@ -990,6 +1109,15 @@
990
1109
  {
991
1110
  "include": "#function_definition"
992
1111
  },
1112
+ {
1113
+ "include": "#line_continuation"
1114
+ },
1115
+ {
1116
+ "include": "#arithmetic_double"
1117
+ },
1118
+ {
1119
+ "include": "#misc_ranges"
1120
+ },
993
1121
  {
994
1122
  "include": "#variable"
995
1123
  },
@@ -1009,7 +1137,7 @@
1009
1137
  "include": "#pathname"
1010
1138
  },
1011
1139
  {
1012
- "include": "#keyword"
1140
+ "include": "#floating_keyword"
1013
1141
  },
1014
1142
  {
1015
1143
  "include": "#alias_statement"
@@ -1051,23 +1179,10 @@
1051
1179
  "interpolation": {
1052
1180
  "patterns": [
1053
1181
  {
1054
- "captures": {
1055
- "1": {
1056
- "name": "punctuation.definition.evaluation.arithmetic.begin.shell"
1057
- },
1058
- "2": {
1059
- "name": "string.other.math.shell",
1060
- "patterns": [
1061
- {
1062
- "include": "#math"
1063
- }
1064
- ]
1065
- },
1066
- "3": {
1067
- "name": "punctuation.definition.evaluation.arithmetic.end.shell"
1068
- }
1069
- },
1070
- "match": "(\\$\\({2})(.+)(\\)\\s*\\))"
1182
+ "include": "#arithmetic_dollar"
1183
+ },
1184
+ {
1185
+ "include": "#subshell_dollar"
1071
1186
  },
1072
1187
  {
1073
1188
  "begin": "`",
@@ -1113,105 +1228,18 @@
1113
1228
  "include": "#initial_context"
1114
1229
  }
1115
1230
  ]
1116
- },
1117
- {
1118
- "begin": "\\$\\(",
1119
- "beginCaptures": {
1120
- "0": {
1121
- "name": "punctuation.definition.evaluation.parens.begin.shell"
1122
- }
1123
- },
1124
- "end": "\\)",
1125
- "endCaptures": {
1126
- "0": {
1127
- "name": "punctuation.definition.evaluation.parens.end.shell"
1128
- }
1129
- },
1130
- "name": "string.interpolated.dollar.shell",
1131
- "patterns": [
1132
- {
1133
- "include": "#initial_context"
1134
- }
1135
- ]
1136
1231
  }
1137
1232
  ]
1138
1233
  },
1139
1234
  "keyword": {
1140
1235
  "patterns": [
1141
1236
  {
1142
- "match": "(?<=^|;|&| |\\t)(?:continue|foreach|return|select|repeat|break|until|while|case|done|elif|else|esac|then|for|end|do|if|fi|in)(?= |\\t|;|&|$)",
1143
- "name": "keyword.control.$0.shell"
1144
- }
1145
- ]
1146
- },
1147
- "keyword_var_statement": {
1148
- "begin": "(?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$)",
1149
- "beginCaptures": {
1150
- "0": {
1151
- "name": "storage.modifier.$0.shell"
1152
- }
1153
- },
1154
- "end": "\\n",
1155
- "endCaptures": {
1156
- },
1157
- "name": "meta.statement.shell meta.expression.assignment.shell",
1158
- "patterns": [
1159
- {
1160
- "match": "(?<!\\w)-\\w+\\b",
1161
- "name": "string.unquoted.argument.shell constant.other.option.shell"
1162
- },
1163
- {
1164
- "include": "#array_value"
1165
- },
1166
- {
1167
- "captures": {
1168
- "1": {
1169
- "name": "variable.other.assignment.shell"
1170
- },
1171
- "10": {
1172
- "name": "constant.numeric.shell constant.numeric.octal.shell"
1173
- },
1174
- "11": {
1175
- "name": "constant.numeric.shell constant.numeric.other.shell"
1176
- },
1177
- "12": {
1178
- "name": "constant.numeric.shell constant.numeric.decimal.shell"
1179
- },
1180
- "13": {
1181
- "name": "constant.numeric.shell constant.numeric.version.shell"
1182
- },
1183
- "14": {
1184
- "name": "constant.numeric.shell constant.numeric.integer.shell"
1185
- },
1186
- "2": {
1187
- "name": "punctuation.definition.array.access.shell"
1188
- },
1189
- "3": {
1190
- "name": "variable.other.assignment.shell"
1191
- },
1192
- "4": {
1193
- "name": "constant.numeric.shell constant.numeric.integer.shell"
1194
- },
1195
- "5": {
1196
- "name": "punctuation.definition.array.access.shell"
1197
- },
1198
- "6": {
1199
- "name": "keyword.operator.assignment.shell"
1200
- },
1201
- "7": {
1202
- "name": "keyword.operator.assignment.compound.shell"
1203
- },
1204
- "8": {
1205
- "name": "keyword.operator.assignment.compound.shell"
1206
- },
1207
- "9": {
1208
- "name": "constant.numeric.shell constant.numeric.hex.shell"
1209
- }
1210
- },
1211
- "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|$|\\}|\\)|;))?))"
1237
+ "match": "(?<=^|;|&|\\s)(then|else|elif|fi|for|in|do|done|select|continue|esac|while|until|return)(?=\\s|;|&|$)",
1238
+ "name": "keyword.control.shell"
1212
1239
  },
1213
1240
  {
1214
- "include": "#normal_statement_context"
1241
+ "match": "(?<=^|;|&|\\s)(?:export|declare|typeset|local|readonly)(?=\\s|;|&|$)",
1242
+ "name": "storage.modifier.shell"
1215
1243
  }
1216
1244
  ]
1217
1245
  },
@@ -1238,6 +1266,9 @@
1238
1266
  },
1239
1267
  "logical-expression": {
1240
1268
  "patterns": [
1269
+ {
1270
+ "include": "#arithmetic_no_dollar"
1271
+ },
1241
1272
  {
1242
1273
  "comment": "do we want a special rule for ( expr )?",
1243
1274
  "match": "=[=~]?|!=?|<|>|&&|\\|\\|",
@@ -1254,6 +1285,9 @@
1254
1285
  {
1255
1286
  "include": "#regex_comparison"
1256
1287
  },
1288
+ {
1289
+ "include": "#arithmetic_no_dollar"
1290
+ },
1257
1291
  {
1258
1292
  "include": "#logical-expression"
1259
1293
  },
@@ -1300,7 +1334,7 @@
1300
1334
  "include": "#pathname"
1301
1335
  },
1302
1336
  {
1303
- "include": "#keyword"
1337
+ "include": "#floating_keyword"
1304
1338
  },
1305
1339
  {
1306
1340
  "include": "#support"
@@ -1349,26 +1383,6 @@
1349
1383
  },
1350
1384
  "loop": {
1351
1385
  "patterns": [
1352
- {
1353
- "begin": "(?<=^|;|&|\\s)(for)\\s+(?=\\({2})",
1354
- "beginCaptures": {
1355
- "1": {
1356
- "name": "keyword.control.shell"
1357
- }
1358
- },
1359
- "end": "(?<=^|;|&|\\s)(?:done|(?=\\)))(?=\\s|;|&|$|\\))",
1360
- "endCaptures": {
1361
- "0": {
1362
- "name": "keyword.control.shell"
1363
- }
1364
- },
1365
- "name": "meta.scope.for-loop.shell",
1366
- "patterns": [
1367
- {
1368
- "include": "#initial_context"
1369
- }
1370
- ]
1371
- },
1372
1386
  {
1373
1387
  "begin": "(?<=^|;|&|\\s)(for)\\s+(.+?)\\s+(in)(?=\\s|;|&|$)",
1374
1388
  "beginCaptures": {
@@ -1447,13 +1461,13 @@
1447
1461
  "begin": "(?<=^|;|&|\\s)if(?=\\s|;|&|$)",
1448
1462
  "beginCaptures": {
1449
1463
  "0": {
1450
- "name": "keyword.control.shell"
1464
+ "name": "keyword.control.if.shell"
1451
1465
  }
1452
1466
  },
1453
1467
  "end": "(?<=^|;|&|\\s)fi(?=\\s|;|&|$)",
1454
1468
  "endCaptures": {
1455
1469
  "0": {
1456
- "name": "keyword.control.shell"
1470
+ "name": "keyword.control.fi.shell"
1457
1471
  }
1458
1472
  },
1459
1473
  "name": "meta.scope.if-block.shell",
@@ -1478,6 +1492,10 @@
1478
1492
  "match": "0[xX][0-9A-Fa-f]+",
1479
1493
  "name": "constant.numeric.hex.shell"
1480
1494
  },
1495
+ {
1496
+ "match": ";",
1497
+ "name": "punctuation.separator.semicolon.range"
1498
+ },
1481
1499
  {
1482
1500
  "match": "0\\d+",
1483
1501
  "name": "constant.numeric.octal.shell"
@@ -1505,86 +1523,182 @@
1505
1523
  "include": "#logical_expression_double"
1506
1524
  },
1507
1525
  {
1508
- "begin": "\\(\\(",
1526
+ "include": "#subshell_dollar"
1527
+ },
1528
+ {
1529
+ "begin": "(?<![^ \\t])({)",
1509
1530
  "beginCaptures": {
1510
- "0": {
1511
- "name": "punctuation.section.arithmetic.shell"
1531
+ "1": {
1532
+ "name": "punctuation.definition.group.shell"
1512
1533
  }
1513
1534
  },
1514
- "end": "\\)\\)",
1535
+ "end": "}",
1515
1536
  "endCaptures": {
1516
1537
  "0": {
1517
- "name": "punctuation.section.arithmetic.shell"
1538
+ "name": "punctuation.definition.group.shell"
1518
1539
  }
1519
1540
  },
1520
- "name": "meta.arithmetic.shell",
1541
+ "name": "meta.scope.group.shell",
1521
1542
  "patterns": [
1522
1543
  {
1523
- "include": "#math"
1544
+ "include": "#initial_context"
1524
1545
  }
1525
1546
  ]
1547
+ }
1548
+ ]
1549
+ },
1550
+ "modified_assignment_statement": {
1551
+ "begin": "(?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$)",
1552
+ "beginCaptures": {
1553
+ "0": {
1554
+ "name": "storage.modifier.$0.shell"
1555
+ }
1556
+ },
1557
+ "end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?<!\\\\)",
1558
+ "endCaptures": {
1559
+ },
1560
+ "name": "meta.statement.shell meta.expression.assignment.modified.shell",
1561
+ "patterns": [
1562
+ {
1563
+ "match": "(?<!\\w)-\\w+\\b",
1564
+ "name": "string.unquoted.argument.shell constant.other.option.shell"
1565
+ },
1566
+ {
1567
+ "include": "#array_value"
1568
+ },
1569
+ {
1570
+ "captures": {
1571
+ "1": {
1572
+ "name": "variable.other.assignment.shell"
1573
+ },
1574
+ "10": {
1575
+ "name": "constant.numeric.shell constant.numeric.octal.shell"
1576
+ },
1577
+ "11": {
1578
+ "name": "constant.numeric.shell constant.numeric.other.shell"
1579
+ },
1580
+ "12": {
1581
+ "name": "constant.numeric.shell constant.numeric.decimal.shell"
1582
+ },
1583
+ "13": {
1584
+ "name": "constant.numeric.shell constant.numeric.version.shell"
1585
+ },
1586
+ "14": {
1587
+ "name": "constant.numeric.shell constant.numeric.integer.shell"
1588
+ },
1589
+ "2": {
1590
+ "name": "punctuation.definition.array.access.shell"
1591
+ },
1592
+ "3": {
1593
+ "name": "variable.other.assignment.shell"
1594
+ },
1595
+ "4": {
1596
+ "name": "constant.numeric.shell constant.numeric.integer.shell"
1597
+ },
1598
+ "5": {
1599
+ "name": "punctuation.definition.array.access.shell"
1600
+ },
1601
+ "6": {
1602
+ "name": "keyword.operator.assignment.shell"
1603
+ },
1604
+ "7": {
1605
+ "name": "keyword.operator.assignment.compound.shell"
1606
+ },
1607
+ "8": {
1608
+ "name": "keyword.operator.assignment.compound.shell"
1609
+ },
1610
+ "9": {
1611
+ "name": "constant.numeric.shell constant.numeric.hex.shell"
1612
+ }
1613
+ },
1614
+ "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|$|\\}|\\)|;))?))"
1615
+ },
1616
+ {
1617
+ "include": "#normal_context"
1618
+ }
1619
+ ]
1620
+ },
1621
+ "modifiers": {
1622
+ "match": "(?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$)",
1623
+ "name": "storage.modifier.$0.shell"
1624
+ },
1625
+ "normal_assignment_statement": {
1626
+ "begin": "(?:[ \\t]*+)(?:((?<!\\w)(?:[a-zA-Z_0-9-]+)(?!\\w))(?:(?:(\\[)((?:(?:(?:(?:\\$?)(?:(?<!\\w)(?:[a-zA-Z_0-9-]+)(?!\\w))|@)|\\*)|(-?\\d+)))(\\]))?))(?:(?:(\\=)|(\\+\\=))|(\\-\\=))",
1627
+ "beginCaptures": {
1628
+ "1": {
1629
+ "name": "variable.other.assignment.shell"
1630
+ },
1631
+ "2": {
1632
+ "name": "punctuation.definition.array.access.shell"
1633
+ },
1634
+ "3": {
1635
+ "name": "variable.other.assignment.shell"
1636
+ },
1637
+ "4": {
1638
+ "name": "constant.numeric.shell constant.numeric.integer.shell"
1639
+ },
1640
+ "5": {
1641
+ "name": "punctuation.definition.array.access.shell"
1642
+ },
1643
+ "6": {
1644
+ "name": "keyword.operator.assignment.shell"
1645
+ },
1646
+ "7": {
1647
+ "name": "keyword.operator.assignment.compound.shell"
1648
+ },
1649
+ "8": {
1650
+ "name": "keyword.operator.assignment.compound.shell"
1651
+ }
1652
+ },
1653
+ "end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?<!\\\\)",
1654
+ "endCaptures": {
1655
+ },
1656
+ "name": "meta.expression.assignment.shell",
1657
+ "patterns": [
1658
+ {
1659
+ "include": "#comment"
1660
+ },
1661
+ {
1662
+ "include": "#string"
1526
1663
  },
1527
1664
  {
1528
- "begin": "(?<!=)\\(",
1529
- "beginCaptures": {
1530
- "0": {
1531
- "name": "punctuation.definition.subshell"
1532
- }
1533
- },
1534
- "end": "\\)",
1535
- "endCaptures": {
1536
- "0": {
1537
- "name": "punctuation.definition.subshell"
1538
- }
1539
- },
1540
- "name": "meta.scope.subshell",
1541
- "patterns": [
1542
- {
1543
- "include": "#initial_context"
1544
- }
1545
- ]
1665
+ "include": "#normal_assignment_statement"
1546
1666
  },
1547
1667
  {
1548
- "begin": "(?<![^ \\t])({)",
1668
+ "begin": "(?<= |\\t)(?! |\\t|\\w+=)",
1549
1669
  "beginCaptures": {
1550
- "1": {
1551
- "name": "punctuation.definition.group.shell"
1552
- }
1553
1670
  },
1554
- "end": "}",
1671
+ "end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?<!\\\\)",
1555
1672
  "endCaptures": {
1556
- "0": {
1557
- "name": "punctuation.definition.group.shell"
1558
- }
1559
1673
  },
1560
- "name": "meta.scope.group.shell",
1674
+ "name": "meta.statement.command.env.shell",
1561
1675
  "patterns": [
1562
1676
  {
1563
- "include": "#initial_context"
1677
+ "include": "#command_name_range"
1678
+ },
1679
+ {
1680
+ "include": "#line_continuation"
1681
+ },
1682
+ {
1683
+ "include": "#option"
1684
+ },
1685
+ {
1686
+ "include": "#argument"
1687
+ },
1688
+ {
1689
+ "include": "#string"
1564
1690
  }
1565
1691
  ]
1566
- }
1567
- ]
1568
- },
1569
- "modifiers": {
1570
- "match": "(?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$)",
1571
- "name": "storage.modifier.$0.shell"
1572
- },
1573
- "normal_statement": {
1574
- "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\\$))",
1575
- "beginCaptures": {
1576
- },
1577
- "end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?<!\\\\)",
1578
- "endCaptures": {
1579
- },
1580
- "name": "meta.statement.shell",
1581
- "patterns": [
1692
+ },
1582
1693
  {
1583
- "include": "#normal_statement_inner"
1694
+ "include": "#simple_unquoted"
1695
+ },
1696
+ {
1697
+ "include": "#normal_context"
1584
1698
  }
1585
1699
  ]
1586
1700
  },
1587
- "normal_statement_context": {
1701
+ "normal_context": {
1588
1702
  "patterns": [
1589
1703
  {
1590
1704
  "include": "#comment"
@@ -1629,118 +1743,27 @@
1629
1743
  "include": "#pathname"
1630
1744
  },
1631
1745
  {
1632
- "include": "#keyword"
1746
+ "include": "#floating_keyword"
1633
1747
  },
1634
1748
  {
1635
1749
  "include": "#support"
1750
+ },
1751
+ {
1752
+ "include": "#parenthese"
1636
1753
  }
1637
1754
  ]
1638
1755
  },
1639
- "normal_statement_inner": {
1756
+ "normal_statement": {
1757
+ "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\\$))",
1758
+ "beginCaptures": {
1759
+ },
1760
+ "end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?<!\\\\)",
1761
+ "endCaptures": {
1762
+ },
1763
+ "name": "meta.statement.shell",
1640
1764
  "patterns": [
1641
1765
  {
1642
- "include": "#keyword_var_statement"
1643
- },
1644
- {
1645
- "include": "#case_statement"
1646
- },
1647
- {
1648
- "include": "#function_definition"
1649
- },
1650
- {
1651
- "include": "#assignment"
1652
- },
1653
- {
1654
- "begin": "(?:(?:[ \\t]*+)(?:(?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t]))(?!foreach\\b(?!\\/)|select\\b(?!\\/)|repeat\\b(?!\\/)|until\\b(?!\\/)|while\\b(?!\\/)|case\\b(?!\\/)|done\\b(?!\\/)|elif\\b(?!\\/)|else\\b(?!\\/)|esac\\b(?!\\/)|then\\b(?!\\/)|for\\b(?!\\/)|end\\b(?!\\/)|in\\b(?!\\/)|fi\\b(?!\\/)|do\\b(?!\\/)|if\\b(?!\\/))(?!\\\\\\n?$)))",
1655
- "beginCaptures": {
1656
- },
1657
- "end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?<!\\\\)",
1658
- "endCaptures": {
1659
- },
1660
- "name": "meta.statement.command.shell",
1661
- "patterns": [
1662
- {
1663
- "begin": "\\G",
1664
- "beginCaptures": {
1665
- },
1666
- "end": "(?= |\\t|;|\\||&|$|\\n|\\)|\\`)",
1667
- "endCaptures": {
1668
- },
1669
- "name": "meta.statement.command.name.shell",
1670
- "patterns": [
1671
- {
1672
- "include": "#modifiers"
1673
- },
1674
- {
1675
- "match": "(?<!\\w)(?:continue|return|break)(?!\\w)",
1676
- "name": "entity.name.function.call.shell entity.name.command.shell keyword.control.$0.shell"
1677
- },
1678
- {
1679
- "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)",
1680
- "name": "entity.name.function.call.shell entity.name.command.shell support.function.builtin.shell"
1681
- },
1682
- {
1683
- "include": "#variable"
1684
- },
1685
- {
1686
- "captures": {
1687
- "1": {
1688
- "name": "entity.name.function.call.shell entity.name.command.shell"
1689
- }
1690
- },
1691
- "match": "(?:(?<=\\G|'|\"|\\}|\\))([^ \\n\\t\\r\"'=;&\\|`\\)\\{]+))"
1692
- },
1693
- {
1694
- "begin": "(?:(?:\\G|(?<! |\\t|;|\\||&|\\n|\\{|#))(?:(\\$?)((?:(\")|(')))))",
1695
- "beginCaptures": {
1696
- "1": {
1697
- "name": "meta.statement.command.name.quoted.shell punctuation.definition.string.shell entity.name.function.call.shell entity.name.command.shell"
1698
- },
1699
- "2": {
1700
- },
1701
- "3": {
1702
- "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"
1703
- },
1704
- "4": {
1705
- "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"
1706
- }
1707
- },
1708
- "end": "(?<!\\G)(?<=(?:\\2))",
1709
- "endCaptures": {
1710
- },
1711
- "patterns": [
1712
- {
1713
- "include": "#continuation_of_single_quoted_command_name"
1714
- },
1715
- {
1716
- "include": "#continuation_of_double_quoted_command_name"
1717
- }
1718
- ]
1719
- },
1720
- {
1721
- "include": "#line_continuation"
1722
- }
1723
- ]
1724
- },
1725
- {
1726
- "include": "#line_continuation"
1727
- },
1728
- {
1729
- "include": "#option"
1730
- },
1731
- {
1732
- "include": "#argument"
1733
- },
1734
- {
1735
- "include": "#string"
1736
- }
1737
- ]
1738
- },
1739
- {
1740
- "include": "#line_continuation"
1741
- },
1742
- {
1743
- "include": "#normal_statement_context"
1766
+ "include": "#typical_statements"
1744
1767
  }
1745
1768
  ]
1746
1769
  },
@@ -1831,13 +1854,37 @@
1831
1854
  "include": "#pathname"
1832
1855
  },
1833
1856
  {
1834
- "include": "#keyword"
1857
+ "include": "#floating_keyword"
1835
1858
  },
1836
1859
  {
1837
1860
  "include": "#support"
1838
1861
  }
1839
1862
  ]
1840
1863
  },
1864
+ "parenthese": {
1865
+ "patterns": [
1866
+ {
1867
+ "begin": "\\(",
1868
+ "beginCaptures": {
1869
+ "0": {
1870
+ "name": "punctuation.section.parenthese.shell"
1871
+ }
1872
+ },
1873
+ "end": "\\)",
1874
+ "endCaptures": {
1875
+ "0": {
1876
+ "name": "punctuation.section.parenthese.shell"
1877
+ }
1878
+ },
1879
+ "name": "meta.parenthese.group.shell",
1880
+ "patterns": [
1881
+ {
1882
+ "include": "#initial_context"
1883
+ }
1884
+ ]
1885
+ }
1886
+ ]
1887
+ },
1841
1888
  "pathname": {
1842
1889
  "patterns": [
1843
1890
  {
@@ -1973,66 +2020,12 @@
1973
2020
  "match": "[^ \\t\\n'&;<>\\(\\)\\$`\\\\\"\\|]",
1974
2021
  "name": "string.unquoted.shell"
1975
2022
  },
1976
- "start_of_command": {
1977
- "match": "(?:(?:[ \\t]*+)(?:(?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t]))(?!foreach\\b(?!\\/)|select\\b(?!\\/)|repeat\\b(?!\\/)|until\\b(?!\\/)|while\\b(?!\\/)|case\\b(?!\\/)|done\\b(?!\\/)|elif\\b(?!\\/)|else\\b(?!\\/)|esac\\b(?!\\/)|then\\b(?!\\/)|for\\b(?!\\/)|end\\b(?!\\/)|in\\b(?!\\/)|fi\\b(?!\\/)|do\\b(?!\\/)|if\\b(?!\\/))(?!\\\\\\n?$)))"
1978
- },
1979
- "start_of_double_quoted_command_name": {
1980
- "captures": {
1981
- "1": {
1982
- "name": "entity.name.function.call.shell entity.name.command.shell",
1983
- "patterns": [
1984
- {
1985
- "match": "\\*",
1986
- "name": "variable.language.special.wildcard.shell"
1987
- },
1988
- {
1989
- "include": "#variable"
1990
- },
1991
- {
1992
- "include": "#numeric_literal"
1993
- },
1994
- {
1995
- "captures": {
1996
- "1": {
1997
- "name": "constant.language.$1.shell"
1998
- }
1999
- },
2000
- "match": "(?<!\\w)(\\b(?:true|false)\\b)(?!\\w)"
2001
- }
2002
- ]
2003
- }
2004
- },
2005
- "match": "(?:(?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t]))(?:(?:(?:[ \\t]*+)((?:[^ \\t\\n'&;<>\\(\\)\\$`\\\\\"\\|]+)(?!>)))?)(?:(?:\\$\")|\"))",
2006
- "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"
2023
+ "special_expansion": {
2024
+ "match": "!|:[-=?]?|\\*|@|##|#|%%|%|\\/",
2025
+ "name": "keyword.operator.expansion.shell"
2007
2026
  },
2008
- "start_of_single_quoted_command_name": {
2009
- "captures": {
2010
- "1": {
2011
- "name": "entity.name.function.call.shell entity.name.command.shell",
2012
- "patterns": [
2013
- {
2014
- "match": "\\*",
2015
- "name": "variable.language.special.wildcard.shell"
2016
- },
2017
- {
2018
- "include": "#variable"
2019
- },
2020
- {
2021
- "include": "#numeric_literal"
2022
- },
2023
- {
2024
- "captures": {
2025
- "1": {
2026
- "name": "constant.language.$1.shell"
2027
- }
2028
- },
2029
- "match": "(?<!\\w)(\\b(?:true|false)\\b)(?!\\w)"
2030
- }
2031
- ]
2032
- }
2033
- },
2034
- "match": "(?:(?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t]))(?:(?:(?:[ \\t]*+)((?:[^ \\t\\n'&;<>\\(\\)\\$`\\\\\"\\|]+)(?!>)))?)(?:(?:\\$')|'))",
2035
- "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"
2027
+ "start_of_command": {
2028
+ "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?$)))"
2036
2029
  },
2037
2030
  "string": {
2038
2031
  "patterns": [
@@ -2117,6 +2110,33 @@
2117
2110
  }
2118
2111
  ]
2119
2112
  },
2113
+ "subshell_dollar": {
2114
+ "patterns": [
2115
+ {
2116
+ "begin": "(?:\\$\\()",
2117
+ "beginCaptures": {
2118
+ "0": {
2119
+ "name": "punctuation.definition.subshell.single.shell"
2120
+ }
2121
+ },
2122
+ "end": "\\)",
2123
+ "endCaptures": {
2124
+ "0": {
2125
+ "name": "punctuation.definition.subshell.single.shell"
2126
+ }
2127
+ },
2128
+ "name": "meta.scope.subshell",
2129
+ "patterns": [
2130
+ {
2131
+ "include": "#parenthese"
2132
+ },
2133
+ {
2134
+ "include": "#initial_context"
2135
+ }
2136
+ ]
2137
+ }
2138
+ ]
2139
+ },
2120
2140
  "support": {
2121
2141
  "patterns": [
2122
2142
  {
@@ -2125,6 +2145,34 @@
2125
2145
  }
2126
2146
  ]
2127
2147
  },
2148
+ "typical_statements": {
2149
+ "patterns": [
2150
+ {
2151
+ "include": "#assignment_statement"
2152
+ },
2153
+ {
2154
+ "include": "#case_statement"
2155
+ },
2156
+ {
2157
+ "include": "#for_statement"
2158
+ },
2159
+ {
2160
+ "include": "#function_definition"
2161
+ },
2162
+ {
2163
+ "include": "#command_statement"
2164
+ },
2165
+ {
2166
+ "include": "#line_continuation"
2167
+ },
2168
+ {
2169
+ "include": "#arithmetic_double"
2170
+ },
2171
+ {
2172
+ "include": "#normal_context"
2173
+ }
2174
+ ]
2175
+ },
2128
2176
  "variable": {
2129
2177
  "patterns": [
2130
2178
  {
@@ -2179,19 +2227,10 @@
2179
2227
  },
2180
2228
  "patterns": [
2181
2229
  {
2182
- "match": "!|:[-=?]?|\\*|@|##|#|%%|%|\\/",
2183
- "name": "keyword.operator.expansion.shell"
2230
+ "include": "#special_expansion"
2184
2231
  },
2185
2232
  {
2186
- "captures": {
2187
- "1": {
2188
- "name": "punctuation.section.array.shell"
2189
- },
2190
- "2": {
2191
- "name": "punctuation.section.array.shell"
2192
- }
2193
- },
2194
- "match": "(?:(\\[)(?:[^\\]]+)(\\]))"
2233
+ "include": "#array_access_inline"
2195
2234
  },
2196
2235
  {
2197
2236
  "match": "[0-9]+",
@@ -2228,19 +2267,10 @@
2228
2267
  },
2229
2268
  "patterns": [
2230
2269
  {
2231
- "match": "!|:[-=?]?|\\*|@|##|#|%%|%|\\/",
2232
- "name": "keyword.operator.expansion.shell"
2270
+ "include": "#special_expansion"
2233
2271
  },
2234
2272
  {
2235
- "captures": {
2236
- "1": {
2237
- "name": "punctuation.section.array.shell"
2238
- },
2239
- "2": {
2240
- "name": "punctuation.section.array.shell"
2241
- }
2242
- },
2243
- "match": "(?:(\\[)(?:[^\\]]+)(\\]))"
2273
+ "include": "#array_access_inline"
2244
2274
  },
2245
2275
  {
2246
2276
  "match": "(?<!\\w)(?:[a-zA-Z_0-9-]+)(?!\\w)",