*highlight: Optimization: two arg_type conditions converted into one

./parse.zsh -oo, after changes:

Running time: 1.6606550000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350        1653,26     4,72   99,99%   1214,58     3,47   73,46%  -hsmw-highlight-process
 2) 2800         324,72     0,12   19,64%    324,72     0,12   19,64%  -hsmw-highlight-string
 3) 2450          72,02     0,03    4,36%     72,02     0,03    4,36%  -hsmw-highlight-check-path
 4) 1400          24,76     0,02    1,50%     24,76     0,02    1,50%  -hsmw-highlight-main-type
 5)  350           9,72     0,03    0,59%      9,72     0,03    0,59%  -hsmw-highlight-stack-pop
 6)  350           7,47     0,02    0,45%      7,47     0,02    0,45%  -hsmw-highlight-path-separators
 7)    1           0,10     0,10    0,01%      0,10     0,10    0,01%  -hsmw-highlight-fill-option-variables
 8)    1           0,01     0,01    0,00%      0,01     0,01    0,00%  -hsmw-highlight-init
This commit is contained in:
Sebastian Gniazdowski 2016-10-26 09:13:55 +02:00
parent 7031fc334e
commit 2ede95f080

View file

@ -571,9 +571,7 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=(
(( next_word = BIT_start ))
highlight_glob=1
fi
elif (( arg_type == 2 )) && (( this_word & BIT_start )); then
(( next_word = BIT_start ))
elif (( arg_type == 1 )) && (( this_word & BIT_start )); then
elif (( arg_type == 1 || arg_type == 2 )) && (( this_word & BIT_start )); then
(( next_word = BIT_start ))
elif [[ $arg == "repeat" ]] && (( this_word & BIT_start )); then
# skip the repeat-count word