[sh] Allow more characters in aliases and function names

Which characters are allowed?
- Aliases: https://www.gnu.org/software/bash/manual/html_node/Aliases.html
- Functions: https://unix.stackexchange.com/questions/245331/shell-valid-function-name-characters

For aliases I chose [\w-.] instead of blacklisting many forbidden characters. For functions I chose \S.
This commit is contained in:
Lennard Hofmann 2020-02-03 18:59:46 +00:00 committed by GitHub
parent c6eb9bd8f0
commit 75bb796b2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,7 +56,8 @@ evaluate-commands %sh{
add-highlighter shared/sh/code/operators regex [\[\]\(\)&|]{1,2} 0:operator
add-highlighter shared/sh/code/variable regex ((?<![-:])\b\w+)= 1:variable
add-highlighter shared/sh/code/function regex ^\h*(\w+)\h*\(\) 1:function
add-highlighter shared/sh/code/alias regex \balias(\h+[-+]\w)*\h+([\w-.]+)= 2:variable
add-highlighter shared/sh/code/function regex ^\h*(\S+)\h*\(\) 1:function
add-highlighter shared/sh/code/unscoped_expansion regex \$(\w+|#|@|\?|\$|!|-|\*) 0:value
add-highlighter shared/sh/double_string/expansion regex \$(\w+|\{.+?\}) 0:value