diff --git a/extensions/shellscript/cgmanifest.json b/extensions/shellscript/cgmanifest.json index dbb4301b62c..d12320c1b95 100644 --- a/extensions/shellscript/cgmanifest.json +++ b/extensions/shellscript/cgmanifest.json @@ -6,11 +6,11 @@ "git": { "name": "jeff-hykin/better-shell-syntax", "repositoryUrl": "https://github.com/jeff-hykin/better-shell-syntax", - "commitHash": "a3de7b32f1537194a83ee848838402fbf4b67424" + "commitHash": "4ba5d703087cac3c60cd57b206fd1cea0ff959cc" } }, "license": "MIT", - "version": "1.6.2" + "version": "1.7.1" } ], "version": 1 diff --git a/extensions/shellscript/syntaxes/shell-unix-bash.tmLanguage.json b/extensions/shellscript/syntaxes/shell-unix-bash.tmLanguage.json index 9950c577c48..21766dc8477 100644 --- a/extensions/shellscript/syntaxes/shell-unix-bash.tmLanguage.json +++ b/extensions/shellscript/syntaxes/shell-unix-bash.tmLanguage.json @@ -4,7 +4,7 @@ "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/jeff-hykin/better-shell-syntax/commit/a3de7b32f1537194a83ee848838402fbf4b67424", + "version": "https://github.com/jeff-hykin/better-shell-syntax/commit/4ba5d703087cac3c60cd57b206fd1cea0ff959cc", "name": "Shell Script", "scopeName": "source.shell", "patterns": [ @@ -14,34 +14,59 @@ ], "repository": { "alias_statement": { - "begin": "(alias)[ \\t]*+[ \\t]*+(?:((?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$))[ \\t]*+)?((?\\(\\)\\$`\\\\\"\\|]+(?!>))", + "match": "(?:[ \\t]*+)((?:[^ \t\n'&;<>\\(\\)\\$`\\\\\"\\|]+)(?!>))", "captures": { "1": { "name": "string.unquoted.argument.shell", @@ -116,67 +141,108 @@ } ] }, - "assignment": { - "patterns": [ - { - "begin": "[ \\t]*+(?:((?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$))[ \\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(?!\\/))(?:((?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$))|((?!\"|'|\\\\\\n?$)[^!'\" \\t\\n\\r]+?))(?:(?= |\\t)|(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\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(?!\\/)))(?:((?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$))|((?!\"|'|\\\\\\n?$)(?:[^!'\" \\t\\n\\r]+?)))(?:(?= |\\t)|(?:(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\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?$)", - "end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\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?$)))", + "end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?)", + "match": "(?<==| |\\t|^|\\{|\\(|\\[)(?:(?:(?:(?:(?:(0[xX][0-9A-Fa-f]+)|(0\\d+))|(\\d{1,2}#[0-9a-zA-Z@_]+))|(-?\\d+(?:\\.\\d+)))|(-?\\d+(?:\\.\\d+)+))|(-?\\d+))(?= |\\t|$|\\}|\\)|;)", "captures": { "1": { "name": "constant.numeric.shell constant.numeric.hex.shell" @@ -1531,16 +1757,19 @@ "name": "constant.numeric.shell constant.numeric.other.shell" }, "4": { - "name": "constant.numeric.shell constant.numeric.integer.shell" + "name": "constant.numeric.shell constant.numeric.decimal.shell" }, "5": { + "name": "constant.numeric.shell constant.numeric.version.shell" + }, + "6": { "name": "constant.numeric.shell constant.numeric.integer.shell" } } }, "option": { - "begin": "[ \\t]++(-)((?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t])))", - "end": "(?:(?=[ \\t])|(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?|#|\\n|$|;|[ \\t]))))", + "end": "(?:(?=[ \\t])|(?:(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?>?)(?:[ \\t]*+)([^ \t\n'&;<>\\(\\)\\$`\\\\\"\\|]+))", + "captures": { + "1": { + "name": "keyword.operator.redirect.shell" + }, + "2": { + "name": "string.unquoted.argument.shell" + } + } + }, "redirect_number": { - "match": "(?<=[ \\t])(?:(1)|(2)|(\\d+))(?=>)", + "match": "(?<=[ \\t])(?:(?:(1)|(2)|(\\d+))(?=>))", "captures": { "1": { "name": "keyword.operator.redirect.stdout.shell" @@ -1687,17 +1927,17 @@ "regexp": { "patterns": [ { - "match": ".+" + "match": "(?:.+)" } ] }, "simple_options": { - "match": "(?:[ \\t]++\\-\\w+)*", + "match": "(?:(?:[ \\t]++)\\-(?:\\w+))*", "captures": { "0": { "patterns": [ { - "match": "[ \\t]++(\\-)(\\w+)", + "match": "(?:[ \\t]++)(\\-)(\\w+)", "captures": { "1": { "name": "string.unquoted.argument.shell constant.other.option.dash.shell" @@ -1711,11 +1951,15 @@ } } }, + "simple_unquoted": { + "match": "[^ \\t\\n'&;<>\\(\\)\\$`\\\\\"\\|]", + "name": "string.unquoted.shell" + }, "start_of_command": { - "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?$)" + "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?$)))" }, "start_of_double_quoted_command_name": { - "match": "(?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t]))(?:[ \\t]*+([^ \t\n'&;<>\\(\\)\\$`\\\\\"\\|]+(?!>)))?(?:(?:\\$\")|\")", + "match": "(?:(?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t]))(?:(?:(?:[ \\t]*+)((?:[^ \t\n'&;<>\\(\\)\\$`\\\\\"\\|]+)(?!>)))?)(?:(?:\\$\")|\"))", "captures": { "1": { "name": "entity.name.function.call.shell entity.name.command.shell", @@ -1744,7 +1988,7 @@ "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" }, "start_of_single_quoted_command_name": { - "match": "(?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t]))(?:[ \\t]*+([^ \t\n'&;<>\\(\\)\\$`\\\\\"\\|]+(?!>)))?(?:(?:\\$')|')", + "match": "(?:(?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t]))(?:(?:(?:[ \\t]*+)((?:[^ \t\n'&;<>\\(\\)\\$`\\\\\"\\|]+)(?!>)))?)(?:(?:\\$')|'))", "captures": { "1": { "name": "entity.name.function.call.shell entity.name.command.shell", @@ -1866,7 +2110,7 @@ "variable": { "patterns": [ { - "match": "(\\$)(\\@(?!\\w))", + "match": "(?:(\\$)(\\@(?!\\w)))", "captures": { "1": { "name": "punctuation.definition.variable.shell variable.parameter.positional.all.shell" @@ -1877,7 +2121,7 @@ } }, { - "match": "(\\$)([0-9](?!\\w))", + "match": "(?:(\\$)([0-9](?!\\w)))", "captures": { "1": { "name": "punctuation.definition.variable.shell variable.parameter.positional.shell" @@ -1888,7 +2132,7 @@ } }, { - "match": "(\\$)([-*#?$!0_](?!\\w))", + "match": "(?:(\\$)([-*#?$!0_](?!\\w)))", "captures": { "1": { "name": "punctuation.definition.variable.shell variable.language.special.shell" @@ -1899,7 +2143,7 @@ } }, { - "begin": "(\\$)(\\{)[ \\t]*+(?=\\d)", + "begin": "(?:(\\$)(\\{)(?:[ \\t]*+)(?=\\d))", "end": "\\}", "beginCaptures": { "1": { @@ -1921,7 +2165,7 @@ "name": "keyword.operator.expansion.shell" }, { - "match": "(\\[)[^\\]]+(\\])", + "match": "(?:(\\[)(?:[^\\]]+)(\\]))", "captures": { "1": { "name": "punctuation.section.array.shell" @@ -1936,7 +2180,7 @@ "name": "variable.parameter.positional.shell" }, { - "match": "(?