Update grammars (#211439)

This commit is contained in:
Alex Ross
2024-04-26 13:52:52 +02:00
committed by GitHub
parent edb368fc43
commit 5c213a1e84
19 changed files with 1346 additions and 780 deletions

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/21748db7c7fd6ccd660c5bc770212836e58385ae",
"version": "https://github.com/jeff-hykin/better-shell-syntax/commit/6d0bc37a6b8023a5fddf75bd2b4eb1e1f962e4c2",
"name": "Shell Script",
"scopeName": "source.shell",
"patterns": [
@@ -14,7 +14,7 @@
],
"repository": {
"alias_statement": {
"begin": "(?:(alias)(?:[ \\t]*+)((?:(?:((?<!\\w)-\\w+\\b)(?:[ \\t]*+))*))(?:(?:[ \\t]*+)(?:((?<!\\w)(?:[a-zA-Z_0-9-]+)(?!\\w))(?:(?:(\\[)((?:(?:(?:(?:\\$?)(?:(?<!\\w)(?:[a-zA-Z_0-9-]+)(?!\\w))|@)|\\*)|(-?\\d+)))(\\]))?))(?:(?:(\\=)|(\\+\\=))|(\\-\\=))))",
"begin": "(?:(?:[ \\t]*+)(alias)(?:[ \\t]*+)((?:(?:((?<!\\w)-\\w+\\b)(?:[ \\t]*+))*))(?:(?:[ \\t]*+)(?:((?<!\\w)(?:[a-zA-Z_0-9-]+)(?!\\w))(?:(?:(\\[)((?:(?:(?:(?:\\$?)(?:(?<!\\w)(?:[a-zA-Z_0-9-]+)(?!\\w))|@)|\\*)|(-?\\d+)))(\\]))?))(?:(?:(\\=)|(\\+\\=))|(\\-\\=))))",
"end": "(?:(?= |\\t|$)|(?:(?:(?:(;)|(&&))|(\\|\\|))|(&)))",
"beginCaptures": {
"1": {
@@ -95,7 +95,7 @@
"argument_context": {
"patterns": [
{
"match": "(?:[ \\t]*+)((?:[^ \t\n'&;<>\\(\\)\\$`\\\\\"\\|]+)(?!>))",
"match": "(?:[ \\t]*+)((?:[^ \t\n>&;<>\\(\\)\\$`\\\\\"'<\\|]+)(?!>))",
"captures": {
"1": {
"name": "string.unquoted.argument.shell",
@@ -296,7 +296,7 @@
]
},
"basic_command_name": {
"match": "(?:(?:(?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t]))(?!nocorrect |nocorrect\t|nocorrect$|readonly |readonly\t|readonly$|function |function\t|function$|foreach |foreach\t|foreach$|coproc |coproc\t|coproc$|logout |logout\t|logout$|export |export\t|export$|select |select\t|select$|repeat |repeat\t|repeat$|pushd |pushd\t|pushd$|until |until\t|until$|while |while\t|while$|local |local\t|local$|case |case\t|case$|done |done\t|done$|elif |elif\t|elif$|else |else\t|else$|esac |esac\t|esac$|popd |popd\t|popd$|then |then\t|then$|time |time\t|time$|for |for\t|for$|end |end\t|end$|fi |fi\t|fi$|do |do\t|do$|in |in\t|in$|if |if\t|if$))(?:((?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$))|((?!\"|'|\\\\\\n?$)(?:[^!'\" \\t\\n\\r]+?)))(?:(?= |\\t)|(?:(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?<!\\\\))))",
"match": "(?:(?:(?!(?:!|&|\\||\\(|\\)|\\{|\\[|<|>|#|\\n|$|;|[ \\t]))(?!nocorrect |nocorrect\t|nocorrect$|readonly |readonly\t|readonly$|function |function\t|function$|foreach |foreach\t|foreach$|coproc |coproc\t|coproc$|logout |logout\t|logout$|export |export\t|export$|select |select\t|select$|repeat |repeat\t|repeat$|pushd |pushd\t|pushd$|until |until\t|until$|while |while\t|while$|local |local\t|local$|case |case\t|case$|done |done\t|done$|elif |elif\t|elif$|else |else\t|else$|esac |esac\t|esac$|popd |popd\t|popd$|then |then\t|then$|time |time\t|time$|for |for\t|for$|end |end\t|end$|fi |fi\t|fi$|do |do\t|do$|in |in\t|in$|if |if\t|if$))(?:((?<=^|;|&|[ \\t])(?:readonly|declare|typeset|export|local)(?=[ \\t]|;|&|$))|((?!\"|'|\\\\\\n?$)(?:[^!'\"<> \\t\\n\\r]+?)))(?:(?= |\\t)|(?:(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?<!\\\\))))",
"captures": {
"1": {
"name": "storage.modifier.$1.shell"
@@ -435,10 +435,18 @@
"name": "keyword.operator.orvariable.language.special.or.shell keyword.operator.alternation.ruby.shell punctuation.definition.regex.alternation.shell punctuation.separator.regex.alternation.shell"
},
{
"begin": "\\(",
"match": "\\\\.",
"name": "constant.character.escape.shell"
},
{
"match": "(?<=\\tin| in| |\\t|;;)\\(",
"name": "keyword.operator.pattern.case.shell"
},
{
"begin": "(?<=\\S)(\\()",
"end": "\\)",
"beginCaptures": {
"0": {
"1": {
"name": "punctuation.definition.group.shell punctuation.definition.regex.group.shell"
}
},
@@ -486,7 +494,7 @@
},
"command_name_range": {
"begin": "\\G",
"end": "(?= |\\t|;|\\||&|$|\\n|\\)|\\`)",
"end": "(?:(?= |\\t|;|\\||&|$|\\n|\\)|\\`)|(?=<))",
"beginCaptures": {},
"endCaptures": {},
"name": "meta.statement.command.name.shell",
@@ -503,7 +511,7 @@
"include": "#variable"
},
{
"match": "(?:(?<!\\w)(?<=\\G|'|\"|\\}|\\))([^ \\n\\t\\r\"'=;&\\|`\\)\\{]+))",
"match": "(?:(?<!\\w)(?<=\\G|'|\"|\\}|\\))([^ \\n\\t\\r\"'=;&\\|`\\)\\{<>]+))",
"captures": {
"1": {
"name": "entity.name.function.call.shell entity.name.command.shell"
@@ -564,6 +572,9 @@
},
{
"include": "#string"
},
{
"include": "#heredoc"
}
]
},
@@ -867,7 +878,7 @@
},
"endCaptures": {
"0": {
"name": "punctuation.definition.string.heredoc.delimiter.shell"
"name": "punctuation.definition.string.heredoc.$0.shell"
}
},
"contentName": "string.quoted.heredoc.indent.$3",
@@ -1500,6 +1511,30 @@
}
]
},
"math_operators": {
"patterns": [
{
"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"
}
]
},
"misc_ranges": {
"patterns": [
{
@@ -1912,7 +1947,7 @@
]
},
"redirect_fix": {
"match": "(?:(>>?)(?:[ \\t]*+)([^ \t\n'&;<>\\(\\)\\$`\\\\\"\\|]+))",
"match": "(?:(>>?)(?:[ \\t]*+)([^ \t\n>&;<>\\(\\)\\$`\\\\\"'<\\|]+))",
"captures": {
"1": {
"name": "keyword.operator.redirect.shell"
@@ -1996,7 +2031,7 @@
}
},
"simple_unquoted": {
"match": "[^ \\t\\n'&;<>\\(\\)\\$`\\\\\"\\|]",
"match": "[^ \\t\\n>&;<>\\(\\)\\$`\\\\\"'<\\|]",
"name": "string.unquoted.shell"
},
"special_expansion": {
@@ -2135,6 +2170,9 @@
{
"include": "#for_statement"
},
{
"include": "#while_statement"
},
{
"include": "#function_definition"
},
@@ -2275,6 +2313,41 @@
}
}
]
},
"while_statement": {
"patterns": [
{
"begin": "(\\bwhile\\b)",
"end": "(?=;|\\||&|\\n|\\)|\\`|\\{|\\}|[ \\t]*#|\\])(?<!\\\\)",
"beginCaptures": {
"1": {
"name": "keyword.control.while.shell"
}
},
"endCaptures": {},
"name": "meta.while.shell",
"patterns": [
{
"include": "#line_continuation"
},
{
"include": "#math_operators"
},
{
"include": "#option"
},
{
"include": "#simple_unquoted"
},
{
"include": "#normal_context"
},
{
"include": "#string"
}
]
}
]
}
}
}