zsh-workers
 help / color / mirror / code / Atom feed
* Allow slash in alternation patterns in limited cases?
@ 2016-04-10 20:36 Mikael Magnusson
  2016-04-10 22:11 ` Bart Schaefer
  0 siblings, 1 reply; 16+ messages in thread
From: Mikael Magnusson @ 2016-04-10 20:36 UTC (permalink / raw)
  To: zsh workers

You can't do (/foo/bar|/baz)/bong, but would it be possible to allow
it when each alternatee is a full pattern and there's nothing outside
the alternation? To put it another way:
/path/(to/file|or/another/file) # nope, too hard
(/path/to/a/dir/*|/path/to/some/other/files/*) # can we allow this?

The reason one might want this is for example doing things like
echo ($file1|file2)(om[1]) #where $file1 and $file2 are full paths to
files in different directories
echo (${(~j:|:)fpath}/_stat)(om)
etc

I imagine this is at least a little bit more possible than the general
case? The scanner() function is scary, but since I think some of you
have looked at it recently, is your gut feeling that it's doable? If
so, I'll have a try.

If not, would it be possible to invent some new syntax to "paste" two
or more globs together so that a single set of glob
quals/sorts/flags/subscripts could apply to it?

-- 
Mikael Magnusson


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

end of thread, other threads:[~2016-04-11 14:49 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-10 20:36 Allow slash in alternation patterns in limited cases? Mikael Magnusson
2016-04-10 22:11 ` Bart Schaefer
2016-04-11  8:37   ` Peter Stephenson
2016-04-11 10:22     ` Mikael Magnusson
2016-04-11 10:29       ` Peter Stephenson
2016-04-11 10:47         ` Mikael Magnusson
2016-04-11 11:07           ` Peter Stephenson
2016-04-11 12:06             ` Mikael Magnusson
2016-04-11 12:31               ` Peter Stephenson
2016-04-11 13:45                 ` Mikael Magnusson
2016-04-11 13:50                   ` Peter Stephenson
2016-04-11 12:06       ` PATCH: Allow / in full pattern alternations Mikael Magnusson
2016-04-11 13:47         ` Peter Stephenson
2016-04-11 14:46           ` Bart Schaefer
2016-04-11 14:44         ` Bart Schaefer
2016-04-11 14:50       ` Allow slash in alternation patterns in limited cases? Bart Schaefer

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).