Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: spurious 'case' parse error
- X-seq: zsh-workers 41745
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Martijn Dekker <martijn@xxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: spurious 'case' parse error
- Date: Fri, 22 Sep 2017 08:42:46 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=1dw/2tU098GJdjUb9gy5amr7EX7LxiE+3N+Q4tiSlOc=; b=mQ0AJPHNkDh1l+oudVvR3e1USHkwN4ou0e6flFZeBmUHyYH7LWz4DAnFJklOpAwew7 hBBezm9O3uARqpv9TEYt+NeVtN4WQivtl88mVVwpxQ00A0yThUhumPoApnPSP/GIT7Ej YIPLEpXyJs/Mks/uB8akIUYyMJPeYKSBLRSEewDWcJHeUbij2m4zvDPiMDSC/H9OKasO qjd1lP+tbw5XxFajlSOimw0E+IGRjr0pL4NOOKxA5Oc4Dfh3WPETPU+uiUIe1iAx698e 4uUiUKqoAvH598y319B3cE8Uf++NlUagTdOT7Ln7uK9WErM1bKuhFpOICg9sMt174Hum wkOQ==
- In-reply-to: <6fb7e839-48ce-51a4-1d64-bbbf498c5bfb@inlv.org>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <6fb7e839-48ce-51a4-1d64-bbbf498c5bfb@inlv.org>
On Sep 22, 3:11pm, Martijn Dekker wrote:
}
} case x in
} (x)echo ok ;;
} esac
}
} Output:
} test.zsh:2: parse error near `ok'
}
} The cause is the lack of space after the ')'; that space should be
} optional, but is mandatory in zsh.
That's almost certainly happening because
case xecho in
(x|y)echo)echo ok;;
esac
is valid syntax for zsh, so (x)echo is being parsed as a pattern and then
the closing paren is found to be missing.
The space is optional when in sh emulation where grouping syntax is not
allowed in patterns:
Src/zsh --emulate sh
$ case x in
> (x|y)echo ok;;
> esac
echo ok
$
This is probably not going to change, but we'll see what PWS has to say
when he returns from vacation.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author