diff --git a/extensions/shellscript/package.json b/extensions/shellscript/package.json index e0ff83c74912a574fc4c399ccbe2fe16dd821f93..f2b82e9f569c1b48086a9fc1d1c205fb20d99371 100644 --- a/extensions/shellscript/package.json +++ b/extensions/shellscript/package.json @@ -4,7 +4,7 @@ "publisher": "vscode", "engines": { "vscode": "*" }, "scripts": { - "update-grammar": "node ../../build/npm/update-grammar.js textmate/shellscript.tmbundle Syntaxes/Shell-Unix-Bash.tmLanguage ./syntaxes/Shell-Unix-Bash.tmLanguage.json" + "update-grammar": "node ../../build/npm/update-grammar.js atom/language-shellscript grammars/shell-unix-bash.cson ./syntaxes/shell-unix-bash.tmLanguage.json" }, "contributes": { "languages": [{ @@ -19,7 +19,7 @@ "grammars": [{ "language": "shellscript", "scopeName": "source.shell", - "path": "./syntaxes/Shell-Unix-Bash.tmLanguage.json" + "path": "./syntaxes/shell-unix-bash.tmLanguage.json" }] } } diff --git a/extensions/shellscript/syntaxes/Shell-Unix-Bash.tmLanguage.json b/extensions/shellscript/syntaxes/shell-unix-bash.tmLanguage.json similarity index 76% rename from extensions/shellscript/syntaxes/Shell-Unix-Bash.tmLanguage.json rename to extensions/shellscript/syntaxes/shell-unix-bash.tmLanguage.json index c77a42f203adc55148ef4f9b913d7651fa5c7a56..6aa3daeefe619557f664fb83c7788fcff06bf33b 100644 --- a/extensions/shellscript/syntaxes/Shell-Unix-Bash.tmLanguage.json +++ b/extensions/shellscript/syntaxes/shell-unix-bash.tmLanguage.json @@ -1,24 +1,38 @@ { "information_for_contributors": [ - "This file has been converted from https://github.com/textmate/shellscript.tmbundle/blob/master/Syntaxes/Shell-Unix-Bash.tmLanguage", + "This file has been converted from https://github.com/atom/language-shellscript/blob/master/grammars/shell-unix-bash.cson", "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/textmate/shellscript.tmbundle/commit/1c0cc0b904bb87b18b6987109e694f9d0058656d", + "version": "https://github.com/atom/language-shellscript/commit/f2cec59e541e3e10153a8e3e5e681baf139c81a3", + "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" + ".textmate_init", + "npmrc", + "PKGBUILD", + "install", + "cygport", + "bats", + "ebuild" ], - "firstLineMatch": "^#!.*\\b(bash|zsh|sh|tcsh)|^#.*-\\*-.*\\bshell-script\\b.*-\\*-", - "keyEquivalent": "^~S", - "name": "Shell Script (Bash)", + "firstLineMatch": "(?x)\n# Hashbang\n^\\#!.*(?:\\s|\\/)\n (?:bash|zsh|sh|tcsh|ksh|dash|ash|csh|rc)\n(?:$|\\s)\n|\n# Modeline\n(?i:\n # Emacs\n -\\*-(?:\\s*(?=[^:;\\s]+\\s*-\\*-)|(?:.*?[;\\s]|(?<=-\\*-))mode\\s*:\\s*)\n (?:shell-script|sh)\n (?=[\\s;]|(?]?\\d+|m)?|\\sex)(?=:(?=\\s*set?\\s[^\\n:]+:)|:(?!\\s* set?\\s))(?:(?:\\s|\\s*:\\s*)\\w*(?:\\s*=(?:[^\\n\\\\\\s]|\\\\.)*)?)*[\\s:](?:filetype|ft|syntax)\\s*=\n sh\n (?=\\s|:|$)\n)", "patterns": [ { "include": "#comment" @@ -64,9 +78,6 @@ }, { "include": "#support" - }, - { - "include": "#lines" } ], "repository": { @@ -83,13 +94,18 @@ "name": "meta.scope.case-clause.shell", "patterns": [ { - "begin": "(\\(|(?=\\S))", - "captures": { + "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": [ { @@ -125,7 +141,7 @@ ] }, "comment": { - "begin": "(^[ \\t]+)?(?;'\"\\\\|$&()]+)(?:\\s*(\\(\\)))?", + "begin": "(?<=^|;|&|\\s)(function)\\s+([^\\s\\\\]+)(?:\\s*(\\(\\)))?", "beginCaptures": { "1": { "name": "storage.type.function.shell" @@ -242,7 +273,7 @@ "name": "punctuation.definition.arguments.shell" } }, - "end": ";|&|\\n", + "end": ";|&|$", "endCaptures": { "0": { "name": "punctuation.definition.function.shell" @@ -256,7 +287,7 @@ ] }, { - "begin": "(?<=^|;|&)\\s*([^\\s<>;'\"\\\\|$&()]+)\\s*(\\(\\))", + "begin": "(?<=^|;|&|\\s)([^\\s\\\\=]+)\\s*(\\(\\))", "beginCaptures": { "1": { "name": "entity.name.function.shell" @@ -265,7 +296,7 @@ "name": "punctuation.definition.arguments.shell" } }, - "end": ";|&|\\n", + "end": ";|&|$", "endCaptures": { "0": { "name": "punctuation.definition.function.shell" @@ -283,7 +314,7 @@ "heredoc": { "patterns": [ { - "begin": "(<<)-\\s*(\"|'|)(RUBY)\\2", + "begin": "(<<)-(\"|'|)\\s*(RUBY)(?=\\s|;|&|<|\"|')\\2", "beginCaptures": { "1": { "name": "keyword.operator.heredoc.shell" @@ -292,12 +323,6 @@ "name": "keyword.control.heredoc-token.shell" } }, - "captures": { - "0": { - "name": "punctuation.definition.string.shell" - } - }, - "contentName": "source.ruby.embedded.shell", "end": "^\\t*(RUBY)(?=\\s|;|&|$)", "endCaptures": { "1": { @@ -305,6 +330,7 @@ } }, "name": "string.unquoted.heredoc.no-indent.ruby.shell", + "contentName": "source.ruby.embedded.shell", "patterns": [ { "include": "source.ruby" @@ -312,7 +338,7 @@ ] }, { - "begin": "(<<)\\s*(\"|'|)(RUBY)\\2", + "begin": "(<<)(\"|'|)\\s*(RUBY)(?=\\s|;|&|<|\"|')\\2", "beginCaptures": { "1": { "name": "keyword.operator.heredoc.shell" @@ -321,12 +347,6 @@ "name": "keyword.control.heredoc-token.shell" } }, - "captures": { - "0": { - "name": "punctuation.definition.string.shell" - } - }, - "contentName": "source.ruby.embedded.shell", "end": "^(RUBY)(?=\\s|;|&|$)", "endCaptures": { "1": { @@ -334,6 +354,7 @@ } }, "name": "string.unquoted.heredoc.ruby.shell", + "contentName": "source.ruby.embedded.shell", "patterns": [ { "include": "source.ruby" @@ -341,7 +362,7 @@ ] }, { - "begin": "(<<)-\\s*(\"|'|)(PYTHON)\\2", + "begin": "(<<)-(\"|'|)\\s*(PYTHON)(?=\\s|;|&|<|\"|')\\2", "beginCaptures": { "1": { "name": "keyword.operator.heredoc.shell" @@ -350,12 +371,6 @@ "name": "keyword.control.heredoc-token.shell" } }, - "captures": { - "0": { - "name": "punctuation.definition.string.shell" - } - }, - "contentName": "source.python.embedded.shell", "end": "^\\t*(PYTHON)(?=\\s|;|&|$)", "endCaptures": { "1": { @@ -363,6 +378,7 @@ } }, "name": "string.unquoted.heredoc.no-indent.python.shell", + "contentName": "source.python.embedded.shell", "patterns": [ { "include": "source.python" @@ -370,7 +386,7 @@ ] }, { - "begin": "(<<)\\s*(\"|'|)(PYTHON)\\2", + "begin": "(<<)(\"|'|)\\s*(PYTHON)(?=\\s|;|&|<|\"|')\\2", "beginCaptures": { "1": { "name": "keyword.operator.heredoc.shell" @@ -379,12 +395,6 @@ "name": "keyword.control.heredoc-token.shell" } }, - "captures": { - "0": { - "name": "punctuation.definition.string.shell" - } - }, - "contentName": "source.python.embedded.shell", "end": "^(PYTHON)(?=\\s|;|&|$)", "endCaptures": { "1": { @@ -392,6 +402,7 @@ } }, "name": "string.unquoted.heredoc.python.shell", + "contentName": "source.python.embedded.shell", "patterns": [ { "include": "source.python" @@ -399,7 +410,7 @@ ] }, { - "begin": "(<<)-\\s*(\"|'|)(APPLESCRIPT)\\2", + "begin": "(<<)-(\"|'|)\\s*(APPLESCRIPT)(?=\\s|;|&|<|\"|')\\2", "beginCaptures": { "1": { "name": "keyword.operator.heredoc.shell" @@ -408,12 +419,6 @@ "name": "keyword.control.heredoc-token.shell" } }, - "captures": { - "0": { - "name": "punctuation.definition.string.shell" - } - }, - "contentName": "source.applescript.embedded.shell", "end": "^\\t*(APPLESCRIPT)(?=\\s|;|&|$)", "endCaptures": { "1": { @@ -421,6 +426,7 @@ } }, "name": "string.unquoted.heredoc.no-indent.applescript.shell", + "contentName": "source.applescript.embedded.shell", "patterns": [ { "include": "source.applescript" @@ -428,7 +434,7 @@ ] }, { - "begin": "(<<)\\s*(\"|'|)(APPLESCRIPT)\\2", + "begin": "(<<)(\"|'|)\\s*(APPLESCRIPT)(?=\\s|;|&|<|\"|')\\2", "beginCaptures": { "1": { "name": "keyword.operator.heredoc.shell" @@ -437,12 +443,6 @@ "name": "keyword.control.heredoc-token.shell" } }, - "captures": { - "0": { - "name": "punctuation.definition.string.shell" - } - }, - "contentName": "source.applescript.embedded.shell", "end": "^(APPLESCRIPT)(?=\\s|;|&|$)", "endCaptures": { "1": { @@ -450,6 +450,7 @@ } }, "name": "string.unquoted.heredoc.applescript.shell", + "contentName": "source.applescript.embedded.shell", "patterns": [ { "include": "source.applescript" @@ -457,7 +458,7 @@ ] }, { - "begin": "(<<)-\\s*(\"|'|)(HTML)\\2", + "begin": "(<<)-(\"|'|)\\s*(HTML)(?=\\s|;|&|<|\"|')\\2", "beginCaptures": { "1": { "name": "keyword.operator.heredoc.shell" @@ -466,12 +467,6 @@ "name": "keyword.control.heredoc-token.shell" } }, - "captures": { - "0": { - "name": "punctuation.definition.string.shell" - } - }, - "contentName": "text.html.embedded.shell", "end": "^\\t*(HTML)(?=\\s|;|&|$)", "endCaptures": { "1": { @@ -479,6 +474,7 @@ } }, "name": "string.unquoted.heredoc.no-indent.html.shell", + "contentName": "text.html.embedded.shell", "patterns": [ { "include": "text.html.basic" @@ -486,7 +482,7 @@ ] }, { - "begin": "(<<)\\s*(\"|'|)(HTML)\\2", + "begin": "(<<)(\"|'|)\\s*(HTML)(?=\\s|;|&|<|\"|')\\2", "beginCaptures": { "1": { "name": "keyword.operator.heredoc.shell" @@ -495,12 +491,6 @@ "name": "keyword.control.heredoc-token.shell" } }, - "captures": { - "0": { - "name": "punctuation.definition.string.shell" - } - }, - "contentName": "text.html.embedded.shell", "end": "^(HTML)(?=\\s|;|&|$)", "endCaptures": { "1": { @@ -508,6 +498,7 @@ } }, "name": "string.unquoted.heredoc.html.shell", + "contentName": "text.html.embedded.shell", "patterns": [ { "include": "text.html.basic" @@ -515,7 +506,7 @@ ] }, { - "begin": "(<<)-\\s*(\"|'|)(MARKDOWN)\\2", + "begin": "(<<)-(\"|'|)\\s*(MARKDOWN)(?=\\s|;|&|<|\"|')\\2", "beginCaptures": { "1": { "name": "keyword.operator.heredoc.shell" @@ -524,12 +515,6 @@ "name": "keyword.control.heredoc-token.shell" } }, - "captures": { - "0": { - "name": "punctuation.definition.string.shell" - } - }, - "contentName": "text.html.markdown.embedded.shell", "end": "^\\t*(MARKDOWN)(?=\\s|;|&|$)", "endCaptures": { "1": { @@ -537,6 +522,7 @@ } }, "name": "string.unquoted.heredoc.no-indent.markdown.shell", + "contentName": "text.html.markdown.embedded.shell", "patterns": [ { "include": "text.html.markdown" @@ -544,7 +530,7 @@ ] }, { - "begin": "(<<)\\s*(\"|'|)(MARKDOWN)\\2", + "begin": "(<<)(\"|'|)\\s*(MARKDOWN)(?=\\s|;|&|<|\"|')\\2", "beginCaptures": { "1": { "name": "keyword.operator.heredoc.shell" @@ -553,12 +539,6 @@ "name": "keyword.control.heredoc-token.shell" } }, - "captures": { - "0": { - "name": "punctuation.definition.string.shell" - } - }, - "contentName": "text.html.markdown.embedded.shell", "end": "^(MARKDOWN)(?=\\s|;|&|$)", "endCaptures": { "1": { @@ -566,6 +546,7 @@ } }, "name": "string.unquoted.heredoc.markdown.shell", + "contentName": "text.html.markdown.embedded.shell", "patterns": [ { "include": "text.html.markdown" @@ -573,7 +554,7 @@ ] }, { - "begin": "(<<)-\\s*(\"|'|)(TEXTILE)\\2", + "begin": "(<<)-(\"|'|)\\s*(TEXTILE)(?=\\s|;|&|<|\"|')\\2", "beginCaptures": { "1": { "name": "keyword.operator.heredoc.shell" @@ -582,12 +563,6 @@ "name": "keyword.control.heredoc-token.shell" } }, - "captures": { - "0": { - "name": "punctuation.definition.string.shell" - } - }, - "contentName": "text.html.textile.embedded.shell", "end": "^\\t*(TEXTILE)(?=\\s|;|&|$)", "endCaptures": { "1": { @@ -595,6 +570,7 @@ } }, "name": "string.unquoted.heredoc.no-indent.textile.shell", + "contentName": "text.html.textile.embedded.shell", "patterns": [ { "include": "text.html.textile" @@ -602,7 +578,7 @@ ] }, { - "begin": "(<<)\\s*(\"|'|)(TEXTILE)\\2", + "begin": "(<<)(\"|'|)\\s*(TEXTILE)(?=\\s|;|&|<|\"|')\\2", "beginCaptures": { "1": { "name": "keyword.operator.heredoc.shell" @@ -611,12 +587,6 @@ "name": "keyword.control.heredoc-token.shell" } }, - "captures": { - "0": { - "name": "punctuation.definition.string.shell" - } - }, - "contentName": "text.html.textile.embedded.shell", "end": "^(TEXTILE)(?=\\s|;|&|$)", "endCaptures": { "1": { @@ -624,6 +594,7 @@ } }, "name": "string.unquoted.heredoc.textile.shell", + "contentName": "text.html.textile.embedded.shell", "patterns": [ { "include": "text.html.textile" @@ -631,7 +602,7 @@ ] }, { - "begin": "(<<)-\\s*(\"|'|)\\\\?(\\w+)\\2", + "begin": "(<<)-(\"|'|)\\s*(SHELL)(?=\\s|;|&|<|\"|')\\2", "beginCaptures": { "1": { "name": "keyword.operator.heredoc.shell" @@ -640,21 +611,46 @@ "name": "keyword.control.heredoc-token.shell" } }, - "captures": { - "0": { - "name": "punctuation.definition.string.shell" + "end": "^\\t*(\\3)(?=\\s|;|&|$)", + "endCaptures": { + "1": { + "name": "keyword.control.heredoc-token.shell" } }, - "end": "^\\t*(\\3)(?=\\s|;|&|$)", + "contentName": "source.shell.embedded.shell", + "name": "string.unquoted.heredoc.no-indent.shell.shell", + "patterns": [ + { + "include": "source.shell" + } + ] + }, + { + "begin": "(<<)(\"|'|)\\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.no-indent.shell" + "name": "string.unquoted.heredoc.shell.shell", + "contentName": "source.shell.embedded.shell", + "patterns": [ + { + "include": "source.shell" + } + ] }, { - "begin": "(<<)\\s*(\"|'|)\\\\?(\\w+)\\2", + "begin": "(<<)-(\"|'|)\\s*\\\\?([^;&<\\s]+)\\2", "beginCaptures": { "1": { "name": "keyword.operator.heredoc.shell" @@ -663,9 +659,22 @@ "name": "keyword.control.heredoc-token.shell" } }, - "captures": { - "0": { - "name": "punctuation.definition.string.shell" + "end": "^\\t*(\\3)(?=\\s|;|&|$)", + "endCaptures": { + "1": { + "name": "keyword.control.heredoc-token.shell" + } + }, + "name": "string.unquoted.heredoc.no-indent.shell" + }, + { + "begin": "(<<)(\"|'|)\\s*\\\\?([^;&<\\s]+)\\2", + "beginCaptures": { + "1": { + "name": "keyword.operator.heredoc.shell" + }, + "3": { + "name": "keyword.control.heredoc-token.shell" } }, "end": "^(\\3)(?=\\s|;|&|$)", @@ -681,40 +690,54 @@ "herestring": { "patterns": [ { - "captures": { + "begin": "(<<<)\\s*(('))", + "beginCaptures": { "1": { "name": "keyword.operator.herestring.shell" }, "2": { - "name": "string.quoted.single.herestring.shell" + "name": "string.quoted.single.shell" }, "3": { "name": "punctuation.definition.string.begin.shell" + } + }, + "end": "(')", + "endCaptures": { + "0": { + "name": "string.quoted.single.shell" }, - "4": { + "1": { "name": "punctuation.definition.string.end.shell" } }, - "match": "(<<<)\\s*((')[^']*('))", - "name": "meta.herestring.shell" + "name": "meta.herestring.shell", + "contentName": "string.quoted.single.shell" }, { - "captures": { + "begin": "(<<<)\\s*((\"))", + "beginCaptures": { "1": { "name": "keyword.operator.herestring.shell" }, "2": { - "name": "string.quoted.double.herestring.shell" + "name": "string.quoted.double.shell" }, "3": { "name": "punctuation.definition.string.begin.shell" + } + }, + "end": "(\")", + "endCaptures": { + "0": { + "name": "string.quoted.double.shell" }, - "6": { + "1": { "name": "punctuation.definition.string.end.shell" } }, - "match": "(<<<)\\s*((\")(\\\\(\"|\\\\)|[^\"])*(\"))", - "name": "meta.herestring.shell" + "name": "meta.herestring.shell", + "contentName": "string.quoted.double.shell" }, { "captures": { @@ -722,7 +745,12 @@ "name": "keyword.operator.herestring.shell" }, "2": { - "name": "string.unquoted.herestring.shell" + "name": "string.unquoted.herestring.shell", + "patterns": [ + { + "include": "$self" + } + ] } }, "match": "(<<<)\\s*(([^\\s\\\\]|\\\\.)+)", @@ -772,14 +800,25 @@ "name": "constant.character.escape.shell" }, { - "begin": "(?<=^|;|&|\\s|`)(#)(?!\\{)", + "begin": "(?<=\\W)(?=#)(?!#{)", "beginCaptures": { "1": { - "name": "punctuation.definition.comment.shell" + "name": "punctuation.whitespace.comment.leading.shell" } }, - "end": "(?=`)|\\n", - "name": "comment.line.number-sign.shell" + "end": "(?!\\G)", + "patterns": [ + { + "begin": "#", + "beginCaptures": { + "0": { + "name": "punctuation.definition.comment.shell" + } + }, + "end": "(?=`)", + "name": "comment.line.number-sign.shell" + } + ] }, { "include": "$self" @@ -801,16 +840,6 @@ }, "name": "string.interpolated.dollar.shell", "patterns": [ - { - "begin": "(?<=^|;|&|\\s|\\()(#)(?!\\{)", - "beginCaptures": { - "1": { - "name": "punctuation.definition.comment.shell" - } - }, - "end": "(?=\\))|\\n", - "name": "comment.line.number-sign.shell" - }, { "include": "$self" } @@ -821,7 +850,7 @@ "keyword": { "patterns": [ { - "match": "(?<=^|;|&|\\s)(?:if|then|else|elif|fi|for|in|do|done|select|case|continue|esac|while|until|return|coproc)(?=\\s|;|&|$)", + "match": "(?<=^|;|&|\\s)(then|else|elif|fi|for|in|do|done|select|case|continue|esac|while|until|return)(?=\\s|;|&|$)", "name": "keyword.control.shell" }, { @@ -830,14 +859,6 @@ } ] }, - "lines": { - "patterns": [ - { - "match": "\\\\\\n", - "name": "constant.character.escape.newline.shell" - } - ] - }, "list": { "patterns": [ { @@ -863,12 +884,17 @@ "patterns": [ { "begin": "(?<=^|;|&|\\s)(for)\\s+(?=\\({2})", - "captures": { + "beginCaptures": { "1": { "name": "keyword.control.shell" } }, - "end": "(?<=^|;|&|\\s)(done)(?=\\s|;|&|$|\\))", + "end": "(?<=^|;|&|\\s)done(?=\\s|;|&|$)", + "endCaptures": { + "0": { + "name": "keyword.control.shell" + } + }, "name": "meta.scope.for-loop.shell", "patterns": [ { @@ -877,18 +903,26 @@ ] }, { - "begin": "(?<=^|;|&|\\s)(for)\\s+([^\\s\\\\]+)(?=\\s|;|&|$)", + "begin": "(?<=^|;|&|\\s)(for)\\s+(.+?)\\s+(in)(?=\\s|;|&|$)", "beginCaptures": { "1": { "name": "keyword.control.shell" }, "2": { - "name": "variable.other.loop.shell" + "name": "variable.other.loop.shell", + "patterns": [ + { + "include": "#string" + } + ] + }, + "3": { + "name": "keyword.control.shell" } }, - "end": "(?<=^|;|&|\\s)(done)(?=\\s|;|&|$|\\))", + "end": "(?<=^|;|&|\\s)done(?=\\s|;|&|$)", "endCaptures": { - "1": { + "0": { "name": "keyword.control.shell" } }, @@ -901,12 +935,17 @@ }, { "begin": "(?<=^|;|&|\\s)(while|until)(?=\\s|;|&|$)", - "captures": { + "beginCaptures": { "1": { "name": "keyword.control.shell" } }, - "end": "(?<=^|;|&|\\s)(done)(?=\\s|;|&|$|\\))", + "end": "(?<=^|;|&|\\s)done(?=\\s|;|&|$)", + "endCaptures": { + "0": { + "name": "keyword.control.shell" + } + }, "name": "meta.scope.while-loop.shell", "patterns": [ { @@ -915,7 +954,7 @@ ] }, { - "begin": "(?<=^|;|&|\\s)(select)\\s+([^\\s\\\\]+)(?=\\s|;|&|$)", + "begin": "(?<=^|;|&|\\s)(select)\\s+((?:[^\\s\\\\]|\\\\.)+)(?=\\s|;|&|$)", "beginCaptures": { "1": { "name": "keyword.control.shell" @@ -924,7 +963,7 @@ "name": "variable.other.loop.shell" } }, - "end": "(?<=^|;|&|\\s)(done)(?=\\s|;|&|$|\\))", + "end": "(?<=^|;|&|\\s)(done)(?=\\s|;|&|$)", "endCaptures": { "1": { "name": "keyword.control.shell" @@ -938,23 +977,28 @@ ] }, { - "begin": "(?<=^|;|&|\\s)(case)(?=\\s|;|&|$)", - "captures": { - "1": { + "begin": "(?<=^|;|&|\\s)case(?=\\s|;|&|$)", + "beginCaptures": { + "0": { + "name": "keyword.control.shell" + } + }, + "end": "(?<=^|;|&|\\s)esac(?=\\s|;|&|$)", + "endCaptures": { + "0": { "name": "keyword.control.shell" } }, - "end": "(?<=^|;|&|\\s)(esac)(?=\\s|;|&|$|\\))", "name": "meta.scope.case-block.shell", "patterns": [ { - "begin": "(?<=^|;|&|\\s)(?:in)(?=\\s|;|&|$)", + "begin": "(?<=^|;|&|\\s)in(?=\\s|;|&|$)", "beginCaptures": { - "1": { + "0": { "name": "keyword.control.shell" } }, - "end": "(?<=^|;|&|\\s)(?=(?:esac)(?:\\s|;|&|$|\\)))", + "end": "(?<=^|;|&|\\s)(?=esac(\\s|;|&|$))", "name": "meta.scope.case-body.shell", "patterns": [ { @@ -974,16 +1018,15 @@ ] }, { - "begin": "(^|(?<=[&;|]))\\s*(if)(?=\\s|;|&|$)", + "begin": "(?<=^|;|&|\\s)if(?=\\s|;|&|$)", "beginCaptures": { - "2": { + "0": { "name": "keyword.control.shell" } }, - "comment": "Restrict match to avoid matching in lines like `dd if=/dev/sda1 …`", - "end": "(?<=^|;|&|\\s)(fi)(?=\\s|;|&|$|\\))", + "end": "(?<=^|;|&|\\s)fi(?=\\s|;|&|$)", "endCaptures": { - "1": { + "0": { "name": "keyword.control.shell" } }, @@ -1002,11 +1045,11 @@ "include": "#variable" }, { - "match": "\\+{1,2}|-{1,2}|!|~|\\*{1,2}|/|%|<[<=]?|>[>=]?|==|!=|\\^|\\|{1,2}|&{1,2}|\\?|\\:|,|=|[*/%+\\-&^|]=|<<=|>>=", + "match": "\\+{1,2}|-{1,2}|!|~|\\*{1,2}|/|%|<[<=]?|>[>=]?|==|!=|^|\\|{1,2}|&{1,2}|\\?|\\:|,|=|[*/%+\\-&^|]=|<<=|>>=", "name": "keyword.operator.arithmetic.shell" }, { - "match": "0[xX]\\h+", + "match": "0[xX][0-9A-Fa-f]+", "name": "constant.numeric.hex.shell" }, { @@ -1043,9 +1086,9 @@ "name": "punctuation.definition.extglob.shell" } }, - "end": "(\\))", + "end": "\\)", "endCaptures": { - "1": { + "0": { "name": "punctuation.definition.extglob.shell" } }, @@ -1093,8 +1136,7 @@ ] }, { - "comment": "valid: &>word >&word >word [n]>&[n] [n]word [n]>>word [n]<&word (last one is duplicate)", - "match": "&>|\\d*>&\\d*|\\d*(>>|>|<)|\\d*<&|\\d*<>", + "match": "(?])(&>|\\d*>&\\d*|\\d*(>>|>|<)|\\d*<&|\\d*<>)(?![<>])", "name": "keyword.operator.redirect.shell" } ] @@ -1189,7 +1231,7 @@ "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|mapfile|popd|printf|pushd|pwd|read(array)?|readonly|set|shift|shopt|source|suspend|test|times|trap|true|type|ulimit|umask|unalias|unset|wait)(?=\\s|;|&|$)", + "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" } ] @@ -1224,17 +1266,22 @@ "name": "variable.other.positional.shell" }, { - "begin": "\\$\\{", - "captures": { + "begin": "\\${", + "beginCaptures": { + "0": { + "name": "punctuation.definition.variable.shell" + } + }, + "end": "}", + "endCaptures": { "0": { "name": "punctuation.definition.variable.shell" } }, - "end": "\\}", "name": "variable.other.bracket.shell", "patterns": [ { - "match": "!|:[-=?+]?|\\*|@|#{1,2}|%{1,2}|/", + "match": "!|:[-=?]?|\\*|@|#{1,2}|%{1,2}|/", "name": "keyword.operator.expansion.shell" }, { @@ -1248,20 +1295,15 @@ }, "match": "(\\[)([^\\]]+)(\\])" }, - { - "include": "#string" - }, { "include": "#variable" }, { - "include": "#interpolation" + "include": "#string" } ] } ] } - }, - "scopeName": "source.shell", - "uuid": "DDEEA3ED-6B1C-11D9-8B10-000D93589AF6" + } } \ No newline at end of file diff --git a/extensions/shellscript/test/colorize-results/test_sh.json b/extensions/shellscript/test/colorize-results/test_sh.json index 3bb5e394f1e9fe4434320186aaa94b718d4a259e..36a9ce993e47d246b56f244ea26cba49120a1e5f 100644 --- a/extensions/shellscript/test/colorize-results/test_sh.json +++ b/extensions/shellscript/test/colorize-results/test_sh.json @@ -1,7 +1,7 @@ [ { "c": "#!", - "t": "source.shell comment.line.shebang.shell punctuation.definition.comment.line.shebang.shell", + "t": "source.shell comment.line.number-sign.shebang.shell punctuation.definition.comment.shebang.shell", "r": { "dark_plus": "comment: #608B4E", "light_plus": "comment: #008000", @@ -12,7 +12,7 @@ }, { "c": "/usr/bin/env bash", - "t": "source.shell comment.line.shebang.shell", + "t": "source.shell comment.line.number-sign.shebang.shell", "r": { "dark_plus": "comment: #608B4E", "light_plus": "comment: #008000", @@ -243,7 +243,7 @@ }, { "c": "\t", - "t": "source.shell meta.scope.if-block.shell meta.function.shell", + "t": "source.shell meta.scope.if-block.shell", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -1144,7 +1144,7 @@ } }, { - "c": "code", + "c": "code()", "t": "source.shell meta.function.shell entity.name.function.shell", "r": { "dark_plus": "entity.name.function: #DCDCAA", @@ -1154,17 +1154,6 @@ "hc_black": "entity.name.function: #DCDCAA" } }, - { - "c": "()", - "t": "source.shell meta.function.shell punctuation.definition.arguments.shell", - "r": { - "dark_plus": "default: #D4D4D4", - "light_plus": "default: #000000", - "dark_vs": "default: #D4D4D4", - "light_vs": "default: #000000", - "hc_black": "default: #FFFFFF" - } - }, { "c": " ", "t": "source.shell meta.function.shell", @@ -1431,7 +1420,7 @@ }, { "c": "\t", - "t": "source.shell meta.function.shell meta.scope.group.shell meta.scope.if-block.shell", + "t": "source.shell meta.function.shell meta.scope.group.shell", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000",