From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23577 invoked by alias); 14 May 2015 21:24:05 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 35137 Received: (qmail 23433 invoked from network); 14 May 2015 21:23:52 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.2 Message-ID: <5555125E.5070901@case.edu> Date: Thu, 14 May 2015 17:23:42 -0400 From: Chet Ramey Reply-To: chet.ramey@case.edu User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Peter Stephenson , Martijn Dekker , zsh-workers@zsh.org CC: chet.ramey@case.edu Subject: Re: 'case' pattern matching bug with bracket expressions References: <55549FB2.80705@inlv.org> <20150514154238.0e547ff0@pwslap01u.europe.root.pri> In-Reply-To: <20150514154238.0e547ff0@pwslap01u.europe.root.pri> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Junkmail-Status: score=10/50, host=mpv5.cwru.edu X-Junkmail-Whitelist: YES (by domain whitelist at mpv1.tis.cwru.edu) On 5/14/15 10:42 AM, Peter Stephenson wrote: > This is the pattern: > '[' introducing bracketed expression > '] | *[!a-z' characters inside > ']' end of bracketed expression > '*' wildcard. > > so it's a set including the character a followed by anything, and hence > matches. > > I'm not really sure we *can* resolve this unambiguously the way you > want. Is there something that forbids us from interpreting the pattern > that way? Look at the Posix grammar. A case pattern list is a sequence of one or more WORDs separated by (zero or more) `|'s. WORDs are delimited by metacharacters and cannot contain unquoted blanks. The `[]' is a separate WORD delimited by a space. The rules governing how the pattern is treated only come into play after the command is parsed. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/