1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-25 17:41:19 +02:00

35250: Fix case documentation (SH_GLOB)

This commit is contained in:
Peter Stephenson 2015-05-21 10:43:32 +01:00
parent afb78f5d14
commit a95f2c6071
3 changed files with 15 additions and 7 deletions

View file

@ -1,5 +1,7 @@
2015-05-21 Peter Stephenson <p.stephenson@samsung.com> 2015-05-21 Peter Stephenson <p.stephenson@samsung.com>
* 35250: Doc/Zsh/grammar.yo: fix case documentation (SH_GLOB).
* 35248: Src/lex.c, Src/parse.c, Test/A01grammar.ztst: * 35248: Src/lex.c, Src/parse.c, Test/A01grammar.ztst:
treat fully parenthesised zsh patterns as complete treat fully parenthesised zsh patterns as complete
case patterns again. case patterns again.

View file

@ -239,11 +239,17 @@ item(tt(case) var(word) tt(in) [ [tt(LPAR())] var(pattern) [ tt(|) var(pattern)
Execute the var(list) associated with the first var(pattern) Execute the var(list) associated with the first var(pattern)
that matches var(word), if any. The form of the patterns that matches var(word), if any. The form of the patterns
is the same as that used for filename generation. See is the same as that used for filename generation. See
noderef(Filename Generation). Note further that the whole noderef(Filename Generation).
pattern with alternatives is treated by the shell as equivalent
to a group of patterns within parentheses, even though in Note further that, unless the tt(SH_GLOB) option is set, the whole
the tt(case) syntax whitespace may appear about the parentheses and the pattern with alternatives is treated by the shell as equivalent to a
vertical bar. group of patterns within parentheses, although white space may appear
about the parentheses and the vertical bar and will be stripped from the
pattern at those points. White space may appear elsewhere in the
pattern; this is not stripped. If the tt(SH_GLOB) option is set, so
that an opening parenthesis can be unambiguously treated as part of the
case syntax, the expression is parsed into separate words and these are
treated as strict alternatives (as in other shells).
If the var(list) that is executed is terminated with tt(;&) rather than If the var(list) that is executed is terminated with tt(;&) rather than
tt(;;), the following list is also executed. The rule for tt(;;), the following list is also executed. The rule for

View file

@ -1183,7 +1183,7 @@ par_case(int *cmplx)
* *
* The next token we get may be * The next token we get may be
* - ")" or "|" if we're looking at an honest-to-god * - ")" or "|" if we're looking at an honest-to-god
* "case" patten, either because there's no opening * "case" pattern, either because there's no opening
* parenthesis, or because SH_GLOB is set and we * parenthesis, or because SH_GLOB is set and we
* managed to grab an initial "(" to mark the start * managed to grab an initial "(" to mark the start
* of the case pattern. * of the case pattern.
@ -1196,7 +1196,7 @@ par_case(int *cmplx)
* the string, so may be separated by whitespace. * the string, so may be separated by whitespace.
* So we quietly massage the whitespace and hope * So we quietly massage the whitespace and hope
* no one noticed. This is horrible, but it's * no one noticed. This is horrible, but it's
* unfortunately too difficult to comine traditional * unfortunately too difficult to combine traditional
* zsh patterns with a properly parsed case pattern * zsh patterns with a properly parsed case pattern
* without generating incompatibilities which aren't * without generating incompatibilities which aren't
* all that popular (I've discovered). * all that popular (I've discovered).