Module Acutis_internals.Compile

Orchestrate the Lexer, Parser, Typechecker, and Matching to produce the final template.

type 'a map_string := 'a Stdlib.Map.Make(Stdlib.String).t
type escape = Ast.escape =
  1. | No_escape
  2. | Escape
type echo_format = Ast.echo_format =
  1. | Fmt_string
  2. | Fmt_int
  3. | Fmt_float
  4. | Fmt_bool
type echo = [
  1. | `Var of string
  2. | `String of string
  3. | `Field of echo * string
]
type data = [
  1. | `Null
  2. | `Int of int
  3. | `Float of float
  4. | `String of string
  5. | `Array of data array
  6. | `Assoc of data map_string
  7. | `Var of string
  8. | `Field of data * string
  9. | `Block of int
    (*

    To separate the data from the rest of the tree, we take any template blocks and place them into a blocks. At runtime, the `Block constructors will get their rendered content based on their indices.

    *)
]
type blocks

A sequence of nodes, indexed by integers.

type node =
  1. | Text of string
  2. | Echo of (echo_format * echo) list * echo_format * echo * escape
  3. | Match of blocks * data array * nodes Matching.t
  4. | Map_list of blocks * data * nodes Matching.t
  5. | Map_dict of blocks * data * nodes Matching.t
  6. | Component of string * blocks * data map_string
and nodes = node list
val blocks_length : blocks -> int
val blocks_to_seq : blocks -> (int * nodes) Stdlib.Seq.t
module Components : sig ... end
type parsed = {
  1. fname : string;
  2. ast : Ast.t;
}
val parse : Stdlib.Lexing.lexbuf -> parsed
type 'a t = {
  1. fname : string;
  2. types : Typechecker.Type.interface;
  3. components : (string * nodes) list;
    (*

    Components are topologically ordered.

    *)
  4. externals : (string * Typechecker.Type.interface * 'a) list;
  5. nodes : nodes;
}
val make : 'a Components.t -> parsed -> 'a t
val interface : Stdlib.Lexing.lexbuf -> Typechecker.Type.interface
module Ty_repr : sig ... end