From 56e1904e45cc474a9858dc1205055008f8c63752 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 25 Mar 2008 17:47:10 +0000 Subject: fix optimisation of string matching with multibyte mode 24732: attempt to provide adequate space for sched ztrftime string with multibyte characters --- Doc/Zsh/params.yo | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'Doc') diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo index 797fc3e0e..48e1838bf 100644 --- a/Doc/Zsh/params.yo +++ b/Doc/Zsh/params.yo @@ -234,16 +234,14 @@ subscript 0; this is empty unless one of the options tt(KSH_ARRAYS) or tt(KSH_ZERO_SUBSCRIPT) is in effect. Note that in subscripts with both `tt(r)' and `tt(R)' pattern characters -are active even if they were substituted for a parameter (regardless -of the setting of tt(GLOB_SUBST) which controls this feature in normal -pattern matching). It is therefore necessary to quote pattern characters -for an exact string match. Given a string in tt($key), and assuming -the tt(EXTENDED_GLOB) option is set, the following is sufficient to -match an element of an array tt($array) containing exactly the value of -tt($key): +are active even if they were substituted for a parameter (regardless of the +setting of tt(GLOB_SUBST) which controls this feature in normal pattern +matching). The flag `tt(e)' can be added to inhibit pattern matching. As +this flag does not inhibit other forms of substitution, care is still +required; using a parameter to hold the key has the desired effect: -example(key2=${key//(#m)[\][+LPAR()+RPAR()\\*?#<>~^]/\\$MATCH} -print ${array[(R)$key2]}) +example(key2='original key' +print ${array[(Re)$key2]}) ) ) item(tt(i))( @@ -286,11 +284,15 @@ evaluates to var(n)). This flag is ignored when the array is associative. The delimiter character tt(:) is arbitrary; see above. ) item(tt(e))( -This flag has no effect and for ordinary arrays is retained for backward -compatibility only. For associative arrays, this flag can be used to -force tt(*) or tt(@) to be interpreted as a single key rather than as a -reference to all values. This flag may be used on the left side of an -assignment. +This flag causes any pattern matching that would be performed on the +subscript to use plain string matching instead. Hence +`tt(${array[(re)*]})' matches only the array element whose value is tt(*). +Note that other forms of substitution such as parameter substitution are +not inhibited. + +This flag can also be used to force tt(*) or tt(@) to be interpreted as +a single key rather than as a reference to all values. It may be used +for either purpose on the left side of an assignment. ) enditem() -- cgit 1.4.1