From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12655 invoked by alias); 15 Oct 2017 18:09:48 -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: List-Unsubscribe: X-Seq: 41902 Received: (qmail 25684 invoked by uid 1010); 15 Oct 2017 18:09:48 -0000 X-Qmail-Scanner-Diagnostics: from mail-pg0-f52.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(74.125.83.52):SA:0(-1.9/5.0):. Processed in 1.09896 secs); 15 Oct 2017 18:09:48 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | 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; bh=ESGqpfkoh09sOqZrhpcp2kln4o591UtwnK3f/ZdnUjE=; b=b8hu/KjSYH3DLCSiGBMTPSH9ylwVnujuyzoIDwk64TEX4jEf/TvVMM7ICdjk/DtnMd ZpzodWDRiToJfb+3BRkq2dOa/VnYWsyQqBYmp9bZEk5IPesC7l+ghejkFzXDUv9ci1KH HIHqj1MGqByQ67eehLKp7e+aPHI1wkThKkRmEeTLHv87WCUECULDXy97VXvkEBAWK49z THLBRLM46E7EOCG26bI/++ScrV22CnhDVPI4IZzQtAt1ZHRTvMfaB/Kz0layHkvCKdGA x0VcIBl8zbANE/rVcJiB5kbynbjDzTYOefUVe0c1yJiE5Yuz/m8/AI4NNmhieS+CYabp ijxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=ESGqpfkoh09sOqZrhpcp2kln4o591UtwnK3f/ZdnUjE=; b=l5Nj98Mfxg9re4231MzCexoHLUtaWHvKXT7ea1gFTkbDJkLok8vojgncPj4TUuJkh5 PWLgkx3egh+umESDtZvl3ofhk2Hn96i7mwLfaJz5v8KGu6duFxxicXYsAEaE1R/htlB7 JQSEHYMBBe5LfSkym/8YJVnJtAtlA+e1ndPSeIDsR8e5r9QEUKqV9ccG0vac3rKSEH04 vj5ZxTPpi97GjjsiyxfF1tN24LNzLP84nuKzvW7Fxs6+no1pJNXH/VEzzX1oOf/YGKtd kDjeekvpJFzL5lU1UbYMAGxQlB9Mz8/hymV2rVc5p7ALsF+GiKqXMTlyOhsSE1BvYG1w FPxw== X-Gm-Message-State: AMCzsaV78tRgRzjTi2Hz8reeFaXY2CS7fNSqUNU/ZnQuJv/hZxRvGE6y raDugrha2OmB/V3V1fzRM1GxGhV6 X-Google-Smtp-Source: AOwi7QBDck/0b00mf/VpAr1sbdDM4J1oSAq1+9/BH/O+xwbjA0z8MdtaxFMcIWXEHYqZr3WJYD3x4Q== X-Received: by 10.84.178.164 with SMTP id z33mr6698076plb.333.1508090983976; Sun, 15 Oct 2017 11:09:43 -0700 (PDT) From: Bart Schaefer Message-Id: <171015110946.ZM4359@torch.brasslantern.com> Date: Sun, 15 Oct 2017 11:09:46 -0700 In-Reply-To: Comments: In reply to Sebastian Gniazdowski "Re: [BUG] In reference to patch 39815, about (z) flag and $( parse error" (Oct 15, 4:31pm) References: <171011100231.ZM3821@torch.brasslantern.com> <20171012165053.7cf67aa2@pwslap01u.europe.root.pri> <20171013103622.1d920b14@pwslap01u.europe.root.pri> <171013135510.ZM12458@torch.brasslantern.com> <171014185301.ZM3708@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: "zsh-workers@zsh.org" Subject: Re: [BUG] In reference to patch 39815, about (z) flag and $( parse error MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Oct 15, 4:31pm, Sebastian Gniazdowski wrote: } } It's rather not a bug after all. The cause is an apostrophe in comment. } } # ' } () { } au_arr+=(expand-absolute-path up-line-or-beginning-search) } } Interesting. This points out a different issue: torch% setopt cshjunkiequotes torch% printf '<%s>\n' ${(z)buf} <#> <'> torch% Should the parse abort there? Other parse errors don't cause (z) to fail when cshjunkiequotes is not set. (At least it should not abort silently, but (z) suppresses parse error messages.) If the parse should not abort, should it act as if cshjunkiequotes were not set, or should it treat the line from the quote to the end as a STRING token and then resume parsing on the next line? The patch below implements that latter. diff --git a/Src/lex.c b/Src/lex.c index e0190af..c2a5966 100644 --- a/Src/lex.c +++ b/Src/lex.c @@ -1291,7 +1291,9 @@ gettokstr(int c, int sub) ALLOWHIST if (c != '\'') { unmatched = '\''; - peek = LEXERR; + /* Not an error when called from bufferwords() */ + if (!(lexflags & LEXFLAGS_ACTIVE)) + peek = LEXERR; cmdpop(); goto brk; } @@ -1313,7 +1315,9 @@ gettokstr(int c, int sub) cmdpop(); if (c) { unmatched = '"'; - peek = LEXERR; + /* Not an error when called from bufferwords() */ + if (!(lexflags & LEXFLAGS_ACTIVE)) + peek = LEXERR; goto brk; } c = Dnull; @@ -1350,7 +1354,9 @@ gettokstr(int c, int sub) cmdpop(); if (c != '`') { unmatched = '`'; - peek = LEXERR; + /* Not an error when called from bufferwords() */ + if (!(lexflags & LEXFLAGS_ACTIVE)) + peek = LEXERR; goto brk; } c = Tick; @@ -1392,7 +1398,7 @@ gettokstr(int c, int sub) return LEXERR; } hungetc(c); - if (unmatched) + if (unmatched && !(lexflags & LEXFLAGS_ACTIVE)) zerr("unmatched %c", unmatched); if (in_brace_param) { while(bct-- >= in_brace_param)