Update shellscript grammar to get fix (#173574)

This commit is contained in:
Alex Ross 2023-02-06 16:14:56 +01:00 committed by GitHub
parent 5d7d4a1b58
commit 90c3ebe980
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 67 additions and 53 deletions

View file

@ -6,11 +6,11 @@
"git": {
"name": "jeff-hykin/better-shell-syntax",
"repositoryUrl": "https://github.com/jeff-hykin/better-shell-syntax",
"commitHash": "4ea3d7e5f6fb493395e417a26ba5483475e88af4"
"commitHash": "ab3c6da1c3651dff20651ebcf0ec5adb5fe413a0"
}
},
"license": "MIT",
"version": "1.3.0"
"version": "1.3.3"
}
],
"version": 1

View file

@ -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/4ea3d7e5f6fb493395e417a26ba5483475e88af4",
"version": "https://github.com/jeff-hykin/better-shell-syntax/commit/ab3c6da1c3651dff20651ebcf0ec5adb5fe413a0",
"name": "Shell Script",
"scopeName": "source.shell",
"patterns": [
@ -14,7 +14,7 @@
],
"repository": {
"alias_statement": {
"begin": "(alias)(?:\\s)+\\s*+(?:((?<=^|;|&|\\s)(?:export|declare|typeset|local|readonly)(?=\\s|;|&|$))\\s*+)?((?<!\\w)[a-zA-Z_0-9]*(?!\\w))(?:(\\[)((?:(?:(?:\\$)?(?<!\\w)[a-zA-Z_0-9]*(?!\\w)|@)|\\*))(\\]))?(?:(?:(\\=)|(\\+\\=))|(\\-\\=))",
"begin": "(alias)\\s*+\\s*+(?:((?<=^|;|&|\\s)(?:export|declare|typeset|local|readonly)(?=\\s|;|&|$))\\s*+)?((?<!\\w)[a-zA-Z_0-9-]*(?!\\w))(?:(\\[)((?:(?:(?:\\$)?(?<!\\w)[a-zA-Z_0-9-]*(?!\\w)|@)|\\*))(\\]))?(?:(?:(\\=)|(\\+\\=))|(\\-\\=))",
"end": "(?:(?= |$)|(?:(?:(?:(?:(;)|(&&))|(\\|\\|))|(&))|\\n))",
"beginCaptures": {
"1": {
@ -84,9 +84,10 @@
"argument_context": {
"patterns": [
{
"match": "[^ \n'&;<>\\(\\)\\$`\\\\\"\\|]+(?!>)",
"match": "\\s*+([^ \n'&;<>\\(\\)\\$`\\\\\"\\|]+(?!>))",
"captures": {
"0": {
"1": {
"name": "string.unquoted.argument.shell",
"patterns": [
{
"match": "\\*",
@ -108,8 +109,7 @@
}
]
}
},
"name": "string.unquoted.argument.shell"
}
},
{
"include": "#statement_context"
@ -119,7 +119,7 @@
"assignment": {
"patterns": [
{
"begin": "\\s*+(?:((?<=^|;|&|\\s)(?:export|declare|typeset|local|readonly)(?=\\s|;|&|$))\\s*+)?((?<!\\w)[a-zA-Z_0-9]*(?!\\w))(?:(\\[)((?:(?:(?:\\$)?(?<!\\w)[a-zA-Z_0-9]*(?!\\w)|@)|\\*))(\\]))?(?:(?:(\\=)|(\\+\\=))|(\\-\\=))\\s*+(\\()",
"begin": "\\s*+(?:((?<=^|;|&|\\s)(?:export|declare|typeset|local|readonly)(?=\\s|;|&|$))\\s*+)?((?<!\\w)[a-zA-Z_0-9-]*(?!\\w))(?:(\\[)((?:(?:(?:\\$)?(?<!\\w)[a-zA-Z_0-9-]*(?!\\w)|@)|\\*))(\\]))?(?:(?:(\\=)|(\\+\\=))|(\\-\\=))\\s*+(\\()",
"end": "\\)",
"beginCaptures": {
"1": {
@ -166,7 +166,7 @@
]
},
{
"begin": "\\s*+(?:((?<=^|;|&|\\s)(?:export|declare|typeset|local|readonly)(?=\\s|;|&|$))\\s*+)?((?<!\\w)[a-zA-Z_0-9]*(?!\\w))(?:(\\[)((?:(?:(?:\\$)?(?<!\\w)[a-zA-Z_0-9]*(?!\\w)|@)|\\*))(\\]))?(?:(?:(\\=)|(\\+\\=))|(\\-\\=))",
"begin": "\\s*+(?:((?<=^|;|&|\\s)(?:export|declare|typeset|local|readonly)(?=\\s|;|&|$))\\s*+)?((?<!\\w)[a-zA-Z_0-9-]*(?!\\w))(?:(\\[)((?:(?:(?:\\$)?(?<!\\w)[a-zA-Z_0-9-]*(?!\\w)|@)|\\*))(\\]))?(?:(?:(\\=)|(\\+\\=))|(\\-\\=))",
"end": "(?:(?= |$)|(?:(?:(?:(?:(;)|(&&))|(\\|\\|))|(&))|\\n))",
"beginCaptures": {
"1": {
@ -300,7 +300,7 @@
},
"command_call": {
"begin": "(?!^[ \\t]*+$)(?:(?<=^if | if |\\tif |^elif | elif |\\telif |^then | then |\\tthen |^else | else |\\telse |^while | while |\\twhile |^do | do |\\tdo )|(?<=(?:^|;|\\||&|!|\\(|\\{|\\`)))\\s*+(?!nocorrect\\W|nocorrect\\$|function\\W|function\\$|foreach\\W|foreach\\$|repeat\\W|repeat\\$|logout\\W|logout\\$|coproc\\W|coproc\\$|select\\W|select\\$|while\\W|while\\$|pushd\\W|pushd\\$|until\\W|until\\$|case\\W|case\\$|done\\W|done\\$|elif\\W|elif\\$|else\\W|else\\$|esac\\W|esac\\$|popd\\W|popd\\$|then\\W|then\\$|time\\W|time\\$|for\\W|for\\$|end\\W|end\\$|fi\\W|fi\\$|do\\W|do\\$|in\\W|in\\$|if\\W|if\\$)",
"end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|#|\\])(?<!\\\\)",
"end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}| *#|\\])(?<!\\\\)",
"beginCaptures": {},
"endCaptures": {},
"name": "meta.statement.shell",
@ -312,8 +312,8 @@
"include": "#assignment"
},
{
"begin": "(?:(\\s*+(?!(?:!|%|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|\\s))([^ \n'&;<>\\(\\)\\$`\\\\\"\\|]+(?!>))?(?:(?:\\$')|'))|(\\s*+(?!(?:!|%|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|\\s))([^ \n'&;<>\\(\\)\\$`\\\\\"\\|]+(?!>))?(?:(?:\\$\")|\")))",
"end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|#|\\])(?<!\\\\)",
"begin": "(?:(\\s*+(?!(?:!|%|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|\\s))(?:\\s*+([^ \n'&;<>\\(\\)\\$`\\\\\"\\|]+(?!>)))?(?:(?:\\$')|'))|(\\s*+(?!(?:!|%|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|\\s))(?:\\s*+([^ \n'&;<>\\(\\)\\$`\\\\\"\\|]+(?!>)))?(?:(?:\\$\")|\")))",
"end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}| *#|\\])(?<!\\\\)",
"beginCaptures": {
"1": {
"name": "meta.command_name.quoted.shell string.quoted.single.shell punctuation.definition.string.begin.shell entity.name.command.shell"
@ -400,8 +400,8 @@
]
},
{
"begin": "(?:(\\s*+(?!(?:!|%|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|\\s))(?:((?<=^|;|&|\\s)(?:export|declare|typeset|local|readonly)(?=\\s|;|&|$))|((?!\\\\\\n?$)(?:(?:\\$?\")|(?:.+?))))(?:(?=\\s)|(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|#|\\])(?<!\\\\))))",
"end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|#|\\])(?<!\\\\)",
"begin": "(?:(\\s*+(?!(?:!|%|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|\\s))(?:((?<=^|;|&|\\s)(?:export|declare|typeset|local|readonly)(?=\\s|;|&|$))|((?!\\\\\\n?$)(?:(?:\\$?\")|(?:.+?))))(?:(?=\\s)|(?=;|\\||&|\\n|\\)|\\`|\\{|\\}| *#|\\])(?<!\\\\))))",
"end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}| *#|\\])(?<!\\\\)",
"beginCaptures": {
"1": {
"name": "meta.command_name.shell"
@ -452,7 +452,7 @@
]
},
"command_name": {
"match": "\\s*+(?!(?:!|%|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|\\s))(?:((?<=^|;|&|\\s)(?:export|declare|typeset|local|readonly)(?=\\s|;|&|$))|((?!\\\\\\n?$)(?:(?:\\$?\")|(?:.+?))))(?:(?=\\s)|(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|#|\\])(?<!\\\\))",
"match": "\\s*+(?!(?:!|%|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|\\s))(?:((?<=^|;|&|\\s)(?:export|declare|typeset|local|readonly)(?=\\s|;|&|$))|((?!\\\\\\n?$)(?:(?:\\$?\")|(?:.+?))))(?:(?=\\s)|(?=;|\\||&|\\n|\\)|\\`|\\{|\\}| *#|\\])(?<!\\\\))",
"captures": {
"1": {
"name": "storage.modifier.$1.shell"
@ -477,7 +477,7 @@
"name": "meta.command_name.shell"
},
"comment": {
"match": "(?:^|(?<=\\s))(?:((#!).*)|((#).*))",
"match": "(?:^|\\s++)(?:((#!).*)|((#).*))",
"captures": {
"1": {
"name": "comment.line.number-sign.shell meta.shebang.shell"
@ -702,7 +702,7 @@
"heredoc": {
"patterns": [
{
"begin": "((?<!<)<<-)\\s*+(\"|')\\s*+((?<!\\w)[a-zA-Z_0-9]*(?!\\w))(?=\\s|;|&|<|\"|')(?:\\2)(.*)",
"begin": "((?<!<)<<-)\\s*+(\"|')\\s*+((?<!\\w)[a-zA-Z_0-9-]*(?!\\w))(?=\\s|;|&|<|\"|')(?:\\2)(.*)",
"end": "^\\t*(?:\\3)(?=\\s|;|&|$)",
"beginCaptures": {
"1": {
@ -729,7 +729,7 @@
"patterns": []
},
{
"begin": "((?<!<)<<(?!<))\\s*+(\"|')\\s*+((?<!\\w)[a-zA-Z_0-9]*(?!\\w))(?=\\s|;|&|<|\"|')(?:\\2)(.*)",
"begin": "((?<!<)<<(?!<))\\s*+(\"|')\\s*+((?<!\\w)[a-zA-Z_0-9-]*(?!\\w))(?=\\s|;|&|<|\"|')(?:\\2)(.*)",
"end": "^(?:\\3)(?=\\s|;|&|$)",
"beginCaptures": {
"1": {
@ -756,7 +756,7 @@
"patterns": []
},
{
"begin": "((?<!<)<<-)\\s*+((?<!\\w)[a-zA-Z_0-9]*(?!\\w))(?=\\s|;|&|<|\"|')(.*)",
"begin": "((?<!<)<<-)\\s*+((?<!\\w)[a-zA-Z_0-9-]*(?!\\w))(?=\\s|;|&|<|\"|')(.*)",
"end": "^\\t*(?:\\2)(?=\\s|;|&|$)",
"beginCaptures": {
"1": {
@ -792,7 +792,7 @@
]
},
{
"begin": "((?<!<)<<(?!<))\\s*+((?<!\\w)[a-zA-Z_0-9]*(?!\\w))(?=\\s|;|&|<|\"|')(.*)",
"begin": "((?<!<)<<(?!<))\\s*+((?<!\\w)[a-zA-Z_0-9-]*(?!\\w))(?=\\s|;|&|<|\"|')(.*)",
"end": "^(?:\\2)(?=\\s|;|&|$)",
"beginCaptures": {
"1": {
@ -928,9 +928,6 @@
{
"include": "#loop"
},
{
"include": "#string"
},
{
"include": "#function_definition"
},
@ -961,6 +958,9 @@
{
"include": "#command_call"
},
{
"include": "#string"
},
{
"include": "#support"
}
@ -1728,7 +1728,7 @@
},
"option": {
"begin": "\\s++(-)((?!(?:!|%|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|\\s)))",
"end": "(?:(?=\\s)|(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|#|\\])(?<!\\\\))",
"end": "(?:(?=\\s)|(?=;|\\||&|\\n|\\)|\\`|\\{|\\}| *#|\\])(?<!\\\\))",
"beginCaptures": {
"1": {
"name": "string.unquoted.argument.shell constant.other.option.dash.shell"
@ -1900,7 +1900,7 @@
}
},
"start_of_double_quoted_command_name": {
"match": "\\s*+(?!(?:!|%|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|\\s))([^ \n'&;<>\\(\\)\\$`\\\\\"\\|]+(?!>))?(?:(?:\\$\")|\")",
"match": "\\s*+(?!(?:!|%|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|\\s))(?:\\s*+([^ \n'&;<>\\(\\)\\$`\\\\\"\\|]+(?!>)))?(?:(?:\\$\")|\")",
"captures": {
"1": {
"name": "entity.name.command.shell",
@ -1929,7 +1929,7 @@
"name": "meta.command_name.quoted.shell string.quoted.double.shell punctuation.definition.string.begin.shell entity.name.command.shell"
},
"start_of_single_quoted_command_name": {
"match": "\\s*+(?!(?:!|%|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|\\s))([^ \n'&;<>\\(\\)\\$`\\\\\"\\|]+(?!>))?(?:(?:\\$')|')",
"match": "\\s*+(?!(?:!|%|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|\\s))(?:\\s*+([^ \n'&;<>\\(\\)\\$`\\\\\"\\|]+(?!>)))?(?:(?:\\$')|')",
"captures": {
"1": {
"name": "entity.name.command.shell",

View file

@ -99,21 +99,21 @@
},
{
"c": "alias",
"t": "source.shell meta.statement.shell meta.command.shell entity.name.command.shell support.function.builtin.shell",
"t": "source.shell meta.expression.assignment.shell storage.type.alias.shell",
"r": {
"dark_plus": "support.function: #DCDCAA",
"light_plus": "support.function: #795E26",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "support.function: #DCDCAA",
"dark_plus_experimental": "support.function: #DCDCAA",
"hc_light": "support.function: #5E2CBC",
"light_plus_experimental": "support.function: #795E26"
"dark_plus": "storage.type: #569CD6",
"light_plus": "storage.type: #0000FF",
"dark_vs": "storage.type: #569CD6",
"light_vs": "storage.type: #0000FF",
"hc_black": "storage.type: #569CD6",
"dark_plus_experimental": "storage.type: #569CD6",
"hc_light": "storage.type: #0F4A85",
"light_plus_experimental": "storage.type: #0000FF"
}
},
{
"c": " ",
"t": "source.shell meta.statement.shell meta.command.shell meta.argument.shell",
"t": "source.shell meta.expression.assignment.shell",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
@ -126,22 +126,36 @@
}
},
{
"c": "brew-list=",
"t": "source.shell meta.statement.shell meta.command.shell meta.argument.shell string.unquoted.argument.shell",
"c": "brew-list",
"t": "source.shell meta.expression.assignment.shell variable.other.assignment.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178",
"dark_plus_experimental": "string: #CE9178",
"hc_light": "string: #0F4A85",
"light_plus_experimental": "string: #A31515"
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "variable: #9CDCFE",
"dark_plus_experimental": "variable: #9CDCFE",
"hc_light": "variable: #001080",
"light_plus_experimental": "variable: #001080"
}
},
{
"c": "=",
"t": "source.shell meta.expression.assignment.shell keyword.operator.assignment.shell",
"r": {
"dark_plus": "keyword.operator: #D4D4D4",
"light_plus": "keyword.operator: #000000",
"dark_vs": "keyword.operator: #D4D4D4",
"light_vs": "keyword.operator: #000000",
"hc_black": "keyword.operator: #D4D4D4",
"dark_plus_experimental": "keyword.operator: #D4D4D4",
"hc_light": "keyword.operator: #000000",
"light_plus_experimental": "keyword.operator: #000000"
}
},
{
"c": "\"",
"t": "source.shell meta.statement.shell meta.command.shell meta.argument.shell string.quoted.double.shell punctuation.definition.string.begin.shell",
"t": "source.shell meta.expression.assignment.shell string.quoted.double.shell punctuation.definition.string.begin.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
@ -155,7 +169,7 @@
},
{
"c": "brew leaves",
"t": "source.shell meta.statement.shell meta.command.shell meta.argument.shell string.quoted.double.shell",
"t": "source.shell meta.expression.assignment.shell string.quoted.double.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
@ -169,7 +183,7 @@
},
{
"c": "\"",
"t": "source.shell meta.statement.shell meta.command.shell meta.argument.shell string.quoted.double.shell punctuation.definition.string.end.shell",
"t": "source.shell meta.expression.assignment.shell string.quoted.double.shell punctuation.definition.string.end.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",

View file

@ -2171,7 +2171,7 @@
},
{
"c": "\t",
"t": "source.shell meta.function.shell meta.function.body.shell meta.statement.shell",
"t": "source.shell meta.function.shell meta.function.body.shell",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
@ -2409,7 +2409,7 @@
},
{
"c": "\t",
"t": "source.shell meta.function.shell meta.function.body.shell meta.statement.shell",
"t": "source.shell meta.function.shell meta.function.body.shell",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
@ -2535,7 +2535,7 @@
},
{
"c": "\t",
"t": "source.shell meta.function.shell meta.function.body.shell meta.statement.shell",
"t": "source.shell meta.function.shell meta.function.body.shell",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",