From b4e3d994d4e9b654caa54f783eb48da27e7254d9 Mon Sep 17 00:00:00 2001 From: Sebastian Gniazdowski Date: Sat, 15 Oct 2016 11:29:53 +0200 Subject: [PATCH] *highlight: In-string paremeter indexing [...] allowed, highlighted --- hsmw-highlight | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hsmw-highlight b/hsmw-highlight index eed7ea5..6cef94f 100644 --- a/hsmw-highlight +++ b/hsmw-highlight @@ -686,10 +686,10 @@ typeset -gA HSMW_HIGHLIGHT_STYLES case "$arg[$i]" in '$' ) style=dollar-double-quoted-argument # Look for an alphanumeric parameter name. - if [[ ${arg:$i} = (#b)([[:alpha:]_][[:alnum:]_]#|[[:digit:]]##)* ]] ; then + if [[ ${arg:$i} = (#b)(([[:alpha:]_][[:alnum:]_]#|[[:digit:]]##)(\[[^[:space:]]#\])(#c0,1))* ]] ; then (( k += ${#match[1]} )) # highlight the parameter name (( i += ${#match[1]} )) # skip past it - elif [[ ${arg:$i} = (#b)([{](\([a-zA-Z0@%#]##\))(#c0,1)([[:alpha:]_][[:alnum:]_]#|[[:digit:]]##)[}])* ]] ; then + elif [[ ${arg:$i} = (#b)([{](\([a-zA-Z0@%#]##\))(#c0,1)([[:alpha:]_][[:alnum:]_]#|[[:digit:]]##)(\[[^[:space:]]#\])(#c0,1)[}])* ]] ; then (( k += ${#match[1]} )) # highlight the parameter name and braces (( i += ${#match[1]} )) # skip past it else