Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ShellScript] Improve test expression and pattern matching highlighti…
…ng (#3827) * [ShellScript] Fix regexp group highlighting Fixes #3825 * [ShellScript] Improve shell patterns and POSIX ERE This commit... 1. separates implementation of basic Bash pattern matching an posix extended regular expressions to more accurately scope them. 2. adjusts [[ ... ]] implementation to make use of both pattern types: a) after `==` or `!=` => basic pattern matching b) after `=~` => posix extended regular expressions 3. implements various variants of pattern contexts to correctly handle bailouts depending on where patterns occur. (e.g.: test expressions, parameter expansions, case patterns, ...) 4. fine tunes rules to follow language specifications more closely. POSIX Extended Regular Expressions are based on `RegExp (Basic)` but have been simplified by removing all the modifiers and (?x) regexp matching as it is not supported. Related context are included directly into Bash.sublime-syntax as they share various contexts with basic pattern matching and it may reduce friction in case Bash is inherited by a 3rd-party syntax (e.g.: Makefile). * [ShellScript] Drop unsupported parens in test args This commit removes support for parentheses within test command arguments, as those are not supported by Bash or Zsh. * [ShellScript] Separate contexts for [ ... ] and [[ ... ]] This commit distinguishes builtin test expressions `[ ... ]` and compound test expressions `[[ ... ]]` to respect the different features supported. Builtin test expressions support same limited test arguments as `test` command, only. * [ShellScript] Fix comparison operator scope in test expressions This commit... 1. scopes single `=` as comparison operator as it is equal to `==`. 2. scopes -ot, -ne, ... as comparison operators * [ShellScript] Tweak compound test context names This commit renames some contexts to make it more obvious where they belong to.
- Loading branch information