From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20390 invoked by alias); 19 Jan 2016 00:32:35 -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: 37682 Received: (qmail 26174 invoked from network); 19 Jan 2016 00:32:33 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version:content-type; bh=f9ULUGkaMlNRFTJnLFRCWtPO/TjOaLk/k15fGKgp5tI=; b=BN4/abIkbsViF2rkvg6+gr7TlIPCjteUbQLJERPCaNin50zte4vgjyFaRyEbfDu9VH we9MGNZm8B4tVCPM7jrN/x4oyFSA6W6FZ4r0XBte9cVUabYVLITcS9BeDT88BAAXrDHQ x9i7KFzgzO0AFA/LdFX9kizdS5erMUKvqNVM1FvD/8nK08KjTg6NKhp7YL2XcjGfB/8U V5RFZnbHPEgSe5qhj6h7yTd3LDOYtjXVoeGVc1Uep/Af+e5MMIgfEvNW8DiT0xIAerpp LQXAdiFOZPHjEFguTabgzpQ/x+RIsOF1bISVrwwrJWjChOGxnN+lnDiZMvNCNlN2Dm9h WCOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=f9ULUGkaMlNRFTJnLFRCWtPO/TjOaLk/k15fGKgp5tI=; b=XtDnoYP+5UNEDJc6U1gjyu0ew1pE92wlV7MXjHgDbTfR4oeBcmo8KNO/fN2EfhQmWH KBvYUpGZ7NKD3pJc7dIzrPrL2cUTO08PK7Oh7mCO43Al85JFk8Vy85iHoV8VpOGGUq3z 8h++HAtqSnjDg29+acBc2rekzM6tETUsgM3/IZSFUPS3MMHZ8H7WyRjc8huNDdtFVnJN jCPzgslAnRDFXMrX86fMtfNIfmj2xI/YKPKVrZpFhjmCgVKsylFpTTJ1Y5RAgmJuzS23 pLxv21BqrilERhSScjmOnI+rMIj8Chmt8NYSSwIXju1GP2phKKVP0gyVPF3tKH4Nvqyv 1zKA== X-Gm-Message-State: ALoCoQmc7JGd2kk/Tvv+pXuvxN92UXHZuoCG03NEBt3JjNBVmzdRadrkcLUVfzAdHSXAj8VntgqJoerqtyCulx7CBCqhjcCblQ== X-Received: by 10.98.72.72 with SMTP id v69mr40434767pfa.100.1453163548920; Mon, 18 Jan 2016 16:32:28 -0800 (PST) From: Bart Schaefer Message-Id: <160118163255.ZM3369@torch.brasslantern.com> Date: Mon, 18 Jan 2016 16:32:55 -0800 In-Reply-To: <20160118165237.11b1349a@pwslap01u.europe.root.pri> Comments: In reply to Peter Stephenson "Re: bufferwords() lexes a subshell in a shortloop repeat as a string" (Jan 18, 4:52pm) References: <20160115062648.GA14019@tarsus.local2> <20160115094117.5fcde75c@pwslap01u.europe.root.pri> <160115112516.ZM21347@torch.brasslantern.com> <20160117181647.49899357@ntlworld.com> <160117144635.ZM3583@torch.brasslantern.com> <20160118094129.260a60ae@pwslap01u.europe.root.pri> <160118083658.ZM6465@torch.brasslantern.com> <20160118165237.11b1349a@pwslap01u.europe.root.pri> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: bufferwords() lexes a subshell in a shortloop repeat as a string MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jan 18, 4:52pm, Peter Stephenson wrote: } Subject: Re: bufferwords() lexes a subshell in a shortloop repeat as a str } } On Mon, 18 Jan 2016 08:36:58 -0800 } Bart Schaefer wrote: } > print -l one (two three|foo) four } } I was trying it with the (z) flag, which does cause the word to be } split up, not directly at the command line, where I get what you get. } } I don't know why they'd be different, offhand. Seems to be that parameter substitution applies shwordsplit before (z) gets involved, so we have separate calls to bufferwords() for each of "one", "(two", "three|foo)" and "four". Directly at command line, gettok() returns "\210two three\216four\212". Does the below look correct? schaefer[573] ARGV0=sh Src/zsh -f $ print one (two three|four) five zsh: parse error near `(' $ diff --git a/Src/lex.c b/Src/lex.c index 0f260d0..c21ef2d 100644 --- a/Src/lex.c +++ b/Src/lex.c @@ -801,7 +801,7 @@ gettok(void) return INOUTPAR; hungetc(d); lexstop = 0; - if (!(incond == 1 || incmdpos)) + if (!(isset(SHGLOB) || incond == 1 || incmdpos)) break; return INPAR; case LX1_OUTPAR: Aside: "emulate sh" does the equivalent of setopt shglob noglob nokshglob In order to make kshglob work, one must setopt glob kshglob Is that correct, or should only kshglob be needed?