package sexp_grammar

  1. Overview
  2. Docs
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 =
  1. | Any of Base.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 Base.list
  11. | Tagged of grammar with_tag
  12. | Tyvar of Base.string
  13. | Tycon of Base.string * grammar Base.list
  14. | Recursive of grammar * defn Base.list
  15. | Lazy of grammar Base.Lazy.t
and list_grammar = Sexp_grammar__.Sexp_grammar_intf.{Sexp_grammar}1.list_grammar =
  1. | Empty
  2. | Cons of grammar * list_grammar
  3. | Many of grammar
  4. | Fields of record
and record = Sexp_grammar__.Sexp_grammar_intf.{Sexp_grammar}1.record = {
  1. allow_extra_fields : Base.bool;
  2. fields : field with_tag_list Base.list;
}
and field = Sexp_grammar__.Sexp_grammar_intf.{Sexp_grammar}1.field = {
  1. name : Base.string;
  2. required : Base.bool;
  3. args : list_grammar;
}
and case_sensitivity = Sexp_grammar__.Sexp_grammar_intf.{Sexp_grammar}1.case_sensitivity =
  1. | Case_insensitive
  2. | Case_sensitive
  3. | Case_sensitive_except_first_character
and variant = Sexp_grammar__.Sexp_grammar_intf.{Sexp_grammar}1.variant = {
  1. case_sensitivity : case_sensitivity;
  2. clauses : clause with_tag_list Base.list;
}
and clause = Sexp_grammar__.Sexp_grammar_intf.{Sexp_grammar}1.clause = {
  1. name : Base.string;
  2. clause_kind : clause_kind;
}
and clause_kind = Sexp_grammar__.Sexp_grammar_intf.{Sexp_grammar}1.clause_kind =
  1. | Atom_clause
  2. | List_clause of {
    1. args : list_grammar;
    }
and 'a with_tag = 'a Sexp_grammar__.Sexp_grammar_intf.{Sexp_grammar}1.with_tag = {
  1. key : Base.string;
  2. value : Base.Sexp.t;
  3. grammar : 'a;
}
and 'a with_tag_list = 'a Sexp_grammar__.Sexp_grammar_intf.{Sexp_grammar}1.with_tag_list =
  1. | Tag of 'a with_tag_list with_tag
  2. | No_tag of 'a
and defn = Sexp_grammar__.Sexp_grammar_intf.{Sexp_grammar}1.defn = {
  1. tycon : Base.string;
  2. tyvars : Base.string Base.list;
  3. grammar : grammar;
}
and 'a t = 'a Sexp_grammar__.Sexp_grammar_intf.{Sexp_grammar}1.t = {
  1. untyped : grammar;
}
val compare_grammar : grammar -> grammar -> Base.int
val compare_list_grammar : list_grammar -> list_grammar -> Base.int
val compare_record : record -> record -> Base.int
val compare_field : field -> field -> Base.int
val compare_case_sensitivity : case_sensitivity -> case_sensitivity -> Base.int
val compare_variant : variant -> variant -> Base.int
val compare_clause : clause -> clause -> Base.int
val compare_clause_kind : clause_kind -> clause_kind -> Base.int
val compare_with_tag : ('a -> 'a -> Base.int) -> 'a with_tag -> 'a with_tag -> Base.int
val compare_with_tag_list : ('a -> 'a -> Base.int) -> 'a with_tag_list -> 'a with_tag_list -> Base.int
val compare_defn : defn -> defn -> Base.int
val compare : ('a -> 'a -> Base.int) -> 'a t -> 'a t -> Base.int
val equal_grammar : grammar -> grammar -> Base.bool
val equal_list_grammar : list_grammar -> list_grammar -> Base.bool
val equal_record : record -> record -> Base.bool
val equal_field : field -> field -> Base.bool
val equal_case_sensitivity : case_sensitivity -> case_sensitivity -> Base.bool
val equal_variant : variant -> variant -> Base.bool
val equal_clause : clause -> clause -> Base.bool
val equal_clause_kind : clause_kind -> clause_kind -> Base.bool
val equal_with_tag : ('a -> 'a -> Base.bool) -> 'a with_tag -> 'a with_tag -> Base.bool
val equal_with_tag_list : ('a -> 'a -> Base.bool) -> 'a with_tag_list -> 'a with_tag_list -> Base.bool
val equal_defn : defn -> defn -> Base.bool
val equal : ('a -> 'a -> Base.bool) -> 'a t -> 'a t -> 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.

val coerce : _ t -> _ t

Folds over a grammar.

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.

Tagging

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.