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

Re: libzglob?



Andrew Main wrote:
> Zoltan T. Hidvegi wrote:
> >Yes, for zsh.  But the question was to use the zsh glob within perl, which
> >already have the regexp engine.  I'd thing that even for zsh the regexp
> >engine would be superior, but it is quite big, and zsh is big enough even
> >without regexps.  Of course a loadable regexp module can be added to zsh.
>
> That's not what I meant.  We're talking about doing globbing.  A normal
> regexp engine answers questions of the form "does this string match this
> pattern?", but for globbing we need an engine that can answer "what are
> all the filenames that match this pattern?".  libzglob would really have
> to contain its own globbing engine -- Perl currently doesn't have one,
> though it has a good regexp engine.

But glob.c really has three main functions: pattern compiler to struct
comp, pattern matcher (domatch()) and scanner.  The scanner scans the
filesystem, and calls domatch() to see if a filename matches a pattern.
This is a bit simplified description, but not completely far from reality.
domatch() can be replaced by a regexp engine.

Zoltan



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