Library
Module
Module type
Parameter
Class
Class type
module type Callbacks_for_fold_common = sig ... end
module type Callbacks_for_fold_nonrecursive = sig ... end
module type Callbacks_for_fold_recursive = sig ... end
module type Fold = sig ... end
module type Fold_partial = sig ... end
module Field : sig ... end
module Case_sensitivity : sig ... end
type grammar = Sexp_grammar__.Sexp_grammar_intf.{Sexp_grammar}1.grammar =
| Any of Base.string
| Bool
| Char
| Integer
| Float
| String
| Option of grammar
| List of list_grammar
| Variant of variant
| Union of grammar Base.list
| Tagged of grammar with_tag
| Tyvar of Base.string
| Tycon of Base.string * grammar Base.list
| Recursive of grammar * defn Base.list
| Lazy of grammar Base.Lazy.t
and list_grammar =
Sexp_grammar__.Sexp_grammar_intf.{Sexp_grammar}1.list_grammar =
| Empty
| Cons of grammar * list_grammar
| Many of grammar
| Fields of record
and record = Sexp_grammar__.Sexp_grammar_intf.{Sexp_grammar}1.record = {
allow_extra_fields : Base.bool;
fields : field with_tag_list Base.list;
}
and field = Sexp_grammar__.Sexp_grammar_intf.{Sexp_grammar}1.field = {
name : Base.string;
required : Base.bool;
args : list_grammar;
}
and variant = Sexp_grammar__.Sexp_grammar_intf.{Sexp_grammar}1.variant = {
case_sensitivity : case_sensitivity;
clauses : clause with_tag_list Base.list;
}
and clause = Sexp_grammar__.Sexp_grammar_intf.{Sexp_grammar}1.clause = {
name : Base.string;
clause_kind : clause_kind;
}
and clause_kind = Sexp_grammar__.Sexp_grammar_intf.{Sexp_grammar}1.clause_kind =
| Atom_clause
| List_clause of {
args : list_grammar;
}
and 'a with_tag = 'a Sexp_grammar__.Sexp_grammar_intf.{Sexp_grammar}1.with_tag =
{
key : Base.string;
value : Base.Sexp.t;
grammar : 'a;
}
and 'a with_tag_list =
'a Sexp_grammar__.Sexp_grammar_intf.{Sexp_grammar}1.with_tag_list =
| Tag of 'a with_tag_list with_tag
| No_tag of 'a
and defn = Sexp_grammar__.Sexp_grammar_intf.{Sexp_grammar}1.defn = {
tycon : Base.string;
tyvars : Base.string Base.list;
grammar : grammar;
}
val compare_list_grammar : list_grammar -> list_grammar -> Base.int
val compare_case_sensitivity : case_sensitivity -> case_sensitivity -> Base.int
val compare_clause_kind : clause_kind -> clause_kind -> Base.int
val compare_with_tag_list :
('a -> 'a -> Base.int) ->
'a with_tag_list ->
'a with_tag_list ->
Base.int
val equal_list_grammar : list_grammar -> list_grammar -> Base.bool
val equal_case_sensitivity : case_sensitivity -> case_sensitivity -> Base.bool
val equal_clause_kind : clause_kind -> clause_kind -> Base.bool
val equal_with_tag_list :
('a -> 'a -> Base.bool) ->
'a with_tag_list ->
'a with_tag_list ->
Base.bool
val sexp_of_grammar : grammar -> Sexplib0.Sexp.t
val sexp_of_list_grammar : list_grammar -> Sexplib0.Sexp.t
val sexp_of_record : record -> Sexplib0.Sexp.t
val sexp_of_field : field -> Sexplib0.Sexp.t
val sexp_of_case_sensitivity : case_sensitivity -> Sexplib0.Sexp.t
val sexp_of_variant : variant -> Sexplib0.Sexp.t
val sexp_of_clause : clause -> Sexplib0.Sexp.t
val sexp_of_clause_kind : clause_kind -> Sexplib0.Sexp.t
val sexp_of_with_tag :
('a -> Sexplib0.Sexp.t) ->
'a with_tag ->
Sexplib0.Sexp.t
val sexp_of_with_tag_list :
('a -> Sexplib0.Sexp.t) ->
'a with_tag_list ->
Sexplib0.Sexp.t
val sexp_of_defn : defn -> Sexplib0.Sexp.t
val sexp_of_t : ('a -> Sexplib0.Sexp.t) -> 'a t -> Sexplib0.Sexp.t
For stable serializations of these types, see Sexp_grammar_stable
.
module Fold_nonrecursive
(Callbacks : Callbacks_for_fold_nonrecursive) :
Fold with type t := Callbacks.t and type list_t := Callbacks.list_t
Folds over a grammar.
module Fold_recursive
(Callbacks : Callbacks_for_fold_recursive) :
Fold_partial with type t := Callbacks.t and type list_t := Callbacks.list_t
Like Fold_nonrecursive
. Ties the knot for recursive grammars. May raise if the grammar contains malformed recursive definitions, e.g. an undefined type variable or applying a type constructor with the wrong arity. Exceptions may be delayed until of_lazy
values are forced.
module Eager_copy : Fold with type t := grammar and type list_t := list_grammar
An instance of Fold_nonrecursive
. Produces an equivalent grammar with no Lazy
nodes. Implicitly used by sexp_of_t
.
module Unroll_recursion :
Fold_partial with type t := grammar and type list_t := list_grammar
An instance of Fold_recursive
. Produces an equivalent grammar with no Recursive
, Tycon
, or Tyvar
nodes. This can be useful for subsequent grammar processing without the need for type variable / type constructor bookkeeping. The resulting tree may unfold infinitely, and uses Lazy
nodes to avoid divergence.
val first_tag_value :
(Base.string * Base.Sexp.t) Base.list ->
Base.string ->
(Sexplib0.Sexp.t -> 'a) ->
'a Base.Or_error.t Base.option
first_tag_value tags name of_sexp
returns the first value of name
in tags
.
val completion_suggested : Base.string
completion_suggested = false
on a variant constructor means that Sexp_grammar_completion
will not suggest the constructor as a completion. The constructor is still recognized as valid syntax. Completions are still suggested for its arguments.
Default is true
.
This tag is ignored if its value is not a bool or if it is not placed on a variant constructor.