package bap-knowledge

  1. Overview
  2. Docs

Fully qualified names.

type t = name
val t_of_sexp : Ppx_sexp_conv_lib.Sexp.t -> t
val sexp_of_t : t -> Ppx_sexp_conv_lib.Sexp.t
val create : ?package:string -> string -> t

create ?package name creates a fully qualified name.

The package and name strings can contain any characters all treated literally, e.g., the : character won't be treated as a separator neither it will break anything.

If package is not specified, then it defaults to the "user" package.

val read : ?package:string -> string -> t

read ?package input reads a full name from input.

This function will parse the input and return a fully-qualified name that corresponds to the input, using package as the currently opened package. The input syntax is

          name = string, ":", string
               | ":", string
               | string
          string = ?a sequence of any characters?

Not all characters in the input string are treated literally, the following two characters have a special interpretation:

  • '\\' the escape character;
  • ':' the package separator character.

The escape character disables a special interpretation of the consequent character. The package separator denotes the place in the input where the package name ends and the name part starts.

If package is specified then it is treated literally (as in the create function). The same as in create it defaults to the "user" package.

If input doesn't denote a fully qualified name (i.e., there is no ':' special character in input, then the read name is qualified with the passed package, otherwise the package is defined by the input.

The function is expected to work with the output of the show function, so that for all n, read (show n) = n. However, it is robust enough to accept any user inputs, even if it is not a well-formed input, e.g., when an escape character is used to escaped a non-special character or when input contains more than one unescaped separators. In case of invalid input, all special characters that doesn't make sense are treated literally and the first special ':' denotes the end of the package field. If the input is not valid, then it is possible that show (read s) <> s, since the output of show is always valid, e.g.

show@@read "hello:cruel:world" = "hello:cruel\\:world"

val show : t -> string

show name is the readable representation of name.

The name is represented as <package>:<name>, with all special characters escaped. See the read function for more information.

val unqualified : t -> string

unqualified name is the unqualified name.

Returns the name without the package specifier.

val package : t -> string

package name is the package of the name.

val str : unit -> t -> string

str () x = show x shows x.

This function is useful with printf-style functions that output to a string.

val hash : t -> int

hash name the name hash.

include Base.Comparable.S with type t := t
val (>=) : t -> t -> bool
val (<=) : t -> t -> bool
val (=) : t -> t -> bool
val (>) : t -> t -> bool
val (<) : t -> t -> bool
val (<>) : t -> t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val min : t -> t -> t
val max : t -> t -> t
val ascending : t -> t -> int
val descending : t -> t -> int
val between : t -> low:t -> high:t -> bool
val clamp_exn : t -> min:t -> max:t -> t
val clamp : t -> min:t -> max:t -> t Base__.Or_error.t
type comparator_witness
val comparator : (t, comparator_witness) Base__.Comparator.comparator
val validate_lbound : min:t Base__.Maybe_bound.t -> t Base__.Validate.check
val validate_ubound : max:t Base__.Maybe_bound.t -> t Base__.Validate.check
val validate_bound : min:t Base__.Maybe_bound.t -> max:t Base__.Maybe_bound.t -> t Base__.Validate.check
include Core_kernel.Binable.S with type t := t
val bin_size_t : t Bin_prot.Size.sizer
val bin_write_t : t Bin_prot.Write.writer
val bin_read_t : t Bin_prot.Read.reader
val __bin_read_t__ : (int -> t) Bin_prot.Read.reader
val bin_shape_t : Bin_prot.Shape.t
val bin_writer_t : t Bin_prot.Type_class.writer
val bin_reader_t : t Bin_prot.Type_class.reader
val bin_t : t Bin_prot.Type_class.t
include Core_kernel.Stringable.S with type t := t
val of_string : string -> t
val to_string : t -> string
include Core_kernel.Pretty_printer.S with type t := t
val pp : Base__.Formatter.t -> t -> unit
OCaml

Innovation. Community. Security.