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

Re: Quoting problems with _zip (unzip) completer



Nikolai Weibull wrote:
> I don't want to sound pessimistic, but aren't we approaching a point
> where the quoting and pattern matching code simply has to be
> re(written|factored)?

To some extent, yes, and I looked at the completion quoting code: it's
absolutely ghastly and I got pretty much nowhere.  (This was the case of
nested quoting, however, so it's harder than the sort of thing we've
been talking about.)  Sven hasn't been available for some years and
anyway the object would be to tease something more manageable out, which
is a rather different prospect from fixing up the existing code.

The pattern matching code in use here is the main shell's; this is
actually relatively under control and doesn't merit a rewrite.  The big
problem we have in cases like yesterday's is the standard one with
regular expressions that it's not trivial to quote them from expansion.
We could fix that with a flag.

There is the case of the completion matching code, which is separate but
calls the normal pattern matching code.  I have started to improve this
to support multibyte characters but got bogged down; the core now works
but there's much more work to be done in the logic that uses it, which
is heavily tied to one byte per character.

It's not entirely clear you're ever going to end up with something
completely clean anyway, and a lot of the problem isn't the
internals---broadly these do the right thing in most cases or can be
persuaded to do so with local changes like yesterday's.  There's no
guarantee that a rewrite is going to pick remaining issues up.  There is
the further problem of the conventions of passing between different
parts of the system, which need to know what's quoted, what's a pattern,
what can be expanded, etc.  This is probably what I ran into
yesterday---some part of the code has a convention where a file name is
quoted where you would expect it not to.  Fixing all that would really
mean a complete rewrite of the entire system, adding much more internal
state.  I don't think there's any prospect of that.

Then of course there's the problem that at the current rate any changes
other than simple, local ones are going to take longer than the age of
the universe.

-- 
Peter Stephenson <pws@xxxxxxx>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


'member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom'



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