zsh-workers
 help / color / mirror / code / Atom feed
* broken parsing with $((`:`))
@ 2015-04-15  3:05 Mike Frysinger
  2015-04-15  9:03 ` Peter Stephenson
  0 siblings, 1 reply; 15+ messages in thread
From: Mike Frysinger @ 2015-04-15  3:05 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 537 bytes --]

looks like zsh doesn't correctly parse this:
$ zsh -c 'echo $((`:`))'
zsh:1: bad math expression: illegal character: \M-]

a little whitespace makes it happy:
$ zsh -c 'echo $(( `:`))'
0
$ zsh -c 'echo $((`:` ))'
0

same for $():
$ zsh -c 'echo $(($(:)))'
zsh:1: bad math expression: illegal character: \M-]
$ zsh -c 'echo $(( $(:)))'
0
$ zsh -c 'echo $(($(:) ))'
0

looks like it's related to the subshell not outputting anything.
if you use 'echo 0' instead of ':', it works out.

$ zsh --version
zsh 5.0.7 (x86_64-pc-linux-gnu)
-mike

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread
* Re: broken parsing with $((`:`))
@ 2015-04-17  4:39 Mikael Magnusson
  0 siblings, 0 replies; 15+ messages in thread
From: Mikael Magnusson @ 2015-04-17  4:39 UTC (permalink / raw)
  To: Peter Stephenson; +Cc: zsh workers

On Wed, Apr 15, 2015 at 11:03 AM, Peter Stephenson
<p.stephenson@samsung.com> wrote:
> On Tue, 14 Apr 2015 23:05:31 -0400
> Mike Frysinger <vapier@gentoo.org> wrote:
>> looks like zsh doesn't correctly parse this:
>> $ zsh -c 'echo $((`:`))'
>> zsh:1: bad math expression: illegal character: \M-]
>>
>> looks like it's related to the subshell not outputting anything.
>
> Yes, indeed --- there's a funny internal special case for empty strings
> that I never quite get my head around.
>
> (Please, God, make the problems with command and math substitution
> parsing stop now.)

% $(
cmdsubst> [press ctrl-c here]
zsh: parse error near `$('

I would expect to not get an error message about syntax after pressing
ctrl-c. It doesn't happen with $((, { or any other unbalanced thingers
I tried.

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-08-16  1:22 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-15  3:05 broken parsing with $((`:`)) Mike Frysinger
2015-04-15  9:03 ` Peter Stephenson
2015-04-15 15:13   ` Bart Schaefer
2015-04-15 15:26     ` Peter Stephenson
2015-04-15 16:23       ` Potential 3.0.8 [was Re: broken parsing with $((`:`))] Bart Schaefer
2015-04-22  9:01         ` Peter Stephenson
2015-04-25 17:14           ` Pre-3.0.8 consolidated PATCH Bart Schaefer
2015-04-25 18:29             ` Axel Beckert
2015-04-25 18:46               ` FIVE-ZERO-EIGHT (was Re: Pre-3.0.8 consolidated PATCH) Bart Schaefer
2015-08-15 23:14             ` bug with expansion and backslashes Oliver Kiddle
2015-08-16  1:22               ` Bart Schaefer
2015-04-15 15:37     ` broken parsing with $((`:`)) Peter Stephenson
2015-04-15 16:13       ` Bart Schaefer
2015-04-15 16:31         ` Peter Stephenson
2015-04-17  4:39 Mikael Magnusson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).