123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137 |
- 'scopeName': 'source.shell'
- 'name': 'Shell Script'
- 'fileTypes': [
- 'sh'
- 'bash'
- 'ksh'
- 'zsh'
- 'zsh-theme'
- 'zshenv'
- 'zlogin'
- 'zlogout'
- 'zprofile'
- 'zshrc'
- 'bashrc'
- 'bash_aliases'
- 'bash_profile'
- 'bash_login'
- 'profile'
- 'bash_logout'
- '.textmate_init'
- 'npmrc'
- 'PKGBUILD'
- 'install'
- 'cygport'
- 'bats'
- 'ebuild'
- ]
- 'firstLineMatch': '''(?x)
- # Hashbang
- ^\\#!.*(?:\\s|\\/)
- (?:bash|zsh|sh|tcsh|ksh|dash|ash|csh|rc)
- (?:$|\\s)
- |
- # Modeline
- (?i:
- # Emacs
- -\\*-(?:\\s*(?=[^:;\\s]+\\s*-\\*-)|(?:.*?[;\\s]|(?<=-\\*-))mode\\s*:\\s*)
- (?:shell-script|sh)
- (?=[\\s;]|(?<![-*])-\\*-).*?-\\*-
- |
- # Vim
- (?:(?:\\s|^)vi(?:m[<=>]?\\d+|m)?|\\sex)(?=:(?=\\s*set?\\s[^\\n:]+:)|:(?!\\s* set?\\s))(?:(?:\\s|\\s*:\\s*)\\w*(?:\\s*=(?:[^\\n\\\\\\s]|\\\\.)*)?)*[\\s:](?:filetype|ft|syntax)\\s*=
- sh
- (?=\\s|:|$)
- )
- '''
- 'patterns': [
- {
- 'include': '#comment'
- }
- {
- 'include': '#pipeline'
- }
- {
- 'include': '#list'
- }
- {
- 'include': '#compound-command'
- }
- {
- 'include': '#loop'
- }
- {
- 'include': '#string'
- }
- {
- 'include': '#function-definition'
- }
- {
- 'include': '#variable'
- }
- {
- 'include': '#interpolation'
- }
- {
- 'include': '#heredoc'
- }
- {
- 'include': '#herestring'
- }
- {
- 'include': '#redirection'
- }
- {
- 'include': '#pathname'
- }
- {
- 'include': '#keyword'
- }
- {
- 'include': '#support'
- }
- ]
- 'repository':
- 'case-clause':
- 'patterns': [
- {
- 'begin': '(?=\\S)'
- 'end': ';;'
- 'endCaptures':
- '0':
- 'name': 'punctuation.terminator.case-clause.shell'
- 'name': 'meta.scope.case-clause.shell'
- 'patterns': [
- {
- 'begin': '\\(|(?=\\S)'
- 'beginCaptures':
- '0':
- 'name': 'punctuation.definition.case-pattern.shell'
- 'end': '\\)'
- 'endCaptures':
- '0':
- 'name': 'punctuation.definition.case-pattern.shell'
- 'name': 'meta.scope.case-pattern.shell'
- 'patterns': [
- {
- 'match': '\\|'
- 'name': 'punctuation.separator.pipe-sign.shell'
- }
- {
- 'include': '#string'
- }
- {
- 'include': '#variable'
- }
- {
- 'include': '#interpolation'
- }
- {
- 'include': '#pathname'
- }
- ]
- }
- {
- 'begin': '(?<=\\))'
- 'end': '(?=;;)'
- 'name': 'meta.scope.case-clause-body.shell'
- 'patterns': [
- {
- 'include': '$self'
- }
- ]
- }
- ]
- }
- ]
- 'comment':
- 'begin': '(^\\s+)?(?<=^|\\W)(?<!-)(?=#)(?!#{)'
- 'beginCaptures':
- '1':
- 'name': 'punctuation.whitespace.comment.leading.shell'
- 'end': '(?!\\G)'
- 'patterns': [
- {
- 'begin': '#!'
- 'beginCaptures':
- '0':
- 'name': 'punctuation.definition.comment.shebang.shell'
- 'end': '$'
- 'name': 'comment.line.number-sign.shebang.shell'
- }
- {
- 'begin': '#'
- 'beginCaptures':
- '0':
- 'name': 'punctuation.definition.comment.shell'
- 'end': '$'
- 'name': 'comment.line.number-sign.shell'
- }
- ]
- 'compound-command':
- 'patterns': [
- {
- 'begin': '\\[{1,2}'
- 'beginCaptures':
- '0':
- 'name': 'punctuation.definition.logical-expression.shell'
- 'end': '\\]{1,2}'
- 'endCaptures':
- '0':
- 'name': 'punctuation.definition.logical-expression.shell'
- 'name': 'meta.scope.logical-expression.shell'
- 'patterns': [
- {
- 'include': '#logical-expression'
- }
- {
- 'include': '$self'
- }
- ]
- }
- {
- 'begin': '\\({2}'
- 'beginCaptures':
- '0':
- 'name': 'punctuation.definition.string.begin.shell'
- 'end': '\\){2}'
- 'endCaptures':
- '0':
- 'name': 'punctuation.definition.string.end.shell'
- 'name': 'string.other.math.shell'
- 'patterns': [
- {
- 'include': '#math'
- }
- ]
- }
- {
- 'begin': '\\('
- 'beginCaptures':
- '0':
- 'name': 'punctuation.definition.subshell.shell'
- 'end': '\\)'
- 'endCaptures':
- '0':
- 'name': 'punctuation.definition.subshell.shell'
- 'name': 'meta.scope.subshell.shell'
- 'patterns': [
- {
- 'include': '$self'
- }
- ]
- }
- {
- 'begin': '(?<=\\s|^){(?=\\s|$)'
- 'beginCaptures':
- '0':
- 'name': 'punctuation.definition.group.shell'
- 'end': '(?<=^|;)\\s*(})'
- 'endCaptures':
- '1':
- 'name': 'punctuation.definition.group.shell'
- 'name': 'meta.scope.group.shell'
- 'patterns': [
- {
- 'include': '$self'
- }
- ]
- }
- ]
- 'function-definition':
- 'patterns': [
- {
- 'begin': '(?<=^|;|&|\\s)(function)\\s+([^\\s\\\\]+)(?:\\s*(\\(\\)))?'
- 'beginCaptures':
- '1':
- 'name': 'storage.type.function.shell'
- '2':
- 'name': 'entity.name.function.shell'
- '3':
- 'name': 'punctuation.definition.arguments.shell'
- 'end': ';|&|$'
- 'endCaptures':
- '0':
- 'name': 'punctuation.definition.function.shell'
- 'name': 'meta.function.shell'
- 'patterns': [
- {
- 'include': '$self'
- }
- ]
- }
- {
- 'begin': '(?<=^|;|&|\\s)([^\\s\\\\=]+)\\s*(\\(\\))'
- 'beginCaptures':
- '1':
- 'name': 'entity.name.function.shell'
- '2':
- 'name': 'punctuation.definition.arguments.shell'
- 'end': ';|&|$'
- 'endCaptures':
- '0':
- 'name': 'punctuation.definition.function.shell'
- 'name': 'meta.function.shell'
- 'patterns': [
- {
- 'include': '$self'
- }
- ]
- }
- ]
- 'heredoc':
- 'patterns': [
- {
- 'begin': '(<<)-\\s*("|\'|)\\s*(RUBY)(?=\\s|;|&|<|"|\')\\2'
- 'beginCaptures':
- '1':
- 'name': 'keyword.operator.heredoc.shell'
- '3':
- 'name': 'keyword.control.heredoc-token.shell'
- 'end': '^\\t*(RUBY)(?=\\s|;|&|$)'
- 'endCaptures':
- '1':
- 'name': 'keyword.control.heredoc-token.shell'
- 'name': 'string.unquoted.heredoc.no-indent.ruby.shell'
- 'contentName': 'source.ruby.embedded.shell'
- 'patterns': [
- {
- 'include': 'source.ruby'
- }
- ]
- }
- {
- 'begin': '(<<)\\s*("|\'|)\\s*(RUBY)(?=\\s|;|&|<|"|\')\\2'
- 'beginCaptures':
- '1':
- 'name': 'keyword.operator.heredoc.shell'
- '3':
- 'name': 'keyword.control.heredoc-token.shell'
- 'end': '^(RUBY)(?=\\s|;|&|$)'
- 'endCaptures':
- '1':
- 'name': 'keyword.control.heredoc-token.shell'
- 'name': 'string.unquoted.heredoc.ruby.shell'
- 'contentName': 'source.ruby.embedded.shell'
- 'patterns': [
- {
- 'include': 'source.ruby'
- }
- ]
- }
- {
- 'begin': '(<<)-\\s*("|\'|)\\s*(PYTHON)(?=\\s|;|&|<|"|\')\\2'
- 'beginCaptures':
- '1':
- 'name': 'keyword.operator.heredoc.shell'
- '3':
- 'name': 'keyword.control.heredoc-token.shell'
- 'end': '^\\t*(PYTHON)(?=\\s|;|&|$)'
- 'endCaptures':
- '1':
- 'name': 'keyword.control.heredoc-token.shell'
- 'name': 'string.unquoted.heredoc.no-indent.python.shell'
- 'contentName': 'source.python.embedded.shell'
- 'patterns': [
- {
- 'include': 'source.python'
- }
- ]
- }
- {
- 'begin': '(<<)\\s*("|\'|)\\s*(PYTHON)(?=\\s|;|&|<|"|\')\\2'
- 'beginCaptures':
- '1':
- 'name': 'keyword.operator.heredoc.shell'
- '3':
- 'name': 'keyword.control.heredoc-token.shell'
- 'end': '^(PYTHON)(?=\\s|;|&|$)'
- 'endCaptures':
- '1':
- 'name': 'keyword.control.heredoc-token.shell'
- 'name': 'string.unquoted.heredoc.python.shell'
- 'contentName': 'source.python.embedded.shell'
- 'patterns': [
- {
- 'include': 'source.python'
- }
- ]
- }
- {
- 'begin': '(<<)-\\s*("|\'|)\\s*(APPLESCRIPT)(?=\\s|;|&|<|"|\')\\2'
- 'beginCaptures':
- '1':
- 'name': 'keyword.operator.heredoc.shell'
- '3':
- 'name': 'keyword.control.heredoc-token.shell'
- 'end': '^\\t*(APPLESCRIPT)(?=\\s|;|&|$)'
- 'endCaptures':
- '1':
- 'name': 'keyword.control.heredoc-token.shell'
- 'name': 'string.unquoted.heredoc.no-indent.applescript.shell'
- 'contentName': 'source.applescript.embedded.shell'
- 'patterns': [
- {
- 'include': 'source.applescript'
- }
- ]
- }
- {
- 'begin': '(<<)\\s*("|\'|)\\s*(APPLESCRIPT)(?=\\s|;|&|<|"|\')\\2'
- 'beginCaptures':
- '1':
- 'name': 'keyword.operator.heredoc.shell'
- '3':
- 'name': 'keyword.control.heredoc-token.shell'
- 'end': '^(APPLESCRIPT)(?=\\s|;|&|$)'
- 'endCaptures':
- '1':
- 'name': 'keyword.control.heredoc-token.shell'
- 'name': 'string.unquoted.heredoc.applescript.shell'
- 'contentName': 'source.applescript.embedded.shell'
- 'patterns': [
- {
- 'include': 'source.applescript'
- }
- ]
- }
- {
- 'begin': '(<<)-\\s*("|\'|)\\s*(HTML)(?=\\s|;|&|<|"|\')\\2'
- 'beginCaptures':
- '1':
- 'name': 'keyword.operator.heredoc.shell'
- '3':
- 'name': 'keyword.control.heredoc-token.shell'
- 'end': '^\\t*(HTML)(?=\\s|;|&|$)'
- 'endCaptures':
- '1':
- 'name': 'keyword.control.heredoc-token.shell'
- 'name': 'string.unquoted.heredoc.no-indent.html.shell'
- 'contentName': 'text.html.embedded.shell'
- 'patterns': [
- {
- 'include': 'text.html.basic'
- }
- ]
- }
- {
- 'begin': '(<<)\\s*("|\'|)\\s*(HTML)(?=\\s|;|&|<|"|\')\\2'
- 'beginCaptures':
- '1':
- 'name': 'keyword.operator.heredoc.shell'
- '3':
- 'name': 'keyword.control.heredoc-token.shell'
- 'end': '^(HTML)(?=\\s|;|&|$)'
- 'endCaptures':
- '1':
- 'name': 'keyword.control.heredoc-token.shell'
- 'name': 'string.unquoted.heredoc.html.shell'
- 'contentName': 'text.html.embedded.shell'
- 'patterns': [
- {
- 'include': 'text.html.basic'
- }
- ]
- }
- {
- 'begin': '(<<)-\\s*("|\'|)\\s*(MARKDOWN)(?=\\s|;|&|<|"|\')\\2'
- 'beginCaptures':
- '1':
- 'name': 'keyword.operator.heredoc.shell'
- '3':
- 'name': 'keyword.control.heredoc-token.shell'
- 'end': '^\\t*(MARKDOWN)(?=\\s|;|&|$)'
- 'endCaptures':
- '1':
- 'name': 'keyword.control.heredoc-token.shell'
- 'name': 'string.unquoted.heredoc.no-indent.markdown.shell'
- 'contentName': 'text.html.markdown.embedded.shell'
- 'patterns': [
- {
- 'include': 'text.html.markdown'
- }
- ]
- }
- {
- 'begin': '(<<)\\s*("|\'|)\\s*(MARKDOWN)(?=\\s|;|&|<|"|\')\\2'
- 'beginCaptures':
- '1':
- 'name': 'keyword.operator.heredoc.shell'
- '3':
- 'name': 'keyword.control.heredoc-token.shell'
- 'end': '^(MARKDOWN)(?=\\s|;|&|$)'
- 'endCaptures':
- '1':
- 'name': 'keyword.control.heredoc-token.shell'
- 'name': 'string.unquoted.heredoc.markdown.shell'
- 'contentName': 'text.html.markdown.embedded.shell'
- 'patterns': [
- {
- 'include': 'text.html.markdown'
- }
- ]
- }
- {
- 'begin': '(<<)-\\s*("|\'|)\\s*(TEXTILE)(?=\\s|;|&|<|"|\')\\2'
- 'beginCaptures':
- '1':
- 'name': 'keyword.operator.heredoc.shell'
- '3':
- 'name': 'keyword.control.heredoc-token.shell'
- 'end': '^\\t*(TEXTILE)(?=\\s|;|&|$)'
- 'endCaptures':
- '1':
- 'name': 'keyword.control.heredoc-token.shell'
- 'name': 'string.unquoted.heredoc.no-indent.textile.shell'
- 'contentName': 'text.html.textile.embedded.shell'
- 'patterns': [
- {
- 'include': 'text.html.textile'
- }
- ]
- }
- {
- 'begin': '(<<)\\s*("|\'|)\\s*(TEXTILE)(?=\\s|;|&|<|"|\')\\2'
- 'beginCaptures':
- '1':
- 'name': 'keyword.operator.heredoc.shell'
- '3':
- 'name': 'keyword.control.heredoc-token.shell'
- 'end': '^(TEXTILE)(?=\\s|;|&|$)'
- 'endCaptures':
- '1':
- 'name': 'keyword.control.heredoc-token.shell'
- 'name': 'string.unquoted.heredoc.textile.shell'
- 'contentName': 'text.html.textile.embedded.shell'
- 'patterns': [
- {
- 'include': 'text.html.textile'
- }
- ]
- }
- {
- 'begin': '(<<)-\\s*("|\'|)\\s*(SHELL)(?=\\s|;|&|<|"|\')\\2'
- 'beginCaptures':
- '1':
- 'name': 'keyword.operator.heredoc.shell'
- '3':
- 'name': 'keyword.control.heredoc-token.shell'
- 'end': '^\\t*(\\3)(?=\\s|;|&|$)'
- 'endCaptures':
- '1':
- 'name': 'keyword.control.heredoc-token.shell'
- 'contentName': 'source.shell.embedded.shell'
- 'name': 'string.unquoted.heredoc.no-indent.shell.shell'
- 'patterns': [
- {
- 'include': 'source.shell'
- }
- ]
- }
- {
- 'begin': '(<<)\\s*("|\'|)\\s*(SHELL)(?=\\s|;|&|<|"|\')\\2'
- 'beginCaptures':
- '1':
- 'name': 'keyword.operator.heredoc.shell'
- '3':
- 'name': 'keyword.control.heredoc-token.shell'
- 'end': '^(\\3)(?=\\s|;|&|$)'
- 'endCaptures':
- '1':
- 'name': 'keyword.control.heredoc-token.shell'
- 'name': 'string.unquoted.heredoc.shell.shell'
- 'contentName': 'source.shell.embedded.shell'
- 'patterns': [
- {
- 'include': 'source.shell'
- }
- ]
- }
- {
- 'begin': '(<<)-\\s*("|\')\\s*\\\\?([^;&<\\s]+)\\2'
- 'beginCaptures':
- '1':
- 'name': 'keyword.operator.heredoc.shell'
- '3':
- 'name': 'keyword.control.heredoc-token.shell'
- 'end': '^\\t*(\\3)(?=\\s|;|&|$)'
- 'endCaptures':
- '1':
- 'name': 'keyword.control.heredoc-token.shell'
- 'name': 'string.unquoted.heredoc.no-indent.shell'
- }
- {
- 'begin': '(<<)\\s*("|\')\\s*\\\\?([^;&<\\s]+)\\2'
- 'beginCaptures':
- '1':
- 'name': 'keyword.operator.heredoc.shell'
- '3':
- 'name': 'keyword.control.heredoc-token.shell'
- 'end': '^(\\3)(?=\\s|;|&|$)'
- 'endCaptures':
- '1':
- 'name': 'keyword.control.heredoc-token.shell'
- 'name': 'string.unquoted.heredoc.shell'
- }
- {
- 'begin': '(<<)-\\s*\\\\?([^;&<\\s]+)'
- 'beginCaptures':
- '1':
- 'name': 'keyword.operator.heredoc.shell'
- '2':
- 'name': 'keyword.control.heredoc-token.shell'
- 'end': '^\\t*(\\2)(?=\\s|;|&|$)'
- 'endCaptures':
- '1':
- 'name': 'keyword.control.heredoc-token.shell'
- 'name': 'string.unquoted.heredoc.expanded.no-indent.shell'
- 'patterns': [
- {
- 'match': '\\\\[\\$`\\\\\\n]'
- 'name': 'constant.character.escape.shell'
- }
- {
- 'include': '#variable'
- }
- {
- 'include': '#interpolation'
- }
- ]
- }
- {
- 'begin': '(<<)\\s*\\\\?([^;&<\\s]+)'
- 'beginCaptures':
- '1':
- 'name': 'keyword.operator.heredoc.shell'
- '2':
- 'name': 'keyword.control.heredoc-token.shell'
- 'end': '^(\\2)(?=\\s|;|&|$)'
- 'endCaptures':
- '1':
- 'name': 'keyword.control.heredoc-token.shell'
- 'name': 'string.unquoted.heredoc.expanded.shell'
- 'patterns': [
- {
- 'match': '\\\\[\\$`\\\\\\n]'
- 'name': 'constant.character.escape.shell'
- }
- {
- 'include': '#variable'
- }
- {
- 'include': '#interpolation'
- }
- ]
- }
- ]
- 'herestring':
- 'patterns': [
- {
- 'begin': '(<<<)\\s*((\'))'
- 'beginCaptures':
- '1':
- 'name': 'keyword.operator.herestring.shell'
- '2':
- 'name': 'string.quoted.single.shell'
- '3':
- 'name': 'punctuation.definition.string.begin.shell'
- 'end': '(\')'
- 'endCaptures':
- '0':
- 'name': 'string.quoted.single.shell'
- '1':
- 'name': 'punctuation.definition.string.end.shell'
- 'name': 'meta.herestring.shell'
- 'contentName': 'string.quoted.single.shell'
- }
- {
- 'begin': '(<<<)\\s*(("))'
- 'beginCaptures':
- '1':
- 'name': 'keyword.operator.herestring.shell'
- '2':
- 'name': 'string.quoted.double.shell'
- '3':
- 'name': 'punctuation.definition.string.begin.shell'
- 'end': '(")'
- 'endCaptures':
- '0':
- 'name': 'string.quoted.double.shell'
- '1':
- 'name': 'punctuation.definition.string.end.shell'
- 'name': 'meta.herestring.shell'
- 'contentName': 'string.quoted.double.shell'
- }
- {
- 'captures':
- '1':
- 'name': 'keyword.operator.herestring.shell'
- '2':
- 'name': 'string.unquoted.herestring.shell'
- 'patterns': [
- {
- 'include': '$self'
- }
- ]
- 'match': '(<<<)\\s*(([^\\s)\\\\]|\\\\.)+)'
- 'name': 'meta.herestring.shell'
- }
- ]
- 'interpolation':
- 'patterns': [
- {
- 'begin': '\\$\\({2}'
- 'beginCaptures':
- '0':
- 'name': 'punctuation.definition.string.begin.shell'
- 'end': '\\){2}'
- 'endCaptures':
- '0':
- 'name': 'punctuation.definition.string.end.shell'
- 'name': 'string.other.math.shell'
- 'patterns': [
- {
- 'include': '#math'
- }
- ]
- }
- {
- 'begin': '`'
- 'beginCaptures':
- '0':
- 'name': 'punctuation.definition.string.begin.shell'
- 'end': '`'
- 'endCaptures':
- '0':
- 'name': 'punctuation.definition.string.end.shell'
- 'name': 'string.interpolated.backtick.shell'
- 'patterns': [
- {
- 'match': '\\\\[`\\\\$]'
- 'name': 'constant.character.escape.shell'
- }
- {
- # Lifted from the #comment section to handle ending on ` instead of $
- 'begin': '(?<=\\W)(?=#)(?!#{)'
- 'beginCaptures':
- '1':
- 'name': 'punctuation.whitespace.comment.leading.shell'
- 'end': '(?!\\G)'
- 'patterns': [
- {
- 'begin': '#'
- 'beginCaptures':
- '0':
- 'name': 'punctuation.definition.comment.shell'
- 'end': '(?=`)'
- 'name': 'comment.line.number-sign.shell'
- }
- ]
- }
- {
- 'include': '$self'
- }
- ]
- }
- {
- 'begin': '\\$\\('
- 'beginCaptures':
- '0':
- 'name': 'punctuation.definition.string.begin.shell'
- 'end': '\\)'
- 'endCaptures':
- '0':
- 'name': 'punctuation.definition.string.end.shell'
- 'name': 'string.interpolated.dollar.shell'
- 'patterns': [
- {
- 'include': '$self'
- }
- ]
- }
- ]
- 'keyword':
- 'patterns': [
- {
- 'match': '(?<=^|;|&|\\s)(then|else|elif|fi|for|in|do|done|select|case|continue|esac|while|until|return)(?=\\s|;|&|$)'
- 'name': 'keyword.control.shell'
- }
- {
- 'match': '(?<=^|;|&|\\s)(?:export|declare|typeset|local|readonly)(?=\\s|;|&|$)'
- 'name': 'storage.modifier.shell'
- }
- ]
- 'list':
- 'patterns': [
- {
- 'match': ';|&&|&|\\|\\|'
- 'name': 'keyword.operator.list.shell'
- }
- ]
- 'logical-expression':
- 'patterns': [
- {
- 'comment': 'do we want a special rule for ( expr )?'
- 'match': '=[=~]?|!=?|<|>|&&|\\|\\|'
- 'name': 'keyword.operator.logical.shell'
- }
- {
- 'match': '(?<!\\S)-(nt|ot|ef|eq|ne|l[te]|g[te]|[a-hknoprstuwxzOGLSN])'
- 'name': 'keyword.operator.logical.shell'
- }
- ]
- 'loop':
- 'patterns': [
- {
- 'begin': '(?<=^|;|&|\\s)(for)\\s+(?=\\({2})'
- 'beginCaptures':
- '1':
- 'name': 'keyword.control.shell'
- 'end': '(?<=^|;|&|\\s)done(?=\\s|;|&|$)'
- 'endCaptures':
- '0':
- 'name': 'keyword.control.shell'
- 'name': 'meta.scope.for-loop.shell'
- 'patterns': [
- {
- 'include': '$self'
- }
- ]
- }
- {
- 'begin': '(?<=^|;|&|\\s)(for)\\s+(.+?)\\s+(in)(?=\\s|;|&|$)'
- 'beginCaptures':
- '1':
- 'name': 'keyword.control.shell'
- '2':
- 'name': 'variable.other.loop.shell'
- 'patterns': [
- {
- 'include': '#string'
- }
- ]
- '3':
- 'name': 'keyword.control.shell'
- 'end': '(?<=^|;|&|\\s)done(?=\\s|;|&|$)'
- 'endCaptures':
- '0':
- 'name': 'keyword.control.shell'
- 'name': 'meta.scope.for-in-loop.shell'
- 'patterns': [
- {
- 'include': '$self'
- }
- ]
- }
- {
- 'begin': '(?<=^|;|&|\\s)(while|until)(?=\\s|;|&|$)'
- 'beginCaptures':
- '1':
- 'name': 'keyword.control.shell'
- 'end': '(?<=^|;|&|\\s)done(?=\\s|;|&|$)'
- 'endCaptures':
- '0':
- 'name': 'keyword.control.shell'
- 'name': 'meta.scope.while-loop.shell'
- 'patterns': [
- {
- 'include': '$self'
- }
- ]
- }
- {
- 'begin': '(?<=^|;|&|\\s)(select)\\s+((?:[^\\s\\\\]|\\\\.)+)(?=\\s|;|&|$)'
- 'beginCaptures':
- '1':
- 'name': 'keyword.control.shell'
- '2':
- 'name': 'variable.other.loop.shell'
- 'end': '(?<=^|;|&|\\s)(done)(?=\\s|;|&|$)'
- 'endCaptures':
- '1':
- 'name': 'keyword.control.shell'
- 'name': 'meta.scope.select-block.shell'
- 'patterns': [
- {
- 'include': '$self'
- }
- ]
- }
- {
- 'begin': '(?<=^|;|&|\\s)case(?=\\s|;|&|$)'
- 'beginCaptures':
- '0':
- 'name': 'keyword.control.shell'
- 'end': '(?<=^|;|&|\\s)esac(?=\\s|;|&|$)'
- 'endCaptures':
- '0':
- 'name': 'keyword.control.shell'
- 'name': 'meta.scope.case-block.shell'
- 'patterns': [
- {
- 'begin': '(?<=^|;|&|\\s)in(?=\\s|;|&|$)'
- 'beginCaptures':
- '0':
- 'name': 'keyword.control.shell'
- 'end': '(?<=^|;|&|\\s)(?=esac(\\s|;|&|$))'
- 'name': 'meta.scope.case-body.shell'
- 'patterns': [
- {
- 'include': '#comment'
- }
- {
- 'include': '#case-clause'
- }
- {
- 'include': '$self'
- }
- ]
- }
- {
- 'include': '$self'
- }
- ]
- }
- {
- 'begin': '(?<=^|;|&|\\s)if(?=\\s|;|&|$)'
- 'beginCaptures':
- '0':
- 'name': 'keyword.control.shell'
- 'end': '(?<=^|;|&|\\s)fi(?=\\s|;|&|$)'
- 'endCaptures':
- '0':
- 'name': 'keyword.control.shell'
- 'name': 'meta.scope.if-block.shell'
- 'patterns': [
- {
- 'include': '$self'
- }
- ]
- }
- ]
- 'math':
- 'patterns': [
- {
- 'include': '#variable'
- }
- {
- 'match': '\\+{1,2}|-{1,2}|!|~|\\*{1,2}|/|%|<[<=]?|>[>=]?|==|!=|^|\\|{1,2}|&{1,2}|\\?|\\:|,|=|[*/%+\\-&^|]=|<<=|>>='
- 'name': 'keyword.operator.arithmetic.shell'
- }
- {
- 'match': '0[xX][0-9A-Fa-f]+'
- 'name': 'constant.numeric.hex.shell'
- }
- {
- 'match': '0\\d+'
- 'name': 'constant.numeric.octal.shell'
- }
- {
- 'match': '\\d{1,2}#[0-9a-zA-Z@_]+'
- 'name': 'constant.numeric.other.shell'
- }
- {
- 'match': '\\d+'
- 'name': 'constant.numeric.integer.shell'
- }
- ]
- 'pathname':
- 'patterns': [
- {
- 'match': '(?<=\\s|:|=|^)~'
- 'name': 'keyword.operator.tilde.shell'
- }
- {
- 'match': '\\*|\\?'
- 'name': 'keyword.operator.glob.shell'
- }
- {
- 'begin': '([?*+@!])(\\()'
- 'beginCaptures':
- '1':
- 'name': 'keyword.operator.extglob.shell'
- '2':
- 'name': 'punctuation.definition.extglob.shell'
- 'end': '\\)'
- 'endCaptures':
- '0':
- 'name': 'punctuation.definition.extglob.shell'
- 'name': 'meta.structure.extglob.shell'
- 'patterns': [
- {
- 'include': '$self'
- }
- ]
- }
- ]
- 'pipeline':
- 'patterns': [
- {
- 'match': '(?<=^|;|&|\\s)(time)(?=\\s|;|&|$)'
- 'name': 'keyword.other.shell'
- }
- {
- 'match': '[|!]'
- 'name': 'keyword.operator.pipe.shell'
- }
- ]
- 'redirection':
- 'patterns': [
- {
- 'begin': '[><]\\('
- 'beginCaptures':
- '0':
- 'name': 'punctuation.definition.string.begin.shell'
- 'end': '\\)'
- 'endCaptures':
- '0':
- 'name': 'punctuation.definition.string.end.shell'
- 'name': 'string.interpolated.process-substitution.shell'
- 'patterns': [
- {
- 'include': '$self'
- }
- ]
- }
- {
- # valid: &>word >&word >word [n]>&[n] [n]<word [n]>word [n]>>word [n]<&word (last one is duplicate)
- 'match': '(?<![<>])(&>|\\d*>&\\d*|\\d*(>>|>|<)|\\d*<&|\\d*<>)(?![<>])'
- 'name': 'keyword.operator.redirect.shell'
- }
- ]
- 'string':
- 'patterns': [
- {
- 'match': '\\\\.'
- 'name': 'constant.character.escape.shell'
- }
- {
- 'begin': '\''
- 'beginCaptures':
- '0':
- 'name': 'punctuation.definition.string.begin.shell'
- 'end': '\''
- 'endCaptures':
- '0':
- 'name': 'punctuation.definition.string.end.shell'
- 'name': 'string.quoted.single.shell'
- }
- {
- 'begin': '\\$?"'
- 'beginCaptures':
- '0':
- 'name': 'punctuation.definition.string.begin.shell'
- 'end': '"'
- 'endCaptures':
- '0':
- 'name': 'punctuation.definition.string.end.shell'
- 'name': 'string.quoted.double.shell'
- 'patterns': [
- {
- 'match': '\\\\[\\$`"\\\\\\n]'
- 'name': 'constant.character.escape.shell'
- }
- {
- 'include': '#variable'
- }
- {
- 'include': '#interpolation'
- }
- ]
- }
- {
- 'begin': '\\$\''
- 'beginCaptures':
- '0':
- 'name': 'punctuation.definition.string.begin.shell'
- 'end': '\''
- 'endCaptures':
- '0':
- 'name': 'punctuation.definition.string.end.shell'
- 'name': 'string.quoted.single.dollar.shell'
- 'patterns': [
- {
- 'match': '\\\\(a|b|e|f|n|r|t|v|\\\\|\')'
- 'name': 'constant.character.escape.ansi-c.shell'
- }
- {
- 'match': '\\\\[0-9]{3}'
- 'name': 'constant.character.escape.octal.shell'
- }
- {
- 'match': '\\\\x[0-9a-fA-F]{2}'
- 'name': 'constant.character.escape.hex.shell'
- }
- {
- 'match': '\\\\c.'
- 'name': 'constant.character.escape.control-char.shell'
- }
- ]
- }
- ]
- 'support':
- 'patterns': [
- {
- 'match': '(?<=^|;|&|\\s)(?::|\\.)(?=\\s|;|&|$)'
- 'name': 'support.function.builtin.shell'
- }
- {
- '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|;|&|$)'
- 'name': 'support.function.builtin.shell'
- }
- ]
- 'variable':
- 'patterns': [
- {
- 'captures':
- '1':
- 'name': 'punctuation.definition.variable.shell'
- 'match': '(\\$)[a-zA-Z_][a-zA-Z0-9_]*'
- 'name': 'variable.other.normal.shell'
- }
- {
- 'captures':
- '1':
- 'name': 'punctuation.definition.variable.shell'
- 'match': '(\\$)[-*@#?$!0_]'
- 'name': 'variable.other.special.shell'
- }
- {
- 'captures':
- '1':
- 'name': 'punctuation.definition.variable.shell'
- 'match': '(\\$)[1-9]'
- 'name': 'variable.other.positional.shell'
- }
- {
- 'begin': '\\${'
- 'beginCaptures':
- '0':
- 'name': 'punctuation.definition.variable.shell'
- 'end': '}'
- 'endCaptures':
- '0':
- 'name': 'punctuation.definition.variable.shell'
- 'name': 'variable.other.bracket.shell'
- 'patterns': [
- {
- 'match': '!|:[-=?]?|\\*|@|\#\{1,2}|%{1,2}|/' # #{ is escaped to prevent coffeelint complaining about interpolation
- 'name': 'keyword.operator.expansion.shell'
- }
- {
- 'captures':
- '1':
- 'name': 'punctuation.section.array.shell'
- '3':
- 'name': 'punctuation.section.array.shell'
- 'match': '(\\[)([^\\]]+)(\\])'
- }
- {
- 'include': '#variable'
- }
- {
- 'include': '#string'
- }
- ]
- }
- ]
|