Update shellscript grammar (#176978)

This commit is contained in:
Alex Ross 2023-03-13 17:40:43 +01:00 committed by GitHub
parent 7800bd3492
commit 782ea94050
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 90 additions and 52 deletions

View file

@ -6,11 +6,11 @@
"git": {
"name": "jeff-hykin/better-shell-syntax",
"repositoryUrl": "https://github.com/jeff-hykin/better-shell-syntax",
"commitHash": "02e55c164ef9a5b1754ba1caa184b966e7a69a44"
"commitHash": "adcc0fdac84e96e03a2cfb48a0f6f854a1da9053"
}
},
"license": "MIT",
"version": "1.4.4"
"version": "1.4.5"
}
],
"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/02e55c164ef9a5b1754ba1caa184b966e7a69a44",
"version": "https://github.com/jeff-hykin/better-shell-syntax/commit/adcc0fdac84e96e03a2cfb48a0f6f854a1da9053",
"name": "Shell Script",
"scopeName": "source.shell",
"patterns": [
@ -2116,17 +2116,6 @@
}
}
},
{
"match": "(\\$)(\\{[0-9]+\\}(?!\\w))",
"captures": {
"1": {
"name": "punctuation.definition.variable.shell variable.parameter.positional.shell"
},
"2": {
"name": "variable.parameter.positional.shell"
}
}
},
{
"match": "(\\$)([-*#?$!0_](?!\\w))",
"captures": {
@ -2139,19 +2128,68 @@
}
},
{
"begin": "(\\$)(\\{)",
"begin": "(\\$)(\\{)[ \\t]*+(?=\\d)",
"end": "\\}",
"beginCaptures": {
"1": {
"name": "punctuation.definition.variable.shell punctuation.section.bracket.curly.variable.begin.shell"
"name": "punctuation.definition.variable.shell variable.parameter.positional.shell"
},
"2": {
"name": "punctuation.section.bracket.curly.variable.begin.shell"
"name": "punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell variable.parameter.positional.shell"
}
},
"endCaptures": {
"0": {
"name": "punctuation.section.bracket.curly.variable.end.shell"
"name": "punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell variable.parameter.positional.shell"
}
},
"contentName": "meta.parameter-expansion",
"patterns": [
{
"match": "!|:[-=?]?|\\*|@|##|#|%%|%|\\/",
"name": "keyword.operator.expansion.shell"
},
{
"match": "(\\[)[^\\]]+(\\])",
"captures": {
"1": {
"name": "punctuation.section.array.shell"
},
"2": {
"name": "punctuation.section.array.shell"
}
}
},
{
"match": "[0-9]+",
"name": "variable.parameter.positional.shell"
},
{
"match": "(?<!\\w)[a-zA-Z_0-9-]+(?!\\w)",
"name": "variable.other.normal.shell"
},
{
"include": "#variable"
},
{
"include": "#string"
}
]
},
{
"begin": "(\\$)(\\{)",
"end": "\\}",
"beginCaptures": {
"1": {
"name": "punctuation.definition.variable.shell"
},
"2": {
"name": "punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell"
}
},
"endCaptures": {
"0": {
"name": "punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell"
}
},
"contentName": "meta.parameter-expansion",

View file

@ -491,7 +491,7 @@
},
{
"c": "$",
"t": "source.shell meta.statement.shell meta.command.shell meta.argument.shell string.quoted.double.shell punctuation.definition.variable.shell punctuation.section.bracket.curly.variable.begin.shell",
"t": "source.shell meta.statement.shell meta.command.shell meta.argument.shell string.quoted.double.shell punctuation.definition.variable.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
@ -505,7 +505,7 @@
},
{
"c": "{",
"t": "source.shell meta.statement.shell meta.command.shell meta.argument.shell string.quoted.double.shell punctuation.section.bracket.curly.variable.begin.shell",
"t": "source.shell meta.statement.shell meta.command.shell meta.argument.shell string.quoted.double.shell punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
@ -575,7 +575,7 @@
},
{
"c": "}",
"t": "source.shell meta.statement.shell meta.command.shell meta.argument.shell string.quoted.double.shell punctuation.section.bracket.curly.variable.end.shell",
"t": "source.shell meta.statement.shell meta.command.shell meta.argument.shell string.quoted.double.shell punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",

View file

@ -267,7 +267,7 @@
},
{
"c": "$",
"t": "source.shell meta.scope.if-block.shell meta.arithmetic.shell punctuation.definition.variable.shell punctuation.section.bracket.curly.variable.begin.shell",
"t": "source.shell meta.scope.if-block.shell meta.arithmetic.shell punctuation.definition.variable.shell",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
@ -281,7 +281,7 @@
},
{
"c": "{",
"t": "source.shell meta.scope.if-block.shell meta.arithmetic.shell punctuation.section.bracket.curly.variable.begin.shell",
"t": "source.shell meta.scope.if-block.shell meta.arithmetic.shell punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
@ -365,7 +365,7 @@
},
{
"c": "}",
"t": "source.shell meta.scope.if-block.shell meta.arithmetic.shell punctuation.section.bracket.curly.variable.end.shell",
"t": "source.shell meta.scope.if-block.shell meta.arithmetic.shell punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
@ -477,7 +477,7 @@
},
{
"c": "$",
"t": "source.shell meta.scope.if-block.shell meta.statement.shell meta.command.shell meta.statement.command.name.shell meta.statement.command.name.continuation string.quoted.double entity.name.command punctuation.definition.variable.shell punctuation.section.bracket.curly.variable.begin.shell",
"t": "source.shell meta.scope.if-block.shell meta.statement.shell meta.command.shell meta.statement.command.name.shell meta.statement.command.name.continuation string.quoted.double entity.name.command punctuation.definition.variable.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
@ -491,7 +491,7 @@
},
{
"c": "{",
"t": "source.shell meta.scope.if-block.shell meta.statement.shell meta.command.shell meta.statement.command.name.shell meta.statement.command.name.continuation string.quoted.double entity.name.command punctuation.section.bracket.curly.variable.begin.shell",
"t": "source.shell meta.scope.if-block.shell meta.statement.shell meta.command.shell meta.statement.command.name.shell meta.statement.command.name.continuation string.quoted.double entity.name.command punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
@ -561,7 +561,7 @@
},
{
"c": "}",
"t": "source.shell meta.scope.if-block.shell meta.statement.shell meta.command.shell meta.statement.command.name.shell meta.statement.command.name.continuation string.quoted.double entity.name.command punctuation.section.bracket.curly.variable.end.shell",
"t": "source.shell meta.scope.if-block.shell meta.statement.shell meta.command.shell meta.statement.command.name.shell meta.statement.command.name.continuation string.quoted.double entity.name.command punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
@ -701,7 +701,7 @@
},
{
"c": "$",
"t": "source.shell meta.scope.if-block.shell meta.statement.shell meta.command.shell meta.argument.shell string.quoted.double.shell punctuation.definition.variable.shell punctuation.section.bracket.curly.variable.begin.shell",
"t": "source.shell meta.scope.if-block.shell meta.statement.shell meta.command.shell meta.argument.shell string.quoted.double.shell punctuation.definition.variable.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
@ -715,7 +715,7 @@
},
{
"c": "{",
"t": "source.shell meta.scope.if-block.shell meta.statement.shell meta.command.shell meta.argument.shell string.quoted.double.shell punctuation.section.bracket.curly.variable.begin.shell",
"t": "source.shell meta.scope.if-block.shell meta.statement.shell meta.command.shell meta.argument.shell string.quoted.double.shell punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
@ -785,7 +785,7 @@
},
{
"c": "}",
"t": "source.shell meta.scope.if-block.shell meta.statement.shell meta.command.shell meta.argument.shell string.quoted.double.shell punctuation.section.bracket.curly.variable.end.shell",
"t": "source.shell meta.scope.if-block.shell meta.statement.shell meta.command.shell meta.argument.shell string.quoted.double.shell punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",

View file

@ -813,35 +813,35 @@
},
{
"c": "$",
"t": "source.shell meta.scope.if-block.shell meta.function.shell meta.function.body.shell meta.statement.shell meta.command.shell meta.argument.shell string.quoted.double.shell punctuation.definition.variable.shell punctuation.section.bracket.curly.variable.begin.shell",
"t": "source.shell meta.scope.if-block.shell meta.function.shell meta.function.body.shell meta.statement.shell meta.command.shell meta.argument.shell string.quoted.double.shell punctuation.definition.variable.shell variable.parameter.positional.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"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"
"hc_black": "variable: #9CDCFE",
"dark_plus_experimental": "variable: #9CDCFE",
"hc_light": "variable: #001080",
"light_plus_experimental": "variable: #001080"
}
},
{
"c": "{",
"t": "source.shell meta.scope.if-block.shell meta.function.shell meta.function.body.shell meta.statement.shell meta.command.shell meta.argument.shell string.quoted.double.shell punctuation.section.bracket.curly.variable.begin.shell",
"t": "source.shell meta.scope.if-block.shell meta.function.shell meta.function.body.shell meta.statement.shell meta.command.shell meta.argument.shell string.quoted.double.shell punctuation.section.bracket.curly.variable.begin.shell punctuation.definition.variable.shell variable.parameter.positional.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"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"
"hc_black": "variable: #9CDCFE",
"dark_plus_experimental": "variable: #9CDCFE",
"hc_light": "variable: #001080",
"light_plus_experimental": "variable: #001080"
}
},
{
"c": "1",
"t": "source.shell meta.scope.if-block.shell meta.function.shell meta.function.body.shell meta.statement.shell meta.command.shell meta.argument.shell string.quoted.double.shell meta.parameter-expansion variable.other.normal.shell",
"t": "source.shell meta.scope.if-block.shell meta.function.shell meta.function.body.shell meta.statement.shell meta.command.shell meta.argument.shell string.quoted.double.shell meta.parameter-expansion variable.parameter.positional.shell",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
@ -897,16 +897,16 @@
},
{
"c": "}",
"t": "source.shell meta.scope.if-block.shell meta.function.shell meta.function.body.shell meta.statement.shell meta.command.shell meta.argument.shell string.quoted.double.shell punctuation.section.bracket.curly.variable.end.shell",
"t": "source.shell meta.scope.if-block.shell meta.function.shell meta.function.body.shell meta.statement.shell meta.command.shell meta.argument.shell string.quoted.double.shell punctuation.section.bracket.curly.variable.end.shell punctuation.definition.variable.shell variable.parameter.positional.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"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"
"hc_black": "variable: #9CDCFE",
"dark_plus_experimental": "variable: #9CDCFE",
"hc_light": "variable: #001080",
"light_plus_experimental": "variable: #001080"
}
},
{