Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug in case stmt with '('
- X-seq: zsh-users 332
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: Zoltan Hidvegi <hzoli@xxxxxxxxxx>, segal@xxxxxxxxxx (Morris M. Siegel), zsh-users@xxxxxxxxxxxxxxx
- Subject: Re: Bug in case stmt with '('
- Date: Mon, 22 Jul 1996 16:37:24 -0700
- In-reply-to: segal@xxxxxxxxxx (Morris M. Siegel) "Re: Bug in case stmt with '('" (Jul 22, 6:31pm)
- References: <199607221951.VAA07888@xxxxxxxxxxxxxxxxx> <9607221648.ZM3416@xxxxxxxxxx> <960722145116.ZM10226@xxxxxxxxxxxxxxxxxxxxxxx> <9607221831.ZM3714@xxxxxxxxxx>
- Reply-to: schaefer@xxxxxxx
On Jul 22, 6:31pm, Morris M. Siegel wrote:
} Subject: Re: Bug in case stmt with '('
}
} > There's no such thing as "unescaped whitespace in glob patterns." Zsh
} > lexes glob patterns as a STRING token.
}
} Okay -- (not knowing how lex.c works puts me somewhat at a disadvantage) --
} in light of what you say, then what I mean is that the whitespace would have
} to be escaped with backslash or quotes to be non-trivial.
Unfortunately, glob patterns are not the only STRING tokens. That means
that you can't strip out the "trivial" spaces when lexing, without messing
up other uses of those tokens.
} E.g., the glob pattern
} ( file*.* ~ file.c )
} would be equivalent to
} (file*.*~file.c)
That's exactly what my `if (incasepat && ...)' patch does, except it only
does it in the pattern part of case statements.
Unfortunately, it breaks this sort of thing:
case "foo bar" in
(foo bar)|boing) echo yes;;
esac
because you can't tell until you find the `|' beyond the first ')' that
you should not have been stripping out spaces when lexing inside the
earlier '('.
This works, though:
case "foo bar" in
((foo bar)|boing) echo yes;;
esac
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.nbn.com/people/lantern
New male in /home/schaefer:
>N 2 Justin William Schaefer Sat May 11 03:43 53/4040 "Happy Birthday"
Messages sorted by:
Reverse Date,
Date,
Thread,
Author