*highlight: Optimization: use previous style value; compress

parse.zsh -oo, after changes:

Running time: 1.6716980000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350        1664,15     4,75   99,99%   1217,95     3,48   73,18%  -hsmw-highlight-process
 2) 2800         325,63     0,12   19,57%    325,63     0,12   19,57%  -hsmw-highlight-string
 3) 2450          77,34     0,03    4,65%     77,34     0,03    4,65%  -hsmw-highlight-check-path
 4) 1400          26,02     0,02    1,56%     26,02     0,02    1,56%  -hsmw-highlight-main-type
 5)  350           9,70     0,03    0,58%      9,70     0,03    0,58%  -hsmw-highlight-stack-pop
 6)  350           7,51     0,02    0,45%      7,51     0,02    0,45%  -hsmw-highlight-path-separators
 7)    1           0,12     0,12    0,01%      0,12     0,12    0,01%  -hsmw-highlight-fill-option-variables
 8)    1           0,02     0,02    0,00%      0,02     0,02    0,00%  -hsmw-highlight-init
This commit is contained in:
Sebastian Gniazdowski 2016-10-25 20:40:54 +02:00
parent f65df29907
commit 5c30308699

View file

@ -456,13 +456,9 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=(
elif [[ $arg[1] == $histchars[2] ]]; then
style=history-expansion
elif (( arg_type == 3 )); then
if (( this_word & BIT_regular )); then
# This highlights empty commands (semicolon follows nothing) as an error.
# Zsh accepts them, though.
style=commandseparator
else
style=unknown-token
fi
# This highlights empty commands (semicolon follows nothing) as an error.
# Zsh accepts them, though.
(( this_word & BIT_regular )) && style=commandseparator
elif (( in_redirection == 2 )); then
style=redirection
elif [[ $arg[1,2] == '((' ]]; then