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