Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm
Precedence: bulk
X-No-Archive: yes
List-Id: Zsh Workers List <zsh-workers.zsh.org>
List-Post: <mailto:zsh-workers@zsh.org>
List-Help: <mailto:zsh-workers-help@zsh.org>
X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=mime-version:date:message-id:subject:from:to;
        bh=6dvfW5ztZ8PotG1TdngWerF+SKjizQ1b+Yp6cYNki68=;
        b=GFUrYW33/ksWsKiofmjotlUCwpP03PrL0DYvECIrcPrGDnTYG5ercSl+xBEQsyZil0
         GsWK4i7xvDV80Ol0hXfhUUFpR1HGJg2i7eL/QyUwAvuTjExmOUIzMKl/EJtxigdLQo+k
         +76eA0Xe6OseESseFZimYy4Jn5SUR3mv+wPrZzBsZi9mql48NI5EhQ0elJFqDAh4bxyn
         IhNWDjX3MbRU5QXM2LFezH0hVmMukm1qc5lybPMVyMum7++Gn+jbBeLGkMgrf4GRlwOo
         U6uppLzvUhq4+ms5fIE5uMGa5o+I8K4dTtFod+m1vuUV9gzOCkp+9RMagMhCTDatKMoK
         OmQw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:mime-version:date:message-id:subject:from:to;
        bh=6dvfW5ztZ8PotG1TdngWerF+SKjizQ1b+Yp6cYNki68=;
        b=OGdKw7bXgNyfeOgte7A0oewuV8+B8ruHrE/rIYM9Mz/w+G+l65PU6oYmiVwftRqrG7
         UpK9i8ovw3Dje1iqdt1GM5C5xaNgtD985MTjGLSSvNKiwMTYDqYm2UwGZWDrRTX9p0tb
         nc0NxvuD08N3J0IqsSa6JuFUA2ntcYL8BQYfSht5rpBSGnUXVy5D3L65ug0VtZSEiVY1
         NKBgSqbEOaPu251wnUNWNQyC06VIjf8SDm6AocY7kqgdyU6OyY7OBBLEZplu9LxlbPt8
         FycOFFH8n2VdxU2hpuochvlz3l+QZYzcavL1N0Qrxac2SC4MHdsBN2bmdZnR9l0U8+LD
         on4w==
X-Gm-Message-State: AD7BkJLQLA4MPk7mRMDSZ2D3CMPS9l+aVfk7lJcSbI3rBhrDsvGCkuJzC7W7j0IGn9IR7W5LNC17yVVaKU7qiA==
MIME-Version: 1.0
X-Received: by 10.55.76.208 with SMTP id z199mr24175855qka.88.1460320613854;
 Sun, 10 Apr 2016 13:36:53 -0700 (PDT)
Date: Sun, 10 Apr 2016 22:36:53 +0200
Message-ID: <CAHYJk3TY5kU0fXDkk2iO7kRJhhMTS1f4a9Am1ueN4wCXOQ7Hsg@mail.gmail.com>
Subject: Allow slash in alternation patterns in limited cases?
From: Mikael Magnusson <mikachu@gmail.com>
To: zsh workers <zsh-workers@zsh.org>
Content-Type: text/plain; charset=UTF-8
X-Seq: zsh-workers 38265

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

