From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8170 invoked by alias); 3 Dec 2014 22:55:31 -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: 33838 Received: (qmail 1678 invoked from network); 3 Dec 2014 22:55:29 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=2F+Duk8D6u3GeAcMDSAwKgvd+YjlelfGdDaTqa7nAyA=; b=c2yZ57lrXBHyNDknsEUDHeRN0eSk2MwYQ9dl+TtqqU3eVqdLaM1U+umbQwgKKW4rbk AU1rOKeNm4TrGbLTf0pH31i4aCCjQhOXkdweatJMmW4Rl440Skk3fpSNg6BE23hpCZ86 SMif8oHMClRrK87cN6kcubmwRwTvdA+aHULIhJcY1fkzO6SyrpcRaolP+1ILVK9d7fTZ HfFuCbYRFqPGfGAvpW5ud0cDbao4xpsfq76S11IOTsC/+kpVPP0EhySW03w+LZdIdsTs RzHigJHw1yOV+eBHHieFY8s1ruYOOKkk1m1y3VsnVq1G7CPQIdJ8jemPAX+KJsywa90r 972A== X-Gm-Message-State: ALoCoQlczsVhRCrS1eB+wPUVMntwPuyhpKhusCA97Q4+5OEDEUvgh4zcoEqVIoDYA33nelo1j0L+ MIME-Version: 1.0 X-Received: by 10.180.91.36 with SMTP id cb4mr93991318wib.30.1417647327676; Wed, 03 Dec 2014 14:55:27 -0800 (PST) In-Reply-To: <20141203222002.48d9e22b@mlap.lactee> References: <20141203222002.48d9e22b@mlap.lactee> Date: Wed, 3 Dec 2014 14:55:27 -0800 Message-ID: Subject: Re: Unexpected ${%F{}} evaluation From: Bart Schaefer To: Zsh hackers list Content-Type: text/plain; charset=UTF-8 On Wed, Dec 3, 2014 at 1:20 PM, Marc Finet wrote: > Hello, > > # x="${(%):-%F{red}}XX"; echo $x > }XX > # x=${(%):-%F{red}}XX; echo $x > XX > > My questions are the following: > - is this behavior intended, i.e. break an expression inside ${} to > the first } ? Yes, I believe so. Inside double quotes, the second open brace has no special meaning, so the first close brace that is encountered closes the parameter expansion. > At first, I thought that it was a limitation (of ""), but > testing the second case showed me that correct parsing could be done. I think the second case is parsed "correctly" only by accident. In the second case the braces are initially parsed as a brace expansion, but as a special case a brace expansion with only one element is replaced by the literal string including the braces. If you "unsetopt braceexpand" you get the first result for both examples. It could be argued that this is a bug in braceexpand. > - is it normal that %F{xx works as %F{xx} ? In prompts a percent-expando can end at either the closing brace or the end of the string, whichever comes first ... because it doesn't seem useful to have the prompt report a syntax error. %F{xx would not work that way if there were more prompt string following it.