package apero-core

  1. Overview
  2. Docs
type t
val of_string : string -> t

of_string s returns s as a PathExpr if it's valid. Otherwise it raises an Exception. Note that the expression is sanitized (i.e. it's trimmed meaningless '/' are removed)

val of_string_opt : string -> t option

of_string s returns s as a PathExpr if it's valid. Otherwise it raises an Exception. Note that the expression is sanitized (i.e. it's trimmed meaningless '/' are removed)

of_string_opt s returns Some pe if s is a valid path expression. Otherwise returns None. Note that the expression is sanitized (i.e. it's trimmed and meaningless '/' are removed)

val to_string : t -> string

of_string_opt s returns Some pe if s is a valid path expression. Otherwise returns None. Note that the expression is sanitized (i.e. it's trimmed and meaningless '/' are removed)

to_string e return the expression e as a string

val of_path : Path.t -> t

to_string e return the expression e as a string

of_path p returns an expression equal to p

val length : t -> int

length e returns the number of characters of expression e

val compare : t -> t -> int

length e returns the number of characters of expression e

The comparison function for expressions, with the same specification as Pervasives.compare

val equal : t -> t -> bool

The comparison function for expressions, with the same specification as Pervasives.compare

The equal function for expressions.

val is_relative : t -> bool

is_relative e return true if the expression e is relative (i.e. it's first character is not '/')

val get_prefix : t -> Path.t

is_relative e return true if the expression e is relative (i.e. it's first character is not '/')

get_prefix e return the longest prefix of e that is a Path (i.e. without any wildcard)

val add_prefix : prefix:Path.t -> t -> t

get_prefix e return the longest prefix of e that is a Path (i.e. without any wildcard)

add_prefix prefix e return a new expression made of prefix/e.

val remove_prefix : int -> t -> t

add_prefix prefix e return a new expression made of prefix/e.

remove_prefix l e removes the l first characters from expression e and returns the remaining as a non-absolute PathExpr

val is_unique : t -> bool

is_unique e returns true if the expression e doesn't contains any wildcard ('*').

val as_unique_path : t -> Path.t option

is_unique e returns true if the expression e doesn't contains any wildcard ('*').

as_unique_path e returns the expression e as Some Path.t if it doesn't contain any wildcard ('*'). It returns None otherwise.

val is_matching_path : Path.t -> t -> bool

is_matching_path p e returns true if the expression e fully matches the path p.

val intersect : t -> t -> bool

intersect e1 e2 returns true if the intersection of expressions e1 and e2 is not empty. I.e. if it exists a path p that matches both expressions e1 and e2.

val includes : subexpr:t -> t -> bool

intersect e1 e2 returns true if the intersection of expressions e1 and e2 is not empty. I.e. if it exists a path p that matches both expressions e1 and e2.

includes subexpr e returns true if the expression e includes the expression subexpr. I.e. if subexpr matches a path p, e also matches p.

val longest_matching_part : Path.t -> t -> t

longest_matching_part path e returns the longest prefix within e that matches path, or an empty PathExpr no matching prefix of path can be found in e.

val remaining_after_match : Path.t -> t -> t option

remaining_after_match path e tries to find the longest prefix within e that matches path and returns the remaining part of e when removing this prefix. If matching prefix of path can be found in e, None is returned.

OCaml

Innovation. Community. Security.