From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 51C7021709 for ; Wed, 27 Mar 2024 02:17:19 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1711502239; b=O6k2IvVKT+p4rE58CjxA7GYjQj3mFfDWPqRNpOD9cA0O3ziRlvGzHeXYuYjOT5fwNYjCt1IMhm m0iukLAP5R/nXH+sLzm5Q/Yq97qqTQOEvpUl3amISfSB1bTmpVeZnCpRRu/VsTV1qfkUVlSelW cnl4wbd4UQHcxbSRBj53pE0dlmRx1tx6EPPyWOdaCdfd/Gi0P/Av3+J7Y8XLENX6b1DJM0Su6N 982P9B9ZpwSljkhT0zXJNf+ifBxQQxwWdYbsSARH6S5UucGVnslyPhKfQ7iNf5wISQovSRWGT0 CiG1dRxnM+qjTJqT0IZJxQKjrQLQe9pTAxFvM+htN0AKhg==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (mail-lf1-f43.google.com) smtp.remote-ip=209.85.167.43; dkim=pass header.d=brasslantern-com.20230601.gappssmtp.com header.s=20230601 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1711502239; bh=HYUF0C6q0hR34ex1ljzSRtSdtCGiQTm1D29O/5zFi3c=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:Content-Type:To:Subject:Message-ID: Date:From:In-Reply-To:References:MIME-Version:DKIM-Signature:DKIM-Signature; b=BvFQiUvrMwqDkKdENBVCSecuoMtqbvmKHr5T5MWlwlT5/GfnxZf8gC8m42Du1EFhCojitADEy/ elCh45XqrGKUJnMAV4blLsxSocce9ARtJIne1jiIDnCVZesCG+UMM2YOPvBRGwtjr4eW8n6b7m ECwclc7jcYt67I6HQBKMCby3kpohzxsm2bPqjL4XzRPue0hKj3JzeTzJfTzziIs2qXMyMhtnuj PzSAXFM2X4krefAAqHqI3fWd1wlkwUXgDYF37cGL0GoE0to7ex8LENtQdjyF9EB0tyV/8cKZeQ GX93Pm8x+/ebgPBruL72agNSYuJFdBS4OMZycBxBoInNxg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: Content-Type:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=Il5IFyPJnY1tIgLwsyunZn+ItytzHfkJg23GsVvI25Q=; b=WVn+liKikvOYfdMpw/R0zQyKNd j5RW3lEVIZAv6BR064J9TtSALMW5ZuuYdWZ8fdE3/wnLme6jHxSsu3AVuCmS3XxXWNuka5ptzN64+ KNoIFexkJwlZjBOT8G7VB80kSXMxQlM3UPqKAWsZC12fGasrN3YkDkHt8gJwgytAdiUw9D7CBcjnr HOid2+jGwTZWMsZ2Vjx2t81bDW6wOuBvEB9aXdGoRbsVyfwWoU2Esi9p05M6ymNRPyyizeRWljPyP /D50yiPyKJG+ODI05aftG/++AgE02EWO4cZDJ1jZhz3klRkCbspef33DbuRCIiBnG354B/ELGvPWy 78dZXUVA==; Received: by zero.zsh.org with local id 1rpHup-0006VI-Hv; Wed, 27 Mar 2024 01:17:19 +0000 Authentication-Results: zsh.org; iprev=pass (mail-lf1-f43.google.com) smtp.remote-ip=209.85.167.43; dkim=pass header.d=brasslantern-com.20230601.gappssmtp.com header.s=20230601 header.a=rsa-sha256; dmarc=none header.from=brasslantern.com; arc=none Received: from mail-lf1-f43.google.com ([209.85.167.43]:51296) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1rpHuB-0006AX-Af; Wed, 27 Mar 2024 01:16:41 +0000 Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-513e25afabaso7278735e87.2 for ; Tue, 26 Mar 2024 18:16:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20230601.gappssmtp.com; s=20230601; t=1711502198; x=1712106998; darn=zsh.org; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Il5IFyPJnY1tIgLwsyunZn+ItytzHfkJg23GsVvI25Q=; b=wC2O2NvuyPjtMwkdVPabYFec/HeUx/F1j3ZfeR+vg6ryvQE2YAVXbJViGKbBV631Fs RKnhccCL2uodeu3j8lclk0zweplDLGFXYy/reTGn451q645F6vEP+fa6D8vbXIK+qAx+ oK+R6SulCqlUwfnfnHFuKjHfmwdda7sej8gqY3L5QgX4EAwLqGfWrZ7Z5qdOlVXu1v7F jnagCovN2K5xhyyXCSQvC56P9XWUTVsomt1bvRKgQNZYD0PvbDXoW/x4T2md9smUMlIL lr+Q4FqdLADecAFsUBJfsSzuxKl7uwOFx9g2yvslIgGBijRsvoEFZNJbnzpFDsyT7/9M 9Ndw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711502198; x=1712106998; h=content-transfer-encoding:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Il5IFyPJnY1tIgLwsyunZn+ItytzHfkJg23GsVvI25Q=; b=epznX86+bXUwR28FFoawAvOTfrYlNrLMNbDTH+rWt0Le7+S0e/cdoxSYmfjm8RLL4/ 6Fi1BrOxCifOoBcpxJ/TtUvNRQExl5E93YuK0221E12A0zArxpL1HRW9r2E3QSzHeBnw DOC2ewVE/XPsiV0OnUd+R/32Xs9PEvV6PjKT4Niaetm+HBNK3K9myoe62xTAAoQcmvCC qQV2QAhDvQh+MJfZNLNrd/V+24qCwCShhgD/tTB+IK2CIcA9CbqdqnfFqIhbmzXW5qNx z23CfQ7oqa2lLnp1uPQyUf7l0BDPq8XKNUjDfjYkvyBbbQRZR9W0bNgoxKIX1019cUyK 3+sA== X-Gm-Message-State: AOJu0YyxL5yjvEN7En2ybrNa/yju4A9o0XwrC795pC0bt4U9KWgoobFg ECPt5ZxAMkoZxsXFlLG3rv3xZ3R1UfDq5Omlerg3OaflCj/v2EZahyARV+Z0VpGzuO6GtndNpnh PUfVI9clvFmX5WbOmxkIr+0nAqruX1FDLyFh3vZLK/UzHAkEx2Q== X-Google-Smtp-Source: AGHT+IFfagP5ZDiqUiImbU1MsjceS5IKvhroDIs18joxP+1wWTvNFhdDliY/PMkFAwXgKpk4yLtzKTdbmQbjfVnKjtw= X-Received: by 2002:a19:8c16:0:b0:513:5a38:f545 with SMTP id o22-20020a198c16000000b005135a38f545mr731163lfd.62.1711502198092; Tue, 26 Mar 2024 18:16:38 -0700 (PDT) MIME-Version: 1.0 References: <90726-1709936102.086878@xlWC.oGpX.V4Q4> <34739-1710017038.959920@XhYc.enDL.DTxr> <25344-1710285573.990297@5-7t._0Mp.XRXG> <31438-1710454547.652877@WxhA.vkY6.ljF0> <20240315084226.rsgcm35fbqld3t2p@chazelas.org> In-Reply-To: <20240315084226.rsgcm35fbqld3t2p@chazelas.org> From: Bart Schaefer Date: Tue, 26 Mar 2024 18:16:26 -0700 Message-ID: Subject: Re: [PATCH?] Nofork and removing newlines To: zsh-workers@zsh.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Seq: 52830 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: Delayed reply as I was traveling last week. On Fri, Mar 15, 2024 at 1:42=E2=80=AFAM Stephane Chazelas wrote: > > What about, instead of adding ksh93's ${ cmd;} and mksh's > ${|cmd} (in slightly diverging ways), we added just a | > expansion flag As mentioned in a previous context, the problem with this approach is that the lexing/parsing of a parameter reference and the lexing/parsing of what amounts to a function body are very different. Upon encountering dollar-brace-pipe or dollar-brace-whitespace (or in forthcoming proposed change, dollar-brace-brace), we can immediately switch to expect a series of commands. This allows for one-character lookahead, which works with hungetc(). If required first to consume parameter flags or any string of multiple characters, the lexer can't backtrack without some serious gyrations. Even if the backtracking were worked out, the proposed flag now has semantics that the lexer has to understand in order to proceed after the close-paren, whereas current parameter flags are just swept up uninterpreted at lexing and left to paramsubst() to decode. On top of this the lexer has to maintain the PS2 context stack, which was one of the most difficult bits of implementing the switch to/from expecting commands vs. expecting (possibly nested) parameter substitutions. > Some advantages: > - the flags can be cumulated as usual. So you can have ${(||.s[:])getconf= PATH} That would make this entirely impractical for lexing purposes. > - there's no extra rule as to how the expansion works and how it > can be combined with others as it's the same syntax as other > parameter expansions Except it's still not, because the syntax after the flags and up to the matching close brace is nothing like identifiers / subscripts / nested parameters. > - as it's different syntax, it removes the potential surprises > when ${ cmd;}, ${|cmd} behave differently than in > ksh93/mksh/bash Possibly, but since they'll work very similarly when in emulation modes, I think this is minor. > Or (as a completely different idea), an alternative to > mksh's ${|cmd} and ${|var|cmd} could be written ${REPLY ${var