From c8796d1105420249ddc338e3f6acf9d816d938eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20K=C3=BChl?= Date: Fri, 26 Aug 2016 19:59:19 +0200 Subject: [PATCH 1/4] Deny backslashes in block variables The variable names in for-in loops and select blocks are really variable names, not strings, and may not contain backslashes or escape sequences. --- Syntaxes/Shell-Unix-Bash.tmLanguage | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Syntaxes/Shell-Unix-Bash.tmLanguage b/Syntaxes/Shell-Unix-Bash.tmLanguage index bc4db1b..413a6b5 100644 --- a/Syntaxes/Shell-Unix-Bash.tmLanguage +++ b/Syntaxes/Shell-Unix-Bash.tmLanguage @@ -1292,7 +1292,7 @@ begin - (?<=^|;|&|\s)(for)\s+((?:[^\s\\]|\\.)+)(?=\s|;|&|$) + (?<=^|;|&|\s)(for)\s+([^\s\\]+)(?=\s|;|&|$) beginCaptures 1 @@ -1351,7 +1351,7 @@ begin - (?<=^|;|&|\s)(select)\s+((?:[^\s\\]|\\.)+)(?=\s|;|&|$) + (?<=^|;|&|\s)(select)\s+([^\s\\]+)(?=\s|;|&|$) beginCaptures 1 From 5e3796c9972e59ea660724b947d060b95dc83ea5 Mon Sep 17 00:00:00 2001 From: Pat Gaffney Date: Tue, 30 Aug 2016 23:37:30 -0500 Subject: [PATCH 2/4] Add grammar support for coproc (coprocess command) Bash 4.0 introduced coprocesses -- a way to execute commands asynchronously in a subshell. --- Syntaxes/Shell-Unix-Bash.tmLanguage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Shell-Unix-Bash.tmLanguage b/Syntaxes/Shell-Unix-Bash.tmLanguage index 413a6b5..61b007b 100644 --- a/Syntaxes/Shell-Unix-Bash.tmLanguage +++ b/Syntaxes/Shell-Unix-Bash.tmLanguage @@ -1219,7 +1219,7 @@ match - (?<=^|;|&|\s)(?:if|then|else|elif|fi|for|in|do|done|select|case|continue|esac|while|until|return)(?=\s|;|&|$) + (?<=^|;|&|\s)(?:if|then|else|elif|fi|for|in|do|done|select|case|continue|esac|while|until|return|coproc)(?=\s|;|&|$) name keyword.control.shell From a025ab13c43e95e058d2bfaf8e89c55b38ff0aaf Mon Sep 17 00:00:00 2001 From: Pat Gaffney Date: Wed, 31 Aug 2016 00:01:43 -0500 Subject: [PATCH 3/4] Add grammar support for mapfile (array input) --- Syntaxes/Shell-Unix-Bash.tmLanguage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Shell-Unix-Bash.tmLanguage b/Syntaxes/Shell-Unix-Bash.tmLanguage index 61b007b..63360b1 100644 --- a/Syntaxes/Shell-Unix-Bash.tmLanguage +++ b/Syntaxes/Shell-Unix-Bash.tmLanguage @@ -1771,7 +1771,7 @@ match - (?<=^|;|&|\s)(?:alias|bg|bind|break|builtin|caller|cd|command|compgen|complete|dirs|disown|echo|enable|eval|exec|exit|false|fc|fg|getopts|hash|help|history|jobs|kill|let|logout|popd|printf|pushd|pwd|read|readonly|set|shift|shopt|source|suspend|test|times|trap|true|type|ulimit|umask|unalias|unset|wait)(?=\s|;|&|$) + (?<=^|;|&|\s)(?:alias|bg|bind|break|builtin|caller|cd|command|compgen|complete|dirs|disown|echo|enable|eval|exec|exit|false|fc|fg|getopts|hash|help|history|jobs|kill|let|logout|mapfile|popd|printf|pushd|pwd|read|readonly|set|shift|shopt|source|suspend|test|times|trap|true|type|ulimit|umask|unalias|unset|wait)(?=\s|;|&|$) name support.function.builtin.shell From d0650a8304776f80382ad29eb98cd4ff38ef17c0 Mon Sep 17 00:00:00 2001 From: Pat Gaffney Date: Wed, 31 Aug 2016 00:02:41 -0500 Subject: [PATCH 4/4] Add grammar support for readarray (array input) --- Syntaxes/Shell-Unix-Bash.tmLanguage | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Syntaxes/Shell-Unix-Bash.tmLanguage b/Syntaxes/Shell-Unix-Bash.tmLanguage index 63360b1..46c3e99 100644 --- a/Syntaxes/Shell-Unix-Bash.tmLanguage +++ b/Syntaxes/Shell-Unix-Bash.tmLanguage @@ -1771,7 +1771,7 @@ match - (?<=^|;|&|\s)(?:alias|bg|bind|break|builtin|caller|cd|command|compgen|complete|dirs|disown|echo|enable|eval|exec|exit|false|fc|fg|getopts|hash|help|history|jobs|kill|let|logout|mapfile|popd|printf|pushd|pwd|read|readonly|set|shift|shopt|source|suspend|test|times|trap|true|type|ulimit|umask|unalias|unset|wait)(?=\s|;|&|$) + (?<=^|;|&|\s)(?:alias|bg|bind|break|builtin|caller|cd|command|compgen|complete|dirs|disown|echo|enable|eval|exec|exit|false|fc|fg|getopts|hash|help|history|jobs|kill|let|logout|mapfile|popd|printf|pushd|pwd|read(array)?|readonly|set|shift|shopt|source|suspend|test|times|trap|true|type|ulimit|umask|unalias|unset|wait)(?=\s|;|&|$) name support.function.builtin.shell