From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9102 invoked from network); 5 Oct 2001 16:15:42 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 5 Oct 2001 16:15:42 -0000 Received: (qmail 13081 invoked by alias); 5 Oct 2001 16:15:10 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 4341 Received: (qmail 13061 invoked from network); 5 Oct 2001 16:15:08 -0000 From: Bart Schaefer Message-Id: <1011005161336.ZM32521@candle.brasslantern.com> Date: Fri, 5 Oct 2001 16:13:35 +0000 In-Reply-To: <20011004004307.C18930@astaroth.sweth.net> Comments: In reply to Sweth Chandramouli "Re: compctl -g not working" (Oct 4, 12:43am) References: <20011002225307.A13954@astaroth.sweth.net> <87adz976ru.fsf@ceramic.fifi.org> <20011002231841.B14325@astaroth.sweth.net> <1011003040449.ZM25370@candle.brasslantern.com> <20011003001256.B14675@astaroth.sweth.net> <1011003060441.ZM25764@candle.brasslantern.com> <20011003021524.A15356@astaroth.sweth.net> <1011003162422.ZM29481@candle.brasslantern.com> <20011003142330.A16765@astaroth.sweth.net> <1011004042305.ZM30162@candle.brasslantern.com> <20011004004307.C18930@astaroth.sweth.net> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-users@sunsite.dk Subject: Re: compctl -g not working MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Oct 4, 12:43am, Sweth Chandramouli wrote: } } > SH_GLOB } > Disables the special meaning of `(', `|', `)' and '<' for globbing } > the result of parameter and command substitutions, and in some } > other places where the shell accepts patterns. This option is } > set by default if zsh is invoked as sh or ksh. } > } > One of the "some other places" is in compctl expressions. } } (What are the odds of the manpage getting updated to note that "some } other places" includes compctl -g, but not compctl -s, and the fact } that BARE_GLOB_QUAL overrides KSH_GLOB?) I don't think it'd be appropriate to mention compctl specifically in the doc for SH_GLOB, but see below. BARE_GLOB_QUAL overrides everything else having to do with paren tokens when they appear at the end of words -- it actually works by parsing the pattern "backwards" when the final character is a close-paren token -- and is (sometimes) defeated by SH_GLOB only because that prevents the parens from ever being tokenized in the first place. Which is how we get into the "some other places" situation. The lexer knows whether or not it is in parameter or command substitution and so does not apply SH_GLOB to "ordinary" glob patterns. However, strings that are originally parsed as quoted and then later converted into a glob pattern are (usually) not passed through the lexer again -- they go through a different tokenizer that always applies SH_GLOB. The reason that "some other places" does not include `compctl -s' is because -s actually *does* pass the string through the lexer again, whereas -g passes it only through the tokenizer. So the questions (hey, zsh-workers) are: Should we fix `compctl -g' so that it behaves like "ordinary" globbing? (I have a suggested implementation that I won't go into here.) Should we make BARE_GLOB_QUAL a bit smarter so that it knows about KSH_GLOB and looks back one more character to see if what precedes the open-paren token is one of the ksh-glob-chars? (It already treats a `|' inside the parens as indicative of a glob alternation rather than a list of qualifiers.) -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net