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 31306 invoked from network); 6 Jan 2021 16:21:00 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 6 Jan 2021 16:21:00 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1609950060; b=UztMH5+qhvoqwhi2JLpQgzKw8wvyUuLiQ3zM5cXrXqN3tWobuplq7YWnYcQCKv4UR68mWAnVnn efkqH14o6ti9jvIIWgRRlu1Eur1z1B1EW6XsYlAp80O9P1jPw0gV5ZqyM1g5nuWIn51OwcsG+e LEM+GXR3earNyClo71BWviPx8nGucaGWnRrlKtRXg17N0Mhx6lfcdDrzxpl73+U9QYkrAlKNoW A42jyszt8MVNKRHwvSZ80sEU1AAU+DUegXqGDyPg5af35GMjJiT8rcpGbruIX5o7MHUbwlzsJa LXHrPSCTdOYqEQzcU4r01bhKRdn4USlT4Ll20lYK9HN3Kg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (out5-smtp.messagingengine.com) smtp.remote-ip=66.111.4.29; 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=1609950060; bh=pL8rRXe8M091N0Wf2wPLb/b+OfOkviIJAag9XdbCq/4=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:Subject:To:From:Date: References:In-Reply-To:Message-ID:MIME-Version:DKIM-Signature: DKIM-Signature:DKIM-Signature; b=ES38+fZX2eMBU35dukJnYQ+hN7VtEwofhIw3SPDyRJzgK8Jc+Iu5hfX0Nn3Aqgq6t0jquqdymi k1VeX8pca4mXWuIMr/XDdFBWtTewhZ3fNq2WFtWwIH1Jp0Uvgds9l9BMZlMO8/eODLKfOX62A7 BGYrwmFs6QEJJaWbr6KMBMx9pOp/esJlDxHC6rXwMI3rUnViX+udYl63t2hvspad5QxTIdZXO0 Q8mQ4O9VUqMhtm+l6Z2j3qd6qalojgifVGQux9WgofpPU6yZ9PHvA8fC7/vpFf9DHNabWDBy2F pKmSsnSpTXL7P1L0yUgAQKW6vjOPScBEQWH+L06TEmSchQ==; 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:Content-Transfer-Encoding: Content-Type:Subject:To:From:Date:References:In-Reply-To:Message-Id: Mime-Version:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=xuRye5Rxjzty+fOD4UhABN5G+DLWh0n9OVHsLL0woGc=; b=i3wQZXnrbNrTqeTFPi8iHubLkb ddeYARixauAGk6XaGBHxgEl1Q2Zmr3+ELSCXWy0r1Lfp8EgOVnhpIxEjcSuzPq9OIQJJKQqYR1rxA GMOlyu7FsD0oWLGsxiRMj2pOfsW3dbpzNYRHCugNTt2UB3uk5Ia4cbKu0qExDm0wgWxuKtviQHYq8 UfxxmtB++zIuAxT5kaoBz1XXxBGnkwywFf+tRB8JkWguFnwe+6M3H+1hSsE8CnWg2+KHgbZBDJags 3z9+1GfSh1/fSBww//PiLmvZ4aPeedLpsXygT6oVg69PlNONOE7a8qom/rJeQbN+ciYXcBHoHRVg5 giMNqaxQ==; Received: from authenticated user by zero.zsh.org with local id 1kxBYN-000Lyv-Oh; Wed, 06 Jan 2021 16:20:55 +0000 Authentication-Results: zsh.org; iprev=pass (out5-smtp.messagingengine.com) smtp.remote-ip=66.111.4.29; 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 out5-smtp.messagingengine.com ([66.111.4.29]:55437) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1kxBXq-000LbW-EU; Wed, 06 Jan 2021 16:20:23 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 8E9945C0170; Wed, 6 Jan 2021 11:20:21 -0500 (EST) Received: from imap37 ([10.202.2.87]) by compute3.internal (MEProxy); Wed, 06 Jan 2021 11:20:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=mime-version:message-id:in-reply-to :references:date:from:to:subject:content-type :content-transfer-encoding; s=fm2; bh=xuRye5Rxjzty+fOD4UhABN5G+D LWh0n9OVHsLL0woGc=; b=QozA23CT6IZ5W3Ldju+ysYf6CTKEevitOwigRjy+CQ gcRsSZq0FZHPBJm+vtLxxc+0u2hVNtaOfyVrqD2mvz6nZzt3pfphj1ParX0zxGvW kkosRvGSOtPRq1VX2GLUB1PweBjS8zTrNBZv24SrFIqSdoC6KBh/PpjEZXgJoHaK fU6pJz/yXt2mggLtANaXTEV/r59/kNGyE1DjRoafU4w18WGvNaN29LXjpUixgpU2 MnjAVOJsG/ZCaNMtW1rVoEvXWzyIDxeXrJmumw399vX9l9BASDIY7EkiNyOYFna5 taXYdQCk9mvVKHM9wlasWOkGaiJSrWpE5Q/Xo+W5Re5A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=xuRye5Rxjzty+fOD4UhABN5G+DLWh0n9OVHsLL0wo Gc=; b=ksLmYkCPm/Nl7YGsG8qRBrth/zBM/EKlGnWC85ePIbF+AZfzXpEKlkKKo Rzh5N/M2FR4W58QWImcjOocy2qKW4CCOYk/xjtIBSYxXNjsS5pu2Dles1y0eHbjf hgIS+SkY5bXcbySsuRUKYRqsk3pVgVsZFlJ+j/8Ri9xQilVeSFjUwlYGQ1THXYnc KXa75X/E/d/A1hFBJ4opllz7MmQREZ/MsueJhPzP2+rBGze0P0EQSB2PgIPEm9M6 KrdiFufJg8/PiUV9BXqS7UjPKlWM6G/MhWZQsZvMQxX98+Emoxm+yEfvvVXK4OeC MrnHix6NT9zv1klaqPQr7aB/cGl2g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdefledgjeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgfgsehtqhertderreejnecuhfhrohhmpedfffgr nhhivghlucfuhhgrhhgrfhdfuceougdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgrmh gvqeenucggtffrrghtthgvrhhnpeefhfekfeevieelleehiefftdekudejledvhfdtjedt geegvdeuffefleehhfdvgfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmh grihhlfhhrohhmpegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghmvg X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 470071900078; Wed, 6 Jan 2021 11:20:21 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.3.1-61-gb52c239-fm-20201210.001-gb52c2396 Mime-Version: 1.0 Message-Id: <2bc17f94-91c0-429d-bdea-e39926dc083d@www.fastmail.com> In-Reply-To: References: Date: Wed, 06 Jan 2021 16:20:00 +0000 From: "Daniel Shahaf" To: "Ray Andrews" , "Zsh Users" Subject: Re: here document within a switch fails to parse. Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Seq: 26336 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, 06 Jan 2021 15:13 +00:00: > function test1 () > { > : <<'ENDCOM'=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0 =C2=A0=C2=A0=C2=A0 = # No problems here with either ending #1 or #2 > echo "Bad Idea!" =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 # Some commente= d code. > ENDCOM=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2= =A0 =C2=A0=C2=A0=C2=A0 # Ending #1: comment-out one line ok. > =C2=A0=C2=A0=C2=A0 case ${1} in > =C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0n ) echo en ;; > #: <<'ENDCOM'=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0= # This pair: "parse error near `\n'" > #ENDCOM > =C2=A0=C2=A0=C2=A0 esac > #ENDCOM=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 # Ending #2: comment-out most of function ok. > echo "What's goin' on?" > } >=20 > ... So it seemed that a case statement won't tolerate a here document=20= > within itself. But then there's this, which parses fine: >=20 > function test2 () > { > =C2=A0=C2=A0=C2=A0 case ${1} in > =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 n ) echo en ;; >=20 > =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 v ) > : <<'ENDCOM'=C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 #= But this pair works fine. > =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 echo "BAD!"=C2=A0 = # Some commented code > ENDCOM > =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0=C2=A0 =C2=A0=C2=A0 echo GOOD!:=C2=A0 = # Much better. > =C2=A0=C2=A0=C2=A0 ;; > =C2=A0=C2=A0=C2=A0 esac > } >=20 > ... So what am I missing?=C2=A0 Sometimes the here document is perfect= ly=20 > ignored, other times it creates an error. Looks wrong. The =C2=AB;;=C2=BB token must be followed by a pattern, but in your code= , it is followed by a command (=C2=AB:=C2=BB) (which happens to use a heredocume= nt, yes, but that's not actually relevant: $ zsh -fc 'case foo in (bar) ;; pwd; esac'=20 zsh:1: parse error near `;'). ) > So far I haven't found any comparable errors but this. Perhaps because many a syntax that look weird are actually valid, but in any case, here's another place where commands aren't allowed: repeat foo bar <