*highlight: Don't redefine already_added, don't set it for comments

parse.zsh -oo, after changes:

Running time: 1.8225100000
num  calls                time                       self            name
-----------------------------------------------------------------------------------
 1)  350        1814,83     5,19   99,99%   1336,69     3,82   73,65%  -hsmw-highlight-process
 2) 2800         338,83     0,12   18,67%    338,83     0,12   18,67%  -hsmw-highlight-string
 3) 2450          81,75     0,03    4,50%     81,75     0,03    4,50%  -hsmw-highlight-check-path
 4) 1400          39,80     0,03    2,19%     39,80     0,03    2,19%  -hsmw-highlight-main-type
 5)  350           9,74     0,03    0,54%      9,74     0,03    0,54%  -hsmw-highlight-stack-pop
 6)  350           8,02     0,02    0,44%      8,02     0,02    0,44%  -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-25 16:58:55 +02:00
parent d266b62e7e
commit 1dcfc3c372

View file

@ -280,7 +280,7 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=(
# #
integer BIT_start=1 BIT_regular=2 BIT_sudo_opt=4 BIT_sudo_arg=8 BIT_always=16 integer BIT_start=1 BIT_regular=2 BIT_sudo_opt=4 BIT_sudo_arg=8 BIT_always=16
integer this_word=BIT_start next_word=0 integer this_word=BIT_start next_word=0 already_added
# Processing buffer # Processing buffer
local proc_buf="$buf" local proc_buf="$buf"
@ -301,7 +301,7 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=(
# for this iteration. Currently, that is done for "" and $'' strings, # for this iteration. Currently, that is done for "" and $'' strings,
# which add the entry early so escape sequences within the string override # which add the entry early so escape sequences within the string override
# the string's color. # the string's color.
integer already_added=0 already_added=0
style=unknown-token style=unknown-token
if (( this_word & BIT_start )); then if (( this_word & BIT_start )); then
in_array_assignment=0 in_array_assignment=0
@ -350,7 +350,6 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=(
fi fi
# ADD # ADD
reply+=("$start_pos $end_pos ${HSMW_HIGHLIGHT_STYLES[$style]}") reply+=("$start_pos $end_pos ${HSMW_HIGHLIGHT_STYLES[$style]}")
already_added=1
continue continue
fi fi