From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14800 invoked by alias); 28 Sep 2015 00:59:13 -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: 36666 Received: (qmail 24789 invoked from network); 28 Sep 2015 00:59:12 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=POOx8t8Ei4jmE6SdnrKDdSLNKnrmEEZkHyYAYUfo6IY=; b=F9z0gBAXadVCRcLs9U206BVVKBjua3BnyOrIFhQJk/B5byhzK9cIF8Z3f+v0VsRJOH Of03pQCTUkuD9a94X4NrZIa+kv8Klre+jKHf1KsZTvWxPqcA9hmfx1crygiZX21MhIyN z4XqCIDwnorIg6M64+iJuOJRlKlfVZiJP2NBEkkXcl9XqWeKY1ToyJJ5ce6QM3yyvBU8 dE1VldZym7jRz+0A9cCC9Wl4y0Yvsr5kK+lBNM8EzuhEUYuTF64bjtEO8zTv7/0bt875 AhvXUj36T+9xxIgxpLupJvrw/GOqJXah3lVUUce2N8lFc5hhbKe6BZvv6riDlnePY1Jr Ic6Q== X-Gm-Message-State: ALoCoQkrDW8wBPbOysJq//FMvZvk5JOHm/Nvu5Hy0RLBzUziA/EFoS8YLvn8gUriA/k0H9VuFfUa X-Received: by 10.202.174.206 with SMTP id x197mr8796780oie.50.1443401949373; Sun, 27 Sep 2015 17:59:09 -0700 (PDT) From: Bart Schaefer Message-Id: <150927175906.ZM20369@torch.brasslantern.com> Date: Sun, 27 Sep 2015 17:59:06 -0700 In-Reply-To: <20150927235106.GD1879@tarsus.local2> Comments: In reply to Daniel Shahaf "Re: ${(z)} split of unmatched, doubled ((" (Sep 27, 11:51pm) References: <20150927012337.GD1989@tarsus.local2> <150927090048.ZM25706@torch.brasslantern.com> <20150927235106.GD1879@tarsus.local2> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: ${(z)} split of unmatched, doubled (( MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Sep 27, 11:51pm, Daniel Shahaf wrote: } Subject: Re: ${(z)} split of unmatched, doubled (( } } Since the "two subshells" case can be disambiguated by adding a space, } but arithmetic evluations cannot be disambiguated, I assume ambiguous } cases should be resolved in favour of the latter. } } I see the problem: ${(z)} is bufferwords(), which calls ctxtlex(), which } ultimately calls cmd_or_math(), which classifies the unbalanced opening } parentheses as a syntax error, because they have no matching ')' before } the end of the input. Consequently, cmd_or_math() returns CMD_OR_MATH_ERR } on line 512 (in the 'if (lexstop)' block), which causes ctxtlex() to } return LEXERR. So perhaps this: diff --git a/Src/lex.c b/Src/lex.c index 70f3d14..6eb3c82 100644 --- a/Src/lex.c +++ b/Src/lex.c @@ -785,6 +785,8 @@ gettok(void) return INPAR; default: + if (lexflags & LEXFLAGS_ACTIVE) + tokstr = dyncat("((", tokstr); return LEXERR; } } It might be prudent to also test that tokstr != NULL there, but I have not found a sample input where that occurs.