Module type Signatures.GLOB

A self-contained module implementing extended shell glob patterns who have an expressive power equal to boolean combinations of regular expressions.

type globber

The type representing globbers. Do not attempt to compare them, as they get on-the-fly optimizations.

val parse : ?⁠dir:string -> string -> globber

parse ~dir pattern will parse the globber pattern pattern, optionally prefixing its patterns with dir.

exception Parse_error of string

A descriptive exception raised when an invalid glob pattern description is given.

val eval : globber -> string -> bool

eval g u returns true if and only if the string u matches the given glob expression. Avoid re-parsing the same pattern, since the automaton implementing the pattern is optimized on the fly. The first few evaluations are done using a time-inefficient but memory-efficient algorithm. It then compiles the pattern into an efficient but more memory-hungry data structure.