Zsh Mailing List Archive
Messages sorted by:
Re: Bug in case stmt with '('
- X-seq: zsh-users 323
- From: segal@xxxxxxxxxx (Morris M. Siegel)
- To: schaefer@xxxxxxx, Zoltan Hidvegi <hzoli@xxxxxxxxxx>, zsh-users@xxxxxxxxxxxxxxx
- Subject: Re: Bug in case stmt with '('
- Date: Mon, 22 Jul 1996 15:26:46 -0400
- In-reply-to: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx> "Re: Bug in case stmt with '('" (Jul 21, 11:31pm)
- References: <199607191600.SAA08613@xxxxxxxxxxxxxxxxx> <9607211853.ZM979@xxxxxxxxxx> <960721233102.ZM22696@xxxxxxxxxxxxxxxxxxxxxxx>
> So your suggestion would amount to omitting the check for balanced
> parens, thus assuming (in the event that a closing paren is not found)
> that the glob pattern is correctly formed. This doesn't simplify the
> parser in any significant way, and it delays detection of some other
> malformed glob patterns.
I'm ready to believe that my suggestion doesn't simplify the parser
significantly, but I'm _not_ suggesting to forego checking for balanced parens
-- on the contrary, I assume the parser would only accept well-formed glob
| required paren
"( x ) )"
| optional paren
" x )"
What I am suggesting is that the trailing ')' (which if present is UNbalanced)
not be required to be present. I.e., each well-formed case-prefix pattern
(which may have internal parens or '|'s) is terminated by an [external]
'|', ')', or whitespace; if by whitespace, then the parser considers the
following token: if it is '|' or ')', then parsing of the case-prefix continues,
else the case-prefix is considered complete (the parser regards the whitespace
as equivalent to a trailing ')', if you will), and the token is taken to be
the initial token of the case-clause body. Accordingly, I believe that
detection of malformed glob patterns would not at all be delayed.
Perhaps my approach might even make it easier to avoid the remaining problem
with Zoltan's current patch.
Messages sorted by: