Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Allow slash in alternation patterns in limited cases?



On Sun, 10 Apr 2016 15:11:05 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:

> On Apr 10, 10:36pm, Mikael Magnusson wrote:
> }
> } /path/(to/file|or/another/file) # nope, too hard
> } (/path/to/a/dir/*|/path/to/some/other/files/*) # can we allow this?
> 
> My gut feeling is that this is close to impossible.

The problem's not the parsing, it's the fact that you don't have
appropriate chunks corresponding to directories for the scanner to loop
over once pattern matching has parsed it.

The only way I can see is effectively to parse it first in the globbing
code to treat a complete set of parentheses specially.  But this is
going to be inconsistent with pattern matching one way or another.  So a
different syntax would be more sensible.

> } 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?

I think Bart's answered this.

pws



Messages sorted by: Reverse Date, Date, Thread, Author