package sexplib

  1. Overview
  2. Docs
include Sexp_grammar_intf.Sexp_grammar
module type S = Sexp_grammar_intf.S
include module type of struct include Sexplib0.Sexp_grammar end
type grammar = Sexplib0__Sexp_grammar.grammar =
  1. | Any of string
  2. | Bool
  3. | Char
  4. | Integer
  5. | Float
  6. | String
  7. | Option of grammar
  8. | List of list_grammar
  9. | Variant of variant
  10. | Union of grammar list
  11. | Tagged of grammar with_tag
  12. | Tyvar of string
  13. | Tycon of string * grammar list * defn list
  14. | Recursive of string * grammar list
  15. | Lazy of grammar lazy_t
and list_grammar = Sexplib0__Sexp_grammar.list_grammar =
  1. | Empty
  2. | Cons of grammar * list_grammar
  3. | Many of grammar
  4. | Fields of record
and case_sensitivity = Sexplib0__Sexp_grammar.case_sensitivity =
  1. | Case_insensitive
  2. | Case_sensitive
  3. | Case_sensitive_except_first_character
and variant = Sexplib0__Sexp_grammar.variant = {
  1. case_sensitivity : case_sensitivity;
  2. clauses : clause with_tag_list list;
}
and clause = Sexplib0__Sexp_grammar.clause = {
  1. name : string;
  2. clause_kind : clause_kind;
}
and clause_kind = Sexplib0__Sexp_grammar.clause_kind =
  1. | Atom_clause
  2. | List_clause of {
    1. args : list_grammar;
    }
and record = Sexplib0__Sexp_grammar.record = {
  1. allow_extra_fields : bool;
  2. fields : field with_tag_list list;
}
and field = Sexplib0__Sexp_grammar.field = {
  1. name : string;
  2. required : bool;
  3. args : list_grammar;
}
and !'a with_tag = 'a Sexplib0__Sexp_grammar.with_tag = {
  1. key : string;
  2. value : Sexplib0__.Sexp.t;
  3. grammar : 'a;
}
and !'a with_tag_list = 'a Sexplib0__Sexp_grammar.with_tag_list =
  1. | Tag of 'a with_tag_list with_tag
  2. | No_tag of 'a
and defn = Sexplib0__Sexp_grammar.defn = {
  1. tycon : string;
  2. tyvars : string list;
  3. grammar : grammar;
}
type !'a t = 'a Sexplib0__Sexp_grammar.t = {
  1. untyped : grammar;
}
val coerce : 'a t -> 'b t
val tag : 'a t -> key:string -> value:Sexplib0__.Sexp.t -> 'a t
val doc_comment_tag : string
val type_name_tag : string
val assoc_tag : string
val assoc_key_tag : string
val assoc_value_tag : string
val completion_suggested : string
val remember_to_update_these_together : t_of_sexp:(Sexp.t -> 'a) -> t_sexp_grammar:'a t -> (Sexp.t -> 'a) * 'a t

Idiomatic usage looks like this:

let t_of_sexp, t_sexp_grammar =
  remember_to_update_these_together ~t_of_sexp ~t_sexp_grammar
OCaml

Innovation. Community. Security.