Module Gil_syntax.Literal

GIL Literals

type t =
  1. | Undefined
    (*

    The literal undefined

    *)
  2. | Null
    (*

    The literal null

    *)
  3. | Empty
    (*

    The literal empty

    *)
  4. | Constant of Constant.t
    (*

    GIL constants (Constant.t)

    *)
  5. | Bool of bool
    (*

    GIL booleans: true and false

    *)
  6. | Int of Z.t
    (*

    GIL integers: TODO: understand size

    *)
  7. | Num of float
    (*

    GIL floats - double-precision 64-bit IEEE 754

    *)
  8. | String of string
    (*

    GIL strings

    *)
  9. | Loc of string
    (*

    GIL locations (uninterpreted symbols)

    *)
  10. | Type of Type.t
    (*

    GIL types (Type.t)

    *)
  11. | LList of t list
    (*

    Lists of GIL literals

    *)
  12. | Nono
    (*

    Negative information

    *)
val to_yojson : t -> Yojson.Safe.t
val of_yojson : Yojson.Safe.t -> t Ppx_deriving_yojson_runtime.error_or
val equal : t -> t -> Ppx_deriving_runtime.bool
val pp : t Fmt.t

Pretty-printer

val type_of : t -> Type.t

Returns the type of a literal

val evaluate_constant : Constant.t -> t

Evaluates a constant

val from_list : t list -> t

Builds a GIL list from an OCaml list

val to_list : t -> t list option

Expands a list literal to a list of literals, or None if not a list

val base_elements : t -> t list

Returns a list of all non-list literals in a literal