Update shellscript grammar and add new test

This commit is contained in:
Alex Ross 2022-04-12 16:49:52 +02:00
parent 5468607181
commit 01cfc62ead
No known key found for this signature in database
GPG key ID: 89DDDBA66CBA7840
4 changed files with 190 additions and 5 deletions

View file

@ -6,12 +6,12 @@
"git": {
"name": "atom/language-shellscript",
"repositoryUrl": "https://github.com/atom/language-shellscript",
"commitHash": "4c3711edbe8eac6f501976893976b1ac6a043d50"
"commitHash": "4f8d7bb5cc4d1643674551683df10fe552dd5a6f"
}
},
"license": "MIT",
"description": "The file syntaxes/shell-unix-bash.tmLanguage.json was derived from the Atom package https://github.com/atom/language-shellscript which was originally converted from the TextMate bundle https://github.com/textmate/shellscript.tmbundle.",
"version": "0.26.0"
"version": "0.28.2"
}
],
"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/atom/language-shellscript/commit/4c3711edbe8eac6f501976893976b1ac6a043d50",
"version": "https://github.com/atom/language-shellscript/commit/4f8d7bb5cc4d1643674551683df10fe552dd5a6f",
"name": "Shell Script",
"scopeName": "source.shell",
"patterns": [
@ -624,7 +624,7 @@
]
},
{
"begin": "(<<)-\\s*(\"|'|)\\s*\\\\?([^;&<\\s]+)\\2",
"begin": "(<<)-\\s*(\"|')\\s*\\\\?([^;&<\\s]+)\\2",
"beginCaptures": {
"1": {
"name": "keyword.operator.heredoc.shell"
@ -642,7 +642,7 @@
"name": "string.unquoted.heredoc.no-indent.shell"
},
{
"begin": "(<<)\\s*(\"|'|)\\s*\\\\?([^;&<\\s]+)\\2",
"begin": "(<<)\\s*(\"|')\\s*\\\\?([^;&<\\s]+)\\2",
"beginCaptures": {
"1": {
"name": "keyword.operator.heredoc.shell"
@ -658,6 +658,66 @@
}
},
"name": "string.unquoted.heredoc.shell"
},
{
"begin": "(<<)-\\s*\\\\?([^;&<\\s]+)",
"beginCaptures": {
"1": {
"name": "keyword.operator.heredoc.shell"
},
"2": {
"name": "keyword.control.heredoc-token.shell"
}
},
"end": "^\\t*(\\2)(?=\\s|;|&|$)",
"endCaptures": {
"1": {
"name": "keyword.control.heredoc-token.shell"
}
},
"name": "string.unquoted.heredoc.expanded.no-indent.shell",
"patterns": [
{
"match": "\\\\[\\$`\\\\\\n]",
"name": "constant.character.escape.shell"
},
{
"include": "#variable"
},
{
"include": "#interpolation"
}
]
},
{
"begin": "(<<)\\s*\\\\?([^;&<\\s]+)",
"beginCaptures": {
"1": {
"name": "keyword.operator.heredoc.shell"
},
"2": {
"name": "keyword.control.heredoc-token.shell"
}
},
"end": "^(\\2)(?=\\s|;|&|$)",
"endCaptures": {
"1": {
"name": "keyword.control.heredoc-token.shell"
}
},
"name": "string.unquoted.heredoc.expanded.shell",
"patterns": [
{
"match": "\\\\[\\$`\\\\\\n]",
"name": "constant.character.escape.shell"
},
{
"include": "#variable"
},
{
"include": "#interpolation"
}
]
}
]
},

View file

@ -10,6 +10,11 @@ fi
DEVELOPER=$(xcode-select -print-path)
LIPO=$(xcrun -sdk iphoneos -find lipo)
cat <<-EOF > /path/file
# A heredoc with a variable $DEVELOPER
some more file
EOF
function code() {
cd $ROOT

View file

@ -1223,6 +1223,126 @@
"hc_light": "string: #A31515"
}
},
{
"c": "cat ",
"t": "source.shell",
"r": {
"dark_plus": "default: #D4D4D4",
"light_plus": "default: #000000",
"dark_vs": "default: #D4D4D4",
"light_vs": "default: #000000",
"hc_black": "default: #FFFFFF",
"hc_light": "default: #292929"
}
},
{
"c": "<<",
"t": "source.shell string.unquoted.heredoc.expanded.no-indent.shell keyword.operator.heredoc.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",
"hc_light": "keyword.operator: #000000"
}
},
{
"c": "-",
"t": "source.shell string.unquoted.heredoc.expanded.no-indent.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178",
"hc_light": "string: #A31515"
}
},
{
"c": "EOF",
"t": "source.shell string.unquoted.heredoc.expanded.no-indent.shell keyword.control.heredoc-token.shell",
"r": {
"dark_plus": "keyword.control: #C586C0",
"light_plus": "keyword.control: #AF00DB",
"dark_vs": "keyword.control: #569CD6",
"light_vs": "keyword.control: #0000FF",
"hc_black": "keyword.control: #C586C0",
"hc_light": "keyword.control: #AF00DB"
}
},
{
"c": " > /path/file",
"t": "source.shell string.unquoted.heredoc.expanded.no-indent.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178",
"hc_light": "string: #A31515"
}
},
{
"c": "\t# A heredoc with a variable ",
"t": "source.shell string.unquoted.heredoc.expanded.no-indent.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178",
"hc_light": "string: #A31515"
}
},
{
"c": "$",
"t": "source.shell string.unquoted.heredoc.expanded.no-indent.shell variable.other.normal.shell punctuation.definition.variable.shell",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "variable: #9CDCFE",
"hc_light": "variable: #001080"
}
},
{
"c": "DEVELOPER",
"t": "source.shell string.unquoted.heredoc.expanded.no-indent.shell variable.other.normal.shell",
"r": {
"dark_plus": "variable: #9CDCFE",
"light_plus": "variable: #001080",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "variable: #9CDCFE",
"hc_light": "variable: #001080"
}
},
{
"c": "\tsome more file",
"t": "source.shell string.unquoted.heredoc.expanded.no-indent.shell",
"r": {
"dark_plus": "string: #CE9178",
"light_plus": "string: #A31515",
"dark_vs": "string: #CE9178",
"light_vs": "string: #A31515",
"hc_black": "string: #CE9178",
"hc_light": "string: #A31515"
}
},
{
"c": "EOF",
"t": "source.shell string.unquoted.heredoc.expanded.no-indent.shell keyword.control.heredoc-token.shell",
"r": {
"dark_plus": "keyword.control: #C586C0",
"light_plus": "keyword.control: #AF00DB",
"dark_vs": "keyword.control: #569CD6",
"light_vs": "keyword.control: #0000FF",
"hc_black": "keyword.control: #C586C0",
"hc_light": "keyword.control: #AF00DB"
}
},
{
"c": "function",
"t": "source.shell meta.function.shell storage.type.function.shell",