From 13b3934f76b1b7ee9a69eaa85b40dc6743e92776 Mon Sep 17 00:00:00 2001 From: Sebastian Gniazdowski Date: Tue, 25 Oct 2016 18:11:07 +0200 Subject: [PATCH] *highlight: Define also "buf" and "len" at one "local", etc. keyword parse.zsh -oo, after changes: Running time: 1.7114690000 num calls time self name ----------------------------------------------------------------------------------- 1) 350 1704,09 4,87 100,00% 1229,84 3,51 72,17% -hsmw-highlight-process 2) 2800 337,05 0,12 19,78% 337,05 0,12 19,78% -hsmw-highlight-string 3) 2450 81,20 0,03 4,76% 81,20 0,03 4,76% -hsmw-highlight-check-path 4) 1400 38,61 0,03 2,27% 38,61 0,03 2,27% -hsmw-highlight-main-type 5) 350 9,85 0,03 0,58% 9,85 0,03 0,58% -hsmw-highlight-stack-pop 6) 350 7,54 0,02 0,44% 7,54 0,02 0,44% -hsmw-highlight-path-separators 7) 1 0,07 0,07 0,00% 0,07 0,07 0,00% -hsmw-highlight-fill-option-variables 8) 1 0,01 0,01 0,00% 0,01 0,01 0,00% -hsmw-highlight-init --- hsmw-highlight | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hsmw-highlight b/hsmw-highlight index 00c4d98..ee95722 100644 --- a/hsmw-highlight +++ b/hsmw-highlight @@ -232,14 +232,11 @@ __HSMW_HIGHLIGHT_TOKENS_TYPES=( # Variable declarations and initializations # in_array_assignment true between 'a=(' and the matching ')' # braces_stack: "R" for round, "Q" for square, "Y" for curly - local start_pos=0 end_pos highlight_glob=1 arg style in_array_assignment=0 MATCH expanded_path braces_stack + local start_pos=0 end_pos highlight_glob=1 arg style in_array_assignment=0 MATCH expanded_path braces_stack buf="$1" # arg_type can be 0, 1, 2 or 3, i.e. precommand, control flow, command separator - integer arg_type=0 MBEGIN MEND in_redirection + integer arg_type=0 MBEGIN MEND in_redirection len="${#buf}" local -a options_to_set match mbegin mend - local buf="$1" - integer len="${#buf}" - (( path_dirs_was_set )) && options_to_set+=( PATH_DIRS ) # State machine