From 4f8d7bb5cc4d1643674551683df10fe552dd5a6f Mon Sep 17 00:00:00 2001 From: Mohamed Akram Date: Sun, 21 Jun 2020 19:42:06 +0400 Subject: [PATCH 1/2] Fix heredoc expansion --- grammars/shell-unix-bash.cson | 54 ++++++++++++++++++++++++++++++-- spec/shell-unix-bash-spec.coffee | 8 ++--- 2 files changed, 56 insertions(+), 6 deletions(-) diff --git a/grammars/shell-unix-bash.cson b/grammars/shell-unix-bash.cson index 56e5755..03ca4fb 100644 --- a/grammars/shell-unix-bash.cson +++ b/grammars/shell-unix-bash.cson @@ -548,7 +548,7 @@ ] } { - 'begin': '(<<)-\\s*("|\'|)\\s*\\\\?([^;&<\\s]+)\\2' + 'begin': '(<<)-\\s*("|\')\\s*\\\\?([^;&<\\s]+)\\2' 'beginCaptures': '1': 'name': 'keyword.operator.heredoc.shell' @@ -561,7 +561,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' @@ -573,6 +573,56 @@ 'name': 'keyword.control.heredoc-token.shell' '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' + } + ] + } ] 'herestring': 'patterns': [ diff --git a/spec/shell-unix-bash-spec.coffee b/spec/shell-unix-bash-spec.coffee index ba62906..8d8af96 100644 --- a/spec/shell-unix-bash-spec.coffee +++ b/spec/shell-unix-bash-spec.coffee @@ -220,10 +220,10 @@ describe "Shell script grammar", -> stuff #{delim} """ - expect(tokens[0][0]).toEqual value: '<<', scopes: ['source.shell', 'string.unquoted.heredoc.shell', 'keyword.operator.heredoc.shell'] - expect(tokens[0][1]).toEqual value: delim, scopes: ['source.shell', 'string.unquoted.heredoc.shell', 'keyword.control.heredoc-token.shell'] - expect(tokens[1][0]).toEqual value: 'stuff', scopes: ['source.shell', 'string.unquoted.heredoc.shell'] - expect(tokens[2][0]).toEqual value: delim, scopes: ['source.shell', 'string.unquoted.heredoc.shell', 'keyword.control.heredoc-token.shell'] + expect(tokens[0][0]).toEqual value: '<<', scopes: ['source.shell', 'string.unquoted.heredoc.expanded.shell', 'keyword.operator.heredoc.shell'] + expect(tokens[0][1]).toEqual value: delim, scopes: ['source.shell', 'string.unquoted.heredoc.expanded.shell', 'keyword.control.heredoc-token.shell'] + expect(tokens[1][0]).toEqual value: 'stuff', scopes: ['source.shell', 'string.unquoted.heredoc.expanded.shell'] + expect(tokens[2][0]).toEqual value: delim, scopes: ['source.shell', 'string.unquoted.heredoc.expanded.shell', 'keyword.control.heredoc-token.shell'] for delim in delims tokens = grammar.tokenizeLines """ From 35dc1aa1371ab75ece08fd0837330eb62e1f9da9 Mon Sep 17 00:00:00 2001 From: Musa Ibrahim Date: Wed, 28 Sep 2022 11:52:01 +0100 Subject: [PATCH 2/2] add sunset message --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6ca71df..515d97f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ -# ShellScript language support in Atom +##### Atom and all repositories under Atom will be archived on December 15, 2022. Learn more in our [official announcement](https://github.blog/2022-06-08-sunsetting-atom/) + # ShellScript language support in Atom ![CI Status](https://github.com/atom/language-shellscript/actions/workflows/main.yml/badge.svg) Adds syntax highlighting and snippets to shell scripts in Atom.