*highlight: One case less, no ;| fall through

15xx values are now very common, though the gains are low

parse.zsh -oo, after changes:

Running time: 1.5569020000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350        1549,43     4,43   99,99%   1194,57     3,41   77,09%  -hsmw-highlight-process
 2) 2800         294,41     0,11   19,00%    294,41     0,11   19,00%  -hsmw-highlight-string
 3) 1750          40,59     0,02    2,62%     40,59     0,02    2,62%  -hsmw-highlight-check-path
 4) 1400          19,87     0,01    1,28%     19,87     0,01    1,28%  -hsmw-highlight-main-type
 5)    1           0,09     0,09    0,01%      0,09     0,09    0,01%  -hsmw-highlight-fill-option-variables
 6)    1           0,01     0,01    0,00%      0,01     0,01    0,00%  -hsmw-highlight-init
This commit is contained in:
Sebastian Gniazdowski 2016-11-02 12:13:31 +01:00
parent 48a117959a
commit daa2ec31b5

View file

@ -513,20 +513,6 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=(
(( multi_func_def )) && (( next_word = next_word | 1 ))
style=reserved-word
;;
$'\x7d') # right brace
#
# Parsing rule: # {
#
# Additionally, `tt(})' is recognized in any position if neither the
# tt(IGNORE_BRACES) option nor the tt(IGNORE_CLOSE_BRACES) option is set."""
(( right_brace_is_recognised_everywhere )) && [[ $braces_stack[1] == "Y" ]] && {
braces_stack[1]=""
style=reserved-word
(( next_word = next_word | 16 ))
}
#else
# Fall through to the catchall case at the end.
;|
'--'*) style=double-hyphen-option;;
'-'*) style=single-hyphen-option;;
"'"*) style=single-quoted-argument;;
@ -545,8 +531,15 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=(
'`'*) style=back-quoted-argument;;
[*?]*|*[^\\][*?]*)
(( highlight_glob )) && style=globbing || style=default;;
*) if [[ $arg = $'\x7d' ]] && (( right_brace_is_recognised_everywhere )); then
# was handled by the $'\x7d' case above
*) if [[ $arg = $'\x7d' && $braces_stack[1] == "Y" && "$right_brace_is_recognised_everywhere" = "1" ]]; then
# right brace
# Parsing rule: # {
#
# Additionally, `tt(})' is recognized in any position if neither the
# tt(IGNORE_BRACES) option nor the tt(IGNORE_CLOSE_BRACES) option is set."""
braces_stack[1]=""
style=reserved-word
(( next_word = next_word | 16 ))
elif [[ $arg[1] = $histchars[1] && -n "${arg[2]}" ]]; then
style=history-expansion
elif (( arg_type == 3 )); then