package atdgen

  1. Overview
  2. Docs
type position = [
  1. | `Length
  2. | `Position of int
  3. | `End
]
type value = [
  1. | `Int of int
  2. | `Char of char
]
type 'a tree = [
  1. | `Node of position * (value * 'a tree) list
  2. | `Branch of (position * value) list * 'a tree
  3. | `Leaf of 'a
]
val make_tree : (string * 'a) list -> 'a tree
type exit_with = [
  1. | `Exn of string
  2. | `Expr
]

`Exn s raises an exception for each failure branch, and this exception is caught in one place, avoiding duplication of the error_expr expression.

`Expr uses the error_expr in each failure branch, resulting in code duplication but avoiding raising and catching an exception. Suitable for fixed-length values for which code duplication is tolerable.

val make_ocaml_expr_factored : ?string_id:string -> ?pos_id:string -> ?len_id:string -> ?exit_with:exit_with -> error_expr:Ag_indent.t list -> (string option * Ag_indent.t list) list -> Ag_indent.t list
val make_ocaml_expr_naive : ?string_id:string -> ?pos_id:string -> ?len_id:string -> error_expr:Ag_indent.t list -> (string option * Ag_indent.t list) list -> Ag_indent.t list
val make_ocaml_expr : optimized:bool -> ?string_id:string -> ?pos_id:string -> ?len_id:string -> ?exit_with:exit_with -> error_expr:Ag_indent.t list -> (string option * Ag_indent.t list) list -> Ag_indent.t list
val make_ocaml_int_mapping : ?string_id:string -> ?pos_id:string -> ?len_id:string -> ?exit_with:exit_with -> error_expr1:Ag_indent.t list -> ?error_expr2:Ag_indent.t list -> ?int_id:string -> (string option * Ag_indent.t list) list -> Ag_indent.t list * Ag_indent.t list