syntax: sh: color options distinctively, and color also long options

Also add some comments, and accept hyphens in function names.
This commit is contained in:
Benno Schulenberg 2018-03-28 14:30:07 +02:00
parent f9415e347a
commit 0bce5ba4d9

View File

@ -6,12 +6,19 @@ magic "(POSIX|Bourne-Again) shell script.*text"
linter dash -n
comment "#"
icolor brightgreen "^[0-9A-Z_]+\(\)"
# Function declarations.
color brightgreen "^[A-Za-z0-9_-]+\(\)"
# Keywords, symbols, and comparisons.
color green "\<(break|case|continue|do|done|elif|else|esac|exit|fi|for|function|if|in|read|return|select|shift|then|time|until|while)\>"
color green "\<(declare|eval|exec|export|let|local)\>"
color green "[{}():;|`$<>!=&\\]" "(\]|\[)"
color green "-[Ldefgruwx]\>"
color green "-(eq|ne|gt|lt|ge|le|s|n|z)\>"
color green "-(eq|ne|gt|lt|ge|le|ef|ot|nt)\>"
# Short and long options.
color brightmagenta "-[A-Za-z]\>" "--[A-Za-z-]+\>"
# Common commands.
color brightblue "\<(awk|cat|cd|ch(grp|mod|own)|cp|cut|echo|env|grep|head|install|ln|make|mkdir|mv|popd|printf|pushd|rm|rmdir|sed|set|sort|tail|tar|touch|umask|unset)\>"
color normal "[.-]tar\>"