package liquidsoap-lang

  1. Overview
  2. Docs

Helper functions for the parser.

type arglist = (string * string * Type.t * Term.t option) list
type lexer_let_decoration = [
  1. | `None
  2. | `Recursive
  3. | `Replaces
  4. | `Eval
  5. | `Json_parse
  6. | `Yaml_parse
]
type let_decoration = [
  1. | `None
  2. | `Recursive
  3. | `Replaces
  4. | `Eval
  5. | `Yaml_parse
  6. | `Json_parse of (string * Term.t) list
]
type app_list_elem = (string * Term.t) list
type binding = {
  1. doc : Doc.Value.t option;
  2. decoration : let_decoration;
  3. pat : Term.pattern;
  4. arglist : arglist option;
  5. def : Term.t;
  6. cast : Type.t option;
}
val let_args : ?doc:Doc.Value.t -> decoration:let_decoration -> pat:Term.pattern -> ?arglist:arglist -> def:Term.t -> ?cast:Type.t -> unit -> binding
type encoder_param = string * [ `Term of Term.t | `Encoder of string * encoder_opt ]
and encoder_opt = encoder_param list
type inner_list_item = [
  1. | `Ellipsis of Term.t
  2. | `Expr of Term.t
]
type inner_list = [
  1. | `App of Term.t
  2. | `List of Term.t list
]
type let_opt_el = string * Term.t
type record = pos:(Stdlib.Lexing.position * Stdlib.Lexing.position) -> Term.t -> Term.t
type ty_content_arg = string * string
type ty_content_args = ty_content_arg list
type ty_content = string * ty_content_args
type varlist = [
  1. | `List of Term.t list
  2. | `App of Term.t
]
type meth_pattern_el = string * Term.pattern option
type meth_ty_opt = {
  1. meth_ty_name : string;
  2. meth_ty_typ : Type.t;
  3. meth_ty_optional : bool;
  4. meth_ty_json_name : string option;
}
val let_decoration_of_lexer_let_decoration : [< `Eval | `Json_parse | `None | `Recursive | `Replaces | `Yaml_parse ] -> [> `Eval | `Json_parse of 'a list | `None | `Recursive | `Replaces | `Yaml_parse ]
val string_of_let_decoration : [< `Eval | `Json_parse of 'a | `None | `Recursive | `Replaces | `Yaml_parse ] -> string
val args_of_json_parse : pos:Pos.t -> (string * 'a) list -> (string * 'a) list
val gen_args_of : only:string list -> except:string list -> pos:Pos.t -> (pos:Pos.t -> Type.t -> (string * string * Value.t option) list -> 'a) -> string -> 'a
val args_of : only:string list -> except:string list -> pos:Pos.t -> string -> (string * string * Type.t * Term.t option) list
val app_of : only:string list -> except:string list -> pos:Pos.t -> string -> (string * Term.t) list
val mk : ?pos:Pos.t -> ?t:Type.t -> ?methods:Term.term Term.Methods.t -> Term.in_term -> Term.t
val append_list : pos:Pos.t -> [< `Ellipsis of Term.t | `Expr of Term.t ] -> [< `App of Term.t | `List of Term.t list ] -> [> `App of Term.t | `List of Term.t list ]
val mk_list : pos:Pos.t -> [< `App of Term.t | `List of Term.t list ] -> Term.t
val mk_fun : pos:Pos.t -> (string * Term.Vars.elt * Type.t * Term.t option) list -> Term.t -> Term.t
val mk_app_invoke_default : pos:Pos.t -> args:(Term.Vars.elt * 'a) list -> Term.t -> Term.t

When doing chained calls, we want to update all nested defaults so that, e.g. in: `x?.foo.gni.bla(123)?.gno.gni`, the default for `x.foo` becomes: `any.gni = any.{ bla = fun (_) -> any.{ gno = any.{ gni = null()

}

}

}

` we also need to keep track of which methods are optional in the default value's type to make sure it doesn't force optional methods to be mandatory during type checking.

val mk_any : pos:Pos.t -> unit -> Term.t
val mk_invoke_default : pos:Pos.t -> optional:bool -> name:string -> Term.term -> Term.invoke -> Term.t * Term.t
val update_invoke_default : pos:Pos.t -> optional:bool -> Term.t -> string -> Term.t -> Term.t
val mk_invoke : ?default:Term.t -> pos:Pos.t -> Term.t -> [< `App of string * (Term.Vars.elt * Term.t) list | `String of string ] -> Term.t
val mk_coalesce : pos:Pos.t -> default:Term.t -> Term.t -> Term.t
val mk_let_json_parse : pos:Pos.t -> ((string * Term.t) list * Term.pattern * Term.t * Type.t option) -> Term.t -> Term.t
val mk_let_yaml_parse : pos:Pos.t -> (Term.pattern * Term.t * Type.t option) -> Term.t -> Term.t
val mk_rec_fun : pos:Pos.t -> Term.pattern -> (string * Term.Vars.elt * Type.t * Term.t option) list -> Term.t -> Term.t
val mk_eval : pos:Pos.t -> (Term.doc option * Term.pattern * Term.t * Term.t * Type.t option) -> Term.t
val mk_let : pos:Pos.t -> binding -> Term.t -> Term.t
val mk_encoder : pos:Pos.t -> string -> Term.encoder_params -> Term.t

Time intervals

val time_units : int array
val date : pos:Pos.t -> int option list -> int

Given a date specified as a list of four values (whms), return a date in seconds from the beginning of the week.

val last_index : 'a option list -> int

Give the index of the first non-None value in the list.

val precision : 'a option list -> int

Give the precision of a date-as-list. For example, the precision of Xs is 1, XmYs is 60, XhYmZs 3600, etc.

val duration : 'a option list -> int

Give the duration of a data-as-list. For example, the duration of Xs is 1, Xm 60, XhYm 60, etc.

val between : pos:Pos.t -> int option list -> int option list -> int * int * int
val during : pos:Pos.t -> int option list -> int * int * int
val mk_time_pred : pos:Pos.t -> (int * int * int) -> Term.t
val mk_source_ty : pos:Pos.t -> string -> (string * (string * (string * string) list)) list -> extensible:bool -> Type.t
val mk_json_assoc_object_ty : pos:Pos.t -> (Type.t * string * string * string) -> Type.t
val mk_ty : pos:Pos.t -> string -> Type.t
val mk_invoke_ty : pos:Pos.t -> Type.t -> string -> Type.t
OCaml

Innovation. Community. Security.