unison

Fork of Unison, a bi-directional file synchronization tool
git clone git://git.laack.co/unison.git
Log | Files | Refs | README | LICENSE

rx.mli (2262B)


      1 (* Unison file synchronizer: src/ubase/rx.mli *)
      2 (* Copyright 1999-2020, Benjamin C. Pierce (see COPYING for details) *)
      3 
      4 type t
      5 
      6 (* Posix regular expression *)
      7 val rx : string -> t
      8 
      9 (* File globbing *)
     10 val glob : string -> t
     11 val glob' : bool -> string -> t
     12    (* Same, but allows to choose whether dots at the beginning of a
     13       file name need to be explicitly matched (true) or not (false) *)
     14 val globx : string -> t
     15 val globx' : bool -> string -> t
     16     (* These two functions also recognize the pattern {...} *)
     17 
     18 (* String expression (literal match) *)
     19 val str : string -> t
     20 
     21 (* Operations on regular expressions *)
     22 val alt : t list -> t                  (* Alternative *)
     23 val seq : t list -> t                  (* Sequence *)
     24 val empty : t                          (* Match nothing *)
     25 val epsilon : t                        (* Empty word *)
     26 val rep : t -> int -> int option -> t  (* Repeated matches *)
     27 val rep0 : t -> t                      (* 0 or more matches *)
     28 val rep1 : t -> t                      (* 1 or more matches *)
     29 val opt : t -> t                       (* 0 or 1 matches *)
     30 val bol : t                            (* Beginning of line *)
     31 val eol : t                            (* End of line *)
     32 val any : t                            (* Any character *)
     33 val notnl : t                          (* Any character but a newline *)
     34 val set : string -> t                  (* Any character of the string *)
     35 val inter : t list -> t                (* All subexpressions must match *)
     36 val diff : t -> t -> t                 (* The first expression matches
     37                                           but not the second *)
     38 val case_insensitive : t -> t          (* Case insensitive matching *)
     39 
     40 (* Test whether a regular expression matches a string  *)
     41 val match_string : t -> string -> bool
     42 
     43 (* Test whether a regular expression matches a substring of the given
     44    string *)
     45 val match_substring : t -> string -> bool
     46 
     47 (* Test whether a regular expression matches some characters of a
     48    string starting at a given position.  Return the length of
     49    the matched prefix. *)
     50 val match_prefix : t -> string -> int -> int option
     51 
     52 (* Errors that can be raised during the parsing of Posix regular
     53    expressions *)
     54 exception Parse_error
     55 exception Not_supported