package catala

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Clerk_utils.VarSource

include module type of struct include Ninja_utils.Var end
Sourcetype 'a t = 'a Ninja_utils.Var.t =
  1. | Scalar : string -> string t
  2. | Vector : string -> Ninja_utils.Expr.t t
    (*

    A Scalar holds a string: referenced with ref, embeddable inside any Word or path. A Vector holds an Expr.t: referenced only whole, with Splice, in commands.

    *)
Sourcetype scalar = string t
Sourceval make_scalar : string -> scalar
Sourceval make_vector : string -> vector
Sourceval name : 'a t -> string

Var base name, used when binding it

Sourceval ref : string t -> string

Var reference with a preceding "$", for use in strings

Quoting rules

Quoting belongs to the boundary a value crosses, never to the stored value; the variable's type says what crosses: string t expands to exactly one word (quoted at emission where the consumer requires it), Expr.t t to a word list (spliced).

Ninja variable names

Global vars: always defined, at toplevel

Sourceval ninja_required_version : string t
Sourceval builddir : string t
Sourceval clerk_exe : string t
Sourceval clerk_flags : Ninja_utils.Expr.t t
Sourceval catala_exe : string t
Sourceval catala_flags : Ninja_utils.Expr.t t
Sourceval runtime : string t

Definition spreading different rules

Sourceval tdir : string t

Rule vars, Used in specific rules

Sourceval input : string t
Sourceval output : string t
Sourceval src : string t
Sourceval dst : string t
Sourceval rspfile : string t
Sourceval rspfile_content : string t
Sourceval test_files : string t
Sourceval test_id : string t

Utility functions

Sourcetype bindings = Ninja_utils.Binding.any list
Sourceval binding_of_words : 'a t -> string list -> Ninja_utils.Binding.any

Packs flat words into a typed payload; errors if a scalar var receives several words

Sourceval binding_of_words_override : 'a t -> string list -> Ninja_utils.Binding.any

binding_of_words plus the border guards (no refs, no quote characters) — for user-supplied override values only

Sourceval binding_to_words : Ninja_utils.Binding.any -> string list

Projection to the string-level env consumed by get_var/direct exec

Sourceval env_of_bindings : bindings -> (string * string list) list
Sourceval file_list_to_string : string list -> string

Content of the Windows dir-tests response file, read back by file_list_of_string (clerk cat-list)

Sourceval file_list_of_string : string -> string list
Sourceval get : bindings -> 'a t -> string list

replaces ${xvar} with its value, recursively

Sourceval expand : bindings -> string -> string

expands ${xvar} references in the given string

Sourceval expr_elt_to_list : ?var_bindings:bindings -> Ninja_utils.Expr.elt -> string list

Resolves an expression element in-depth

Sourceval expr_elt_to_string : ?var_bindings:bindings -> Ninja_utils.Expr.elt -> string

Resolves an expression element in-depth, and concatenates the result with spaces, without escaping

Sourceval expr_to_list : ?var_bindings:bindings -> Ninja_utils.Expr.t -> string list

Resolves an expression in-depth

Sourcemodule Op : sig ... end
include module type of Op
Sourceval (!) : string t -> string

Alias to Var.ref. Run-time reference to the given variable !var = "${xvarname}", for inclusion in strings

Sourceval (!!) : 'a t -> Ninja_utils.Expr.elt

Run-time reference to the given variable !var = "${xvarname}" as an expression element that will be appropriately quoted. This handles specific quoting rules of the input and output variables by Ninja