From 75cafccc0a11493ce669a6372d57ef89a801b189 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sun, 31 May 2015 16:39:22 +0100 Subject: 35343: Avoid $#name length handling for POSIX_IDENTIFIERS --- Doc/Zsh/expn.yo | 7 +++++++ Doc/Zsh/options.yo | 7 +++++++ 2 files changed, 14 insertions(+) (limited to 'Doc') diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo index afd6b1ff9..7d4e6fccb 100644 --- a/Doc/Zsh/expn.yo +++ b/Doc/Zsh/expn.yo @@ -777,6 +777,13 @@ This has the side-effect that joining is skipped even in quoted forms, which may affect other sub-expressions in var(spec). Note that `tt(^)', `tt(=)', and `tt(~)', below, must appear to the left of `tt(#)' when these forms are combined. + +If the option tt(POSIX_IDENTIFIERS) is not set, and var(spec) is a +simple name, then the braces are optional; this is true even +for special parameters so e.g. tt($#-) and tt($#*) take the length +of the string tt($-) and the array tt($*) respectively. If +tt(POSIX_IDENTIFIERS) is set, then braces are required for +the tt(#) to be treated in this fashion. ) item(tt(${^)var(spec)tt(}))( pindex(RC_EXPAND_PARAM, toggle) diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo index 4c0ae122f..4dd68c9cb 100644 --- a/Doc/Zsh/options.yo +++ b/Doc/Zsh/options.yo @@ -2054,6 +2054,13 @@ When this option is set, only the ASCII characters tt(a) to tt(z), tt(A) to tt(Z), tt(0) to tt(9) and tt(_) may be used in identifiers (names of shell parameters and modules). +In addition, setting this option limits the effect of parameter +substitution with no braces, so that the expression tt($#) is treated as +the parameter tt($#) even if followed by a valid parameter name. +When it is unset, zsh allows expresions of the form tt($#)var(name) +to refer to the length of tt($)var(name), even for special variables, +for example in expressions such as tt($#-) and tt($#*). + When the option is unset and multibyte character support is enabled (i.e. it is compiled in and the option tt(MULTIBYTE) is set), then additionally any alphanumeric characters in the local character set may be used in -- cgit 1.4.1