From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 29537 invoked from network); 7 Jan 2021 15:33:33 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 7 Jan 2021 15:33:33 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1610033613; b=bkt9YFp3sq1qZbWCd3xocqqPZFSphfpDwO4YMaRQ2AqSFjb67QxSwjiVnRovOmq4dM0NY7J8PL 2IcT1JPau4+vP24IhOpJm0Cf9vNWFlBZisptFiNcpjRiNG++REAzpdaQBhIKCBelyibCGliFrG jFmRhwgE4Xcelb0T3I4EKCLGsxQF0flvlnAmdnFtNS55/YmDedNeXNRM5TxvEXKo/wqfa5p3+e +jd71JjDTq6wJOrdm57EXeoE2PB+AVuzPfhKPEUVEKLd4JS5z9Ysldcj5diruwIH3ZAmb7SV6F hjTz8FumIz9wikOHPq3RHJADStFRdl25QN9Co8Yrj/dP+w==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (out2-smtp.messagingengine.com) smtp.remote-ip=66.111.4.26; dkim=pass header.d=daniel.shahaf.name header.s=fm2 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1610033613; bh=+JtizgXdV3n6o43lZeFWmglmqKOUDxg2V5Ddm/FxHHU=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Transfer-Encoding:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:DKIM-Signature: DKIM-Signature:DKIM-Signature; b=NTDHFBe6mC0GU8MAmpX5xPfDYNXDxnZdNz5NGMQaHWFJe41WjgA8TYwrq7WRtBQ6p1Umsd/RZC 05cvczqB9DFGktz1/ajqXK9n3y09zHoxeVSMNgw1e6M0HZBvFt8rgE2/4H8ExYZ3ub/RcLloCp M/fDqXO+VIBblbvB7sGuEkW2FbhRrY3Sn/oaLf+/iTvZX1i5duzA+K8Ru4Gfw8PqJaDzZBgP3E dYHbK2LnHPPDVScgGBbdruUX4hV1nQzTOS84J6qEEH8Gf0c3XZywB+VqX4SBpwJs68gH27YkOQ 4IY6VjTB2SwrLicsOlk3tACw/Zjh8oSqwaahAcusO7MLFg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Transfer-Encoding :Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID; bh=0oonKWbPRQ6aRJtQ0Wn0k4TQh10rpnoHmX1wAUE0ozo=; b=qQuq27Zzh6yMGiS7tjYin1dooZ RUAclLXU7Ap/PW5Y+ALriS+flj+R2Is2lOCOwv6fLLP3qalpvtj4k2jBgsuMe2AgVP7E12mX+KjcB +Lgk1fGa/U32Dw8jEkcnd5yECDLXGg0zF8gZQtN1zktWiE96iYgqCwtv4X6QIXIIM8F6zBOsz8dA+ vTvvZzpOnmn9f7xrwbRusySoJlSSeQ8fBbiPpiR93tv0OhMGkRTSfm+27JBrg8K8P4eyrQx3mRxBc 5ZR98WLuTJNgDdmWbUZGAnhwAMMMo1q2NtNX8DQYrVS0N/0TreBLTuQZHOPZesV0iCAu9SA/TYTjq CEN8nN8A==; Received: from authenticated user by zero.zsh.org with local id 1kxXI3-0008Z5-At; Thu, 07 Jan 2021 15:33:31 +0000 Authentication-Results: zsh.org; iprev=pass (out2-smtp.messagingengine.com) smtp.remote-ip=66.111.4.26; dkim=pass header.d=daniel.shahaf.name header.s=fm2 header.a=rsa-sha256; dkim=pass header.d=messagingengine.com header.s=fm1 header.a=rsa-sha256; dmarc=none header.from=daniel.shahaf.name; arc=none Received: from out2-smtp.messagingengine.com ([66.111.4.26]:49499) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1kxXHQ-0008Bx-Qu; Thu, 07 Jan 2021 15:32:54 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 354075C0140; Thu, 7 Jan 2021 10:32:51 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Thu, 07 Jan 2021 10:32:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=date:from:to:cc:subject:message-id :references:mime-version:content-type:content-transfer-encoding :in-reply-to; s=fm2; bh=0oonKWbPRQ6aRJtQ0Wn0k4TQh10rpnoHmX1wAUE0 ozo=; b=QqLl0Vtok3mIVg3PS/QnKpE9XUDJtmKkNWFXKZz63lDfeST+tA71AwFU KTF6SkXuVit8Pa4FL99hmyySW22D8+XaxNGjPbEGDypIo4fBjDwybfgiHC8By7x+ DtjnIFKa9GI0f6ubKyPiJiTBBe72KGSVCmIghSpcKInhT5uliQETuwqiVlkHYmmb 4j2EgGMxzxGHl1NdjsPYaQ0PzTT+1/5QX6dCPXLdFxCmMaWYOn3L0ck7JUL7dAsd 0KANh6Vu8c6FbzazH3mRyXo717xIx4Ay1WaqyCo1P8fTLc9GyGdZSnkR5v0KZeL5 GECxJ0VKKPoXDu7ZnaPHU20BSB2bnA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=0oonKWbPRQ6aRJtQ0Wn0k4TQh10rpnoHmX1wAUE0o zo=; b=bczEZ2c/4PFiqmjezkQYewv5Glmp0VMZoK6aqyddAX5zw655zei1hJHSg kSkFEweKLMK7T7jD3vZUbLroptmJTgSbMvb/VgbhEc9pfMLpZJ6k6VXdgn9f4CbO 9Nb+V3PGIz9Qvfi9acGMn0dLPV/R+n7+oZR6DcR/mOvL9yCgmhz0r4YF/jrTId0H RekIkfkEOnR5rD6EjSY9MK+y1dxpUR+yP3QTH8IM/1cmMK3HMm1FBqx5sDuTu0hY 8aZlE8mZ7OPXXTSVjKeu6PDVPiUKFDT67EX6nf9oFrF6VNpywzqMQoSBZ3E3yfHv 6NG42AsyhRaFu5Rn35hmbaJAKF2wQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdegvddgjeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtugfgjggfsehtkedttddtredunecuhfhrohhmpeffrghn ihgvlhcuufhhrghhrghfuceougdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgrmhgvqe enucggtffrrghtthgvrhhnpefgleehtdffuefhgeeuleefffejgedttdelhedvvdeuiefh vefgvdfghfevvdekteenucfkphepjeelrddukedvrdehiedrjeegnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepugdrshesuggrnhhivghlrdhs hhgrhhgrfhdrnhgrmhgv X-ME-Proxy: Received: from tarpaulin.shahaf.local2 (bzq-79-182-56-74.red.bezeqint.net [79.182.56.74]) by mail.messagingengine.com (Postfix) with ESMTPA id 9C9D324005B; Thu, 7 Jan 2021 10:32:50 -0500 (EST) Received: by tarpaulin.shahaf.local2 (Postfix, from userid 1005) id 4DBVc032zhz31w; Thu, 7 Jan 2021 15:32:48 +0000 (UTC) Date: Thu, 7 Jan 2021 15:32:48 +0000 From: Daniel Shahaf To: Ray Andrews Cc: zsh-users@zsh.org Subject: Re: here document within a switch fails to parse. Message-ID: <20210107153248.GA25249@tarpaulin.shahaf.local2> References: <2bc17f94-91c0-429d-bdea-e39926dc083d@www.fastmail.com> <4fa2a8d0-d5e5-90e0-b331-e7a149ec9af8@eastlink.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Seq: 26342 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: Ray Andrews wrote on Wed, Jan 06, 2021 at 23:55:59 -0800: > On 2021-01-06 11:18 a.m., Bart Schaefer wrote: > > On Wed, Jan 6, 2021 at 9:17 AM Ray Andrews wrote: > > > Still I'd expect the here document > > > to be simply removed before parsing. > > Think again about what you just wrote? > > > > The parser is what determines where the here document begins and ends; > > parsing IS what removes it. > > > Well yes.  I should have said that I'd expect it to be removed at the same > level that comments are removed. Perhaps as Lawrence says this is not a good > way to make comment blocks but apart from the one issue above, it seems > entirely workable. Do consider treating the language as the independent variable and your expectations as the dependent one, rather than the other way around. The syntax means what it means, not what you wish it meant. Heredocs are string literals and input redirections, not comments. They don't get "removed". (Just try «:() { nl "$@" }».) The syntax is stateful. Heredocs aren't valid everywhere in the shell grammar, just like the contraction "aren't" aren't valid everywhere in English grammar. The construct you use has side-effects you've overlooked, which mean your fashion of comments will backfire in a way that you don't see yet. You really should stick to writing idiomatic code. (-workers@: Ray's fashion of comments resets lastval.) Do you see why the error message I quoted upthread complained about the semicolon and not about something else? And why «repeat dpkg-query --list zsh» does what it does? By the way, I wonder if the reason we're having this thread is that it hasn't occurred to you that your $EDITOR may have facilities for commenting or uncommenting multiple lines. Daniel