*highlight: Optimization and logic change: no path at command position

parse.zsh -oo, after changes:

Running time: 1.5690220000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350        1561,42     4,46   99,99%   1191,03     3,40   76,27%  -hsmw-highlight-process
 2) 2800         288,00     0,10   18,44%    288,00     0,10   18,44%  -hsmw-highlight-string
 3) 1750          47,38     0,03    3,03%     47,38     0,03    3,03%  -hsmw-highlight-check-path
 4) 1400          25,15     0,02    1,61%     25,15     0,02    1,61%  -hsmw-highlight-main-type
 5)  350           9,86     0,03    0,63%      9,86     0,03    0,63%  -hsmw-highlight-stack-pop
 6)    1           0,11     0,11    0,01%      0,11     0,11    0,01%  -hsmw-highlight-fill-option-variables
 7)    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-30 12:12:35 +01:00
parent 7b04ca7d8e
commit 35058d6632

View file

@ -482,20 +482,8 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=(
# subshell
style=reserved-word
braces_stack='R'"$braces_stack"
else
-hsmw-highlight-check-path && {
# ADD
reply+=("$start_pos $end_pos ${HSMW_HIGHLIGHT_STYLES[path]}")
already_added=1
[[ -n $HSMW_HIGHLIGHT_STYLES[path_pathseparator] && $HSMW_HIGHLIGHT_STYLES[path] != $HSMW_HIGHLIGHT_STYLES[path_pathseparator] ]] && {
local pos
for (( pos = start_pos; pos <= end_pos; pos++ )) ; do
# ADD
[[ ${buf[pos]} == "/" ]] && reply+=("$(( pos - 1 )) $pos ${HSMW_HIGHLIGHT_STYLES[path_pathseparator]}")
done
}
} || (( this_word & 14 )) && style=default
elif (( this_word & 14 )); then
style=default
fi
;;
*)