Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: _regex_arguments and _apt don't use bare NULs



This removes NULs from cache files of _regex_arguments and fix some
typos.

Index: Completion/Base/_regex_arguments
===================================================================
RCS file: /projects/zsh/zsh/Completion/Base/_regex_arguments,v
retrieving revision 1.1.1.4
diff -u -F^( -r1.1.1.4 _regex_arguments
--- Completion/Base/_regex_arguments	1999/09/22 13:17:25	1.1.1.4
+++ Completion/Base/_regex_arguments	1999/09/25 10:52:49
@@ -247,16 +247,17 @@
 }
 
 _ra_gen_parse_state () {
-  local actions i
+  local actions i p
   test='if'
   for index in $=tbl[$state]; do
     if [[ "$pattern[$index]" != "[]" ]]; then
+      p="$pattern[$index]$lookahead[$index]*"
       if [[ -z "$guard[$index]" ]]; then
 	print -lr - \
-	  "$test [[ \$_ra_right = $pattern[$index]$lookahead[$index]* ]]"
+	  "$test [[ \$_ra_right = \${~:-${(qqqq)p}} ]]"
       else
 	print -lr - \
-	  "$test [[ \$_ra_right = $pattern[$index]$lookahead[$index]* ]] && {" \
+	  "$test [[ \$_ra_right = \${~:-${(qqqq)p}} ]] && {" \
 	      "$guard[$index]" \
 	    "}"
       fi
@@ -365,7 +366,7 @@
 
     if [[ -d "$cache_dir" && -w "$cache_dir" ]]; then
       print -lr - \
-	'if [[ $# -eq '$#' && "$*" = '"${*:q}"' ]]; then' \
+	'if [[ $# -eq '$#' && "$*" = '"${(qqqq)*}"' ]]; then' \
 	"$funcdef" \
 	'true; else false; fi' > "${cache_file}.$HOST.$$"
       source "${cache_file}.$HOST.$$" "$@"
Index: Completion/Debian/_apt
===================================================================
RCS file: /projects/zsh/zsh/Completion/Debian/_apt,v
retrieving revision 1.1.1.7
diff -u -F^( -r1.1.1.7 _apt
--- Completion/Debian/_apt	1999/09/22 13:17:39	1.1.1.7
+++ Completion/Debian/_apt	1999/09/25 10:52:49
@@ -54,7 +54,7 @@
   case \$current_option in
   ${comp_hasarg}esac"
 
-  local short_seq false true bool bool_prefix intlevel word word1 nul
+  local short_seq false true bool bool_prefix intlevel word word1 nul qnul
   local comp_bool comp_intlevel comp_configfile comp_arbitem comp_long comp_opt
   local regex_short regex_long regex_all
 
@@ -73,6 +73,7 @@
   word=$'[^\0]#\0'
   word1=$'[^\0]##\0'
   nul=$'\0'
+  qnul="\$'\\0'"
 
   comp_bool='compadd "$expl_bool[@]" '"$bool"
   comp_intlevel= #"_message 'intlevel'"
@@ -119,7 +120,7 @@
     )
     regex_long_prefix=("$regex_long_prefix[@]"
       /"(${(j:|:)short_hasarg})$nul"/
-	-'_apt_consume_short ${match[1][-2]}; current_option=${canonicalize[-${${match[1]%$nul}[-1]}]}'
+	-'_apt_consume_short ${match[1][-2]}; current_option=${canonicalize[-${${match[1]%'$qnul'}[-1]}]}'
 	/"$word"/ :"$comp_hasarg" \|
       /"(${(j:|:)short_hasarg})="/
 	-'_apt_consume_short ${match[1][-2]}; current_option=${canonicalize[-${${match[1]%=}[-1]}]}'
@@ -130,17 +131,17 @@
   if (( $#short_bool )); then
     regex_short=("$regex_short[@]"
       /"$short_seq(${(j:|:)short_bool})($nul(${(j:|:)bool})|(${(j:|:)bool})|)$nul"/
-	-"_apt_consume_short \${match[1]%%($nul(${(j:|:)bool})|(${(j:|:)bool})|)$nul}" \|
+	-'_apt_consume_short ${match[1]%%('$qnul'('${(j:|:)bool}')|('${(j:|:)bool}')|)'$qnul'}' \|
       /"$short_seq(${(j:|:)short_bool})="/
-	-"_apt_consume_short \${match[1]%=}"
+	-'_apt_consume_short ${match[1]%=}'
 	\( /"$word1"/ :"$comp_bool" \| /"$nul"/ /"$word"/ :"$comp_bool" \) \|
     )
     regex_long_prefix=("$regex_long_prefix[@]"
       /"(${(j:|:)short_bool})="/
-	-"_apt_consume_short \${match[1][-2]}"
+	-'_apt_consume_short ${match[1][-2]}'
 	\( /"$word1"/ :"$comp_bool" \| /"$nul"/ /"$word"/ :"$comp_bool" \) \|
       /"(${(j:|:)short_bool})$nul"/
-	-"_apt_consume_short \${match[1][-2]}"
+	-'_apt_consume_short ${match[1][-2]}'
 	/"((${(j:|:)bool})$nul|)"/ :"$comp_bool" \|
     )
   fi
@@ -148,17 +149,17 @@
   if (( $#short_intlevel )); then
     regex_short=("$regex_short[@]"
       /"$short_seq(${(j:|:)short_intlevel})($nul$intlevel|$intlevel|)$nul"/
-	-"_apt_consume_short \${match[1]%%($nul$intlevel|$intlevel|)$nul}" \|
+	-'_apt_consume_short ${match[1]%%'"($qnul$intlevel|$intlevel|)$qnul"'}' \|
       /"$short_seq(${(j:|:)short_intlevel})="/
-	-"_apt_consume_short \${match[1]%=}"
+	-'_apt_consume_short ${match[1]%=}'
 	\( /"$word1"/ :"$comp_intlevel" \| /"$nul"/ /"$word"/ :"$comp_intlevel" \) \|
     )
     regex_long_prefix=("$regex_long_prefix[@]"
       /"(${(j:|:)short_intlevel})="/
-	-"_apt_consume_short \${match[1][-2]}"
+	-'_apt_consume_short ${match[1][-2]}'
 	\( /"$word1"/ :"$comp_intlevel" \| /"$nul"/ /"$word"/ :"$comp_intlevel" \) \|
       /"(${(j:|:)short_intlevel})$nul"/
-	-"_apt_consume_short \${match[1][-2]}"
+	-'_apt_consume_short ${match[1][-2]}'
 	/"($intlevel$nul|)"/ :"$comp_intlevel" \|
     )
   fi
@@ -166,15 +167,15 @@
   if (( $#short_configfile )); then
     regex_short=("$regex_short[@]"
       /"$short_seq(${(j:|:)short_configfile})(=|)"/
-	-"_apt_consume_short \${match[1]%=}"
+	-'_apt_consume_short ${match[1]%=}'
 	\( /"$word1"/ :"$comp_configfile" \| /"$nul"/ /"$word"/ :"$comp_configfile" \) \|
     )
     regex_long_prefix=("$regex_long_prefix[@]"
       /"(${(j:|:)short_configfile})$nul"/
-	-"_apt_consume_short \${match[1][-2]}"
+	-'_apt_consume_short ${match[1][-2]}'
 	/"$word"/ :"$comp_configfile" \|
       /"(${(j:|:)short_configfile})="/
-	-"_apt_consume_short \${match[1][-2]}"
+	-'_apt_consume_short ${match[1][-2]}'
 	\( /"$word1"/ :"$comp_configfile" \| /"$nul"/ /"$word"/ :"$comp_configfile" \) \|
     )
   fi
@@ -182,15 +183,15 @@
   if (( $#short_arbitem )); then
     regex_short=("$regex_short[@]"
       /"$short_seq(${(j:|:)short_arbitem})(=|)"/
-	-"_apt_consume_short \${match[1]%=}"
+	-'_apt_consume_short ${match[1]%=}'
 	\( /"$word1"/ :"$comp_arbitem" \| /"$nul"/ /"$word"/ :"$comp_arbitem" \) \|
     )
     regex_long_prefix=("$regex_long_prefix[@]"
       /"(${(j:|:)short_arbitem})$nul"/
-	-"_apt_consume_short \${match[1][-2]}"
+	-'_apt_consume_short ${match[1][-2]}'
 	/"$word"/ :"$comp_arbitem" \|
       /"(${(j:|:)short_arbitem})="/
-	-"_apt_consume_short \${match[1][-2]}"
+	-'_apt_consume_short ${match[1][-2]}'
 	\( /"$word1"/ :"$comp_arbitem" \| /"$nul"/ /"$word"/ :"$comp_arbitem" \) \|
     )
   fi
@@ -198,18 +199,18 @@
   if (( $#long_hasarg )); then
     regex_long=("$regex_long[@]"
       /"(${(j:|:)long_hasarg})$nul"/
-	-"_apt_consume_long \${match[1]%$nul}; current_option=\${canonicalize[--\${match[1]%$nul}]}"
+	-'_apt_consume_long ${match[1]%'$qnul'}; current_option=${canonicalize[--${match[1]%'$qnul'}]}'
 	/"$word"/ :"$comp_hasarg" \|
       /"(${(j:|:)long_hasarg})="/
-	-"_apt_consume_long \${match[1]%=}; current_option=\${canonicalize[--\${match[1]%=}]}"
+	-'_apt_consume_long ${match[1]%=}; current_option=${canonicalize[--${match[1]%=}]}'
 	\( /"$word1"/ :"$comp_hasarg" \| /"$nul"/ /"$word"/ :"$comp_hasarg" \) \|
     )
     regex_long_prefix=("$regex_long_prefix[@]"
       /"(${(j:|:)long_hasarg})$nul"/
-	-"_apt_consume_long \${match[1]%$nul}; current_option=\${canonicalize[--\${match[1]%$nul}]}"
+	-'_apt_consume_long ${match[1]%'$qnul'}; current_option=${canonicalize[--${match[1]%'$qnul'}]}'
 	/"$word"/ :"$comp_hasarg" \|
       /"(${(j:|:)long_hasarg})="/
-	-"_apt_consume_long \${match[1]%=}; current_option=\${canonicalize[--\${match[1]%=}]}"
+	-'_apt_consume_long ${match[1]%=}; current_option=${canonicalize[--${match[1]%=}]}'
 	\( /"$word1"/ :"$comp_hasarg" \| /"$nul"/ /"$word"/ :"$comp_hasarg" \) \|
     )
   fi
@@ -217,18 +218,18 @@
   if (( $#long_bool )); then
     regex_long=("$regex_long[@]"
       /"(${(j:|:)long_bool})="/
-	-"_apt_consume_long xxx \${match[1]%=}"
+	-'_apt_consume_long ${match[1]%=}'
 	\( /"$word1"/ :"$comp_bool" \| /"$nul"/ /"$word"/ :"$comp_bool" \) \|
       /"(${(j:|:)long_bool})$nul"/
-	-"_apt_consume_long \${match[1]%$nul}"
+	-'_apt_consume_long ${match[1]%'$qnul'}'
 	/"((${(j:|:)bool})$nul|)"/ :"$comp_bool" \|
     )
     regex_long_prefix=("$regex_long_prefix[@]"
       /"(${(j:|:)long_bool})="/
-	-"_apt_consume_long \${match[1]%=}"
+	-'_apt_consume_long ${match[1]%=}'
 	\( /"$word1"/ :"$comp_bool" \| /"$nul"/ /"$word"/ :"$comp_bool" \) \|
       /"(${(j:|:)long_bool})$nul"/
-	-"_apt_consume_long \${match[1]%$nul}"
+	-'_apt_consume_long ${match[1]%'$qnul'}'
 	/"((${(j:|:)bool})$nul|)"/ :"$comp_bool" \|
     )
   fi
@@ -236,18 +237,18 @@
   if (( $#long_intlevel )); then
     regex_long=("$regex_long[@]"
       /"(${(j:|:)long_intlevel})="/
-	-"_apt_consume_long \${match[1]%=}"
+	-'_apt_consume_long ${match[1]%=}'
 	\( /"$word1"/ :"$comp_intlevel" \| /"$nul"/ /"$word"/ :"$comp_intlevel" \) \|
       /"(${(j:|:)long_intlevel})$nul"/
-	-"_apt_consume_long \${match[1]%$nul}"
+	-'_apt_consume_long ${match[1]%'$qnul'}'
 	/"($intlevel$nul|)"/ :"$comp_intlevel" \|
     )
     regex_long_prefix=("$regex_long_prefix[@]"
       /"(${(j:|:)long_intlevel})="/
-	-"_apt_consume_long \${match[1]%=}"
+	-'_apt_consume_long ${match[1]%=}'
 	\( /"$word1"/ :"$comp_intlevel" \| /"$nul"/ /"$word"/ :"$comp_intlevel" \) \|
       /"(${(j:|:)long_intlevel})$nul"/
-	-"_apt_consume_long \${match[1]%$nul}"
+	-'_apt_consume_long ${match[1]%'$qnul'}'
 	/"($intlevel$nul|)"/ :"$comp_intlevel" \|
     )
   fi
@@ -255,18 +256,18 @@
   if (( $#long_configfile )); then
     regex_long=("$regex_long[@]"
       /"(${(j:|:)long_configfile})$nul"/
-	-"_apt_consume_long \${match[1]%$nul}"
+	-'_apt_consume_long ${match[1]%'$qnul'}'
 	/"$word"/ :"$comp_configfile" \|
       /"(${(j:|:)long_configfile})="/
-	-"_apt_consume_long \${match[1]%=}"
+	-'_apt_consume_long ${match[1]%=}'
 	\( /"$word1"/ :"$comp_configfile" \| /"$nul"/ /"$word"/ :"$comp_configfile" \) \|
     )
     regex_long_prefix=("$regex_long_prefix[@]"
       /"(${(j:|:)long_configfile})$nul"/
-	-"_apt_consume_long \${match[1]%$nul}"
+	-'_apt_consume_long ${match[1]%'$qnul'}'
 	/"$word"/ :"$comp_configfile" \|
       /"(${(j:|:)long_configfile})="/
-	-"_apt_consume_long \${match[1]%=}"
+	-'_apt_consume_long ${match[1]%=}'
 	\( /"$word1"/ :"$comp_configfile" \| /"$nul"/ /"$word"/ :"$comp_configfile" \) \|
     )
   fi
@@ -274,18 +275,18 @@
   if (( $#long_arbitem )); then
     regex_long=("$regex_long[@]"
       /"(${(j:|:)long_arbitem})$nul"/
-	-"_apt_consume_long \${match[1]%$nul}"
+	-'_apt_consume_long ${match[1]%'$qnul'}'
 	/"$word"/ :"$comp_arbitem" \|
       /"(${(j:|:)long_arbitem})="/
-	-"_apt_consume_long \${match[1]%=}"
+	-'_apt_consume_long ${match[1]%=}'
 	\( /"$word1"/ :"$comp_arbitem" \| /"$nul"/ /"$word"/ :"$comp_arbitem" \) \|
     )
     regex_long_prefix=("$regex_long_prefix[@]"
       /"(${(j:|:)long_arbitem})$nul"/
-	-"_apt_consume_long \${match[1]%$nul}"
+	-'_apt_consume_long ${match[1]%'$qnul'}'
 	/"$word"/ :"$comp_arbitem"/ \|
       /"(${(j:|:)long_arbitem})="/
-	-"_apt_consume_long \${match[1]%=}"
+	-'_apt_consume_long ${match[1]%=}'
 	\( /"$word1"/ :"$comp_arbitem" \| /"$nul"/ /"$word"/ :"$comp_arbitem" \) \|
     )
   fi
-- 
Tanaka Akira



Messages sorted by: Reverse Date, Date, Thread, Author