From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 43 invoked by alias); 13 Oct 2017 07:57:01 -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: 41873 Received: (qmail 9406 invoked by uid 1010); 13 Oct 2017 07:57:01 -0000 X-Qmail-Scanner-Diagnostics: from mail-qk0-f175.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(209.85.220.175):SA:0(-4.2/5.0):. Processed in 2.54652 secs); 13 Oct 2017 07:57:01 -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=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_SORBS_SPAM,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=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=YI2n2GJhVHzLfavYkLF6fmXVOo30EK+jd810AtWKBcc=; b=NXHfBznMxLz3fMqE7kT2KUKqu9s0BTOHTwiUKi2/7GwNRFTYeSWRXm44041rYg4nWR ergJN0smsMNsmJqDCly3PtU1a4UFV1740Ce3sYj2gzAuSHv1Rks+45aGm4UWhw7lU2TB GaWUG+3bBeA2bsTPLR+INgV3WxDa2PHWWd0UmzSCs5PpI28aD9Jxb9hAQyGcQ2NKGTGE Lt1+CkkKR7e4mVYILW46a1k1SvHZTh8RZLiKt4oueMrzdG/KzEVSpCDPbKqt5cbBKCly yMG8VmW/Lq7KiUTxQWUlVQz7LVUm97iVzqmL/db+GP3t/9peuzCwq5Wlx0o5/jYxXj0+ 7QSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=YI2n2GJhVHzLfavYkLF6fmXVOo30EK+jd810AtWKBcc=; b=uAq3QTMbHwLpyt3jtWiQ/YgAO2lvw2DOfVO0ZKAxSTFrxfU6UETGS9b+fSPJo6RMQ1 9qKPdyEseVz9EA7L6B+oNPpK7Fq8TEp0usfBPz3eoe0SrKvhKdc84O9OHtc1hG+4APUz O59XEl/orkhMBPW6+ytunL/xKoQKQjanaUdw+BnJMpqZ5dj490TTT37Yw9rIqA/G4IdR vHhPxApIwbDRKuNZ5H9CuLYvPAOz01ZfhI+14Y5MC56wBXhpw1XgVevrIJ8qFFGa7jW1 Mp/aQS4rojrvdNC/2IzekZqZJQ1WDN51jvIUohFVG/KSNlSLoICcsjQ6/Italx2SJqNV vJOw== X-Gm-Message-State: AMCzsaXvK/11071QyiVhuUsPoZQuyRlY9Tbfp58+BNEO5mdHlAM4xNlg Yz3+IkLGJs7dvd7lxBhZtm3E7IP4IkyhoeoMTcU96G3w X-Google-Smtp-Source: ABhQp+TKq4XDr0xrG4SivGw2Ko9khFOvOcZMi1tWX0dM6nTQH0RU+UQSYSdJVvE07mwEtUpARAZk0eShyxo/l8ohhyQ= X-Received: by 10.55.97.202 with SMTP id v193mr713325qkb.165.1507881414194; Fri, 13 Oct 2017 00:56:54 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20171012165053.7cf67aa2@pwslap01u.europe.root.pri> References: <171011100231.ZM3821@torch.brasslantern.com> <20171012165053.7cf67aa2@pwslap01u.europe.root.pri> From: Bart Schaefer Date: Fri, 13 Oct 2017 00:56:53 -0700 Message-ID: Subject: Re: [BUG] In reference to patch 39815, about (z) flag and $( parse error To: "zsh-workers@zsh.org" Content-Type: text/plain; charset="UTF-8" On Thu, Oct 12, 2017 at 8:50 AM, Peter Stephenson wrote: > On Thu, 12 Oct 2017 08:26:35 -0700 > Bart Schaefer wrote: >> It'd most likely need to be in bufferwords(), which somehow needs to >> know that the STRING token returned from the lexer is [or not] a >> comment > > The traditional fix for this is a hacky state variable. After beating my head against this for a while and observing confusingly different (and sometimes confusingly NOT different) behavior with various attempts to track whether we were scanning comment or code, I finally went back to the original commit c0d01a6f, and realized that it rewrote skipcomm() which is called from down in the guts of gettok() via gettokstr(). After I got there it became ridiculously easy. (As they say, a $1000 job -- $1 for the missing screw, $999 for knowing where to put it.) diff --git a/Src/lex.c b/Src/lex.c index 8493d47..e0190af 100644 --- a/Src/lex.c +++ b/Src/lex.c @@ -2128,8 +2128,12 @@ skipcomm(void) * function at the history layer --- this is consistent with the * intention of maintaining the history and input layers across * the recursive parsing. + * + * Also turn off LEXFLAGS_NEWLINE because this is already skipping + * across the entire construct, and parse_event() needs embedded + * newlines to be "real" when looking for the OUTPAR token. */ - lexflags &= ~LEXFLAGS_ZLE; + lexflags &= ~(LEXFLAGS_ZLE|LEXFLAGS_NEWLINE); dbparens = 0; /* restored by zcontext_restore_partial() */ if (!parse_event(OUTPAR) || tok != OUTPAR) {