Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Completing for "find" and _regex_arguments (Re: PATCH: Re: sudo completion problem)
- X-seq: zsh-workers 11161
- From: Tanaka Akira <akr@xxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: Completing for "find" and _regex_arguments (Re: PATCH: Re: sudo completion problem)
- Date: 05 May 2000 01:16:09 +0900
- In-reply-to: <1000504151422.ZM22851@xxxxxxxxxxxxxxxxxxxxxxx> (Bart Schaefer's message of "Thu, 4 May 2000 15:14:22 +0000")
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <E12n0lo-0008Ug-00@xxxxxxxxxxxxxxxxxx> <000601bfb599$a9219f80$21c9ca95@xxxxxxxxxxxxxx> <hvowvlaplq9.fsf@xxxxxxxxxxxxxxx> <200005041340.PAA08620@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> <1000504151422.ZM22851@xxxxxxxxxxxxxxxxxxxxxxx>
In article <1000504151422.ZM22851@xxxxxxxxxxxxxxxxxxxxxxx>,
"Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx> writes:
> Is there any chance that it could now be rewritten using extendedglob
> patterns, rather than parsing its own RE syntax?
Hm. _regex_arguments handles two kind of RE. Inner RE is just
extendedglob pattern: /RE/. Outer RE is RE which contains elements as
inner REs instead of characters. Outer RE has also lookaheads, guards,
and actions and they are corresponds to inner REs. A lookahead is
also just extendedglob pattern but it doesn't consume arguments
string. This corresponds to a zero-width positive look-ahead
assertion in perl5: `(?=pattern)'. A guard is zsh code to test
something which cannot represent as RE. This corresponds to (??{
(code) ? "[^\000-\377]" : "" }) in perl5.6. However, currently I
don't use this as real test. I used this as recording option use
etc. and always report a test is succeed. So (?{ code }) in perl5.6
is enough to implement my use. A action is zsh code for completion.
They are evaluated when whole outer RE is failed to match. When it is
failed, actions corresponding to inner REs which are last candidates
to match. There is no direct correspondences in RE constructs. But I
think this can be implemented as (?{ code }) which set some variables.
Note that outer RE of _regex_arguments is not real RE because it
doesn't backtrack. But if it is implemented by real RE engine, it can
backtrack...
So, if extendedglob patterns have enough RE constructs in perl5.6,
it can be used to unify inner and outer RE in _regex_arguments.
Maybe.
--
Tanaka Akira
Messages sorted by:
Reverse Date,
Date,
Thread,
Author