zsh-users
 help / color / mirror / code / Atom feed
From: Zoltan Hidvegi <hzoli@cs.elte.hu>
To: segal@morgan.com (Morris M. Siegel)
Cc: schaefer@nbn.com, zsh-users@math.gatech.edu
Subject: Re: Bug in case stmt with '('
Date: Mon, 22 Jul 1996 21:51:48 +0200 (MET DST)	[thread overview]
Message-ID: <199607221951.VAA07888@bolyai.cs.elte.hu> (raw)
In-Reply-To: <9607221526.ZM3177@morgan.com> from "Morris M. Siegel" at "Jul 22, 96 03:26:46 pm"

> I'm ready to believe that my suggestion doesn't simplify the parser

It would allow removing three lines.

[...]
> 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

There is no whitespace token.  Whitespace is a separator and not a token.
Note that

case foo in

f*    |     b*    ) echo yes;;

esac

is a valid case statement.  Autoconf use this kind of case in many places.
Allowing space around | makes the script more readable.  This means that
your new syntax would introduce an ambiguity:

case foo in
f* | echo echo yes;;
esac

The question is wether the first echo is part of the pattern of a command
and | denotes an empty pattern.  Of course you may say that if a pattern
ends in a trailing | it must be followed by a ).  It would really mean that
3 line simplification in the code but it would make the syntax more
complicated.  It think that case works pretty well after my patch and
Bart's latest patch.

Unfortunately there is still an incompatibility in case:

case foo in
( f* | b* ) echo yes
esac

should print yes but in zsh it works as

case foo in
\ f*\ |\ b*\ ) echo yes;;
esac

To fix this would be really difficult I think.

Zoltan


  reply	other threads:[~1996-07-22 19:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-07-17 21:01 Morris M. Siegel
1996-07-18 18:27 ` Bart Schaefer
1996-07-18 23:43   ` Zoltan Hidvegi
1996-07-19  2:23     ` Bart Schaefer
1996-07-19 16:00       ` Zoltan Hidvegi
1996-07-21 22:53         ` Morris M. Siegel
1996-07-22  6:31           ` Bart Schaefer
     [not found]             ` <schaefer@candle.brasslantern.com>
1996-07-22 19:26               ` Morris M. Siegel
1996-07-22 19:51                 ` Zoltan Hidvegi [this message]
1996-07-22 20:48                   ` Morris M. Siegel
1996-07-22 21:27                     ` Zefram
1996-07-22 21:56                       ` Morris M. Siegel
1996-07-22 21:51                     ` Bart Schaefer
1996-07-22 21:23                   ` Zefram
1996-07-22 22:31               ` Morris M. Siegel
1996-07-22 23:37                 ` Bart Schaefer
1996-07-24 16:07     ` Morrie is off for July 25 Morris M. Siegel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199607221951.VAA07888@bolyai.cs.elte.hu \
    --to=hzoli@cs.elte.hu \
    --cc=schaefer@nbn.com \
    --cc=segal@morgan.com \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).