sig
module Loc :
sig
type pos = int * int
val nil_pos : Carcass.Loc.pos
val zero_pos : Carcass.Loc.pos
type range = Carcass.Loc.pos * Carcass.Loc.pos
val nil_range : Carcass.Loc.range
val zero_range : Carcass.Loc.range
type src = Builtin | Cli | File of Fpath.t
type t = Carcass.Loc.src * Carcass.Loc.range
val nil : Carcass.Loc.t
val for_builtin : string -> Carcass.Loc.t
val for_cli : string -> Carcass.Loc.t
val for_path : ?range:Carcass.Loc.range -> Fpath.t -> Carcass.Loc.t
val pp : Carcass.Loc.t Fmt.t
type trace = Carcass.Loc.t list
val nil_trace : Carcass.Loc.trace
val pp_trace : Carcass.Loc.trace Fmt.t
end
module Error :
sig
type unexpected = [ `Eoi | `Lexeme of string | `Uchar of Uchar.t ]
type expected =
[ `Atom
| `Comma
| `Dollar
| `Escaped_char
| `Id
| `Keyword of string
| `Lpar
| `Qmark
| `Rpar ]
type parse_err =
Illegal_bytes of string
| Illegal_escape of Uchar.t
| Illegal_variable_transform of string
| Illegal_binding_id of string
| Unclosed of [ `Quoted_atom | `Var_ref ]
| Unexpected of Carcass.Error.unexpected *
Carcass.Error.expected list
type parse =
[ `Carcass_parse of Carcass.Error.parse_err * Carcass.Loc.t ]
val pp_parse_err : Carcass.Error.parse_err Fmt.t
val pp_parse : Carcass.Error.parse Fmt.t
type eval_id = [ `Body of string | `Bone of string | `Var of string ]
type eval_err =
Circular of Carcass.Error.eval_id
| Parse of Carcass.Error.eval_id *
[ `Carcass_parse of Carcass.Error.parse_err * Carcass.Loc.t
| `Msg of string ]
| Undefined of Carcass.Error.eval_id
| Bound_path of string * [ `Escapes | `Illegal ]
type eval =
[ `Carcass_eval of Carcass.Error.eval_err * Carcass.Loc.trace ]
val pp_eval_id : Carcass.Error.eval_id Fmt.t
val pp_eval_err : Carcass.Error.eval_err Fmt.t
val pp_eval : Carcass.Error.eval Fmt.t
end
module Pat :
sig
type transform = Uppercase | Lowercase | Capitalize | Uncapitalize
val transform_of_string : string -> Carcass.Pat.transform option
val transform_to_string : Carcass.Pat.transform -> string
val pp_transform : Carcass.Pat.transform Fmt.t
type lexeme =
Lit of string
| Var of string * Carcass.Pat.transform option
type t = (Carcass.Pat.lexeme * Carcass.Loc.t) list * Carcass.Loc.t
val empty : Carcass.Pat.t
val dom : Carcass.Pat.t -> Astring.String.set
val equal : Carcass.Pat.t -> Carcass.Pat.t -> bool
val compare : Carcass.Pat.t -> Carcass.Pat.t -> int
val to_string : ?flesh:bool -> Carcass.Pat.t -> string
val of_input :
?flesh:bool ->
src:Carcass.Loc.src ->
[ `Channel of Pervasives.in_channel | `String of string ] ->
(Carcass.Pat.t, [> Carcass.Error.parse ]) Result.result
val pp : ?flesh:bool -> Carcass.Pat.t Fmt.t
val subst : (string -> string option) -> Carcass.Pat.t -> Carcass.Pat.t
type env
val env :
?undef:(string ->
(Carcass.Pat.t, Carcass.Error.parse) Rresult.result option) ->
Carcass.Pat.t Astring.String.map -> Carcass.Pat.env
val env_var_value :
Carcass.Pat.env ->
string ->
(string * Carcass.Loc.t, [> Carcass.Error.eval ]) Rresult.result
option
val eval :
Carcass.Pat.env ->
Carcass.Pat.t ->
(string * Carcass.Loc.t, [> Carcass.Error.eval ]) Rresult.result
val query :
?init:string Astring.String.map ->
Carcass.Pat.t -> string -> string Astring.String.map option
end
module Ask :
sig
type ('a, 'b) t =
('a, Format.formatter, unit, 'b) Pervasives.format4 -> 'a
val value :
?ppf:Format.formatter ->
parse:(string -> ('a, 'b) Result.result) ->
('c, ('a, 'b) Result.result) Carcass.Ask.t
val pattern :
?ppf:Format.formatter ->
('a, (Carcass.Pat.t, [> Carcass.Error.parse ]) Result.result)
Carcass.Ask.t
val bool :
?ppf:Format.formatter -> default:bool -> ('a, bool) Carcass.Ask.t
val string :
?ppf:Format.formatter -> default:string -> ('a, string) Carcass.Ask.t
end
module Env :
sig
val etc_dir : Fpath.t
val user_dir : unit -> (Fpath.t, [> Rresult.R.msg ]) Rresult.result
type t
val v :
no_user_dir:bool ->
no_dot_dirs:bool ->
dirs:Fpath.t list ->
flesh:Fpath.t list ->
cli:(string * Carcass.Pat.t) list -> Carcass.Env.t
end
module Flesh :
sig
type t = Carcass.Pat.t Astring.String.map
val builtins : Carcass.Flesh.t
val of_input :
?init:Carcass.Pat.t Astring.String.map ->
src:Carcass.Loc.src ->
[ `Channel of Pervasives.in_channel | `String of string ] ->
(Carcass.Flesh.t, [> Carcass.Error.parse ]) Result.result
val of_env :
?init:Carcass.Pat.t Astring.String.map ->
Carcass.Env.t ->
(Carcass.Flesh.t, [> Carcass.Error.parse ]) Result.result
val pp_def : Carcass.Pat.t Fmt.t
val pp : Carcass.Flesh.t Fmt.t
end
module Bone :
sig
type id = Fpath.t
val find : Carcass.Env.t -> Carcass.Bone.id -> Fpath.t option
val list : ?hidden:bool -> Carcass.Env.t -> Fpath.t Fpath.map
type content = Binary of string | Pat of Carcass.Pat.t
type t
val id : Carcass.Bone.t -> Carcass.Bone.id
val content : Carcass.Bone.t -> Carcass.Bone.content
val is_exec : Carcass.Bone.t -> bool
val of_input :
?trim:bool ->
src:Carcass.Loc.src ->
[ `String of string ] ->
is_exec:bool ->
Carcass.Bone.id ->
(Carcass.Bone.t, [> Carcass.Error.parse ]) Result.result
val of_path :
?trim:bool ->
Fpath.t ->
Carcass.Bone.id ->
(Carcass.Bone.t,
[> `Carcass_parse of Carcass.Error.parse_err * Carcass.Loc.t
| `Msg of string ])
Rresult.result
val eval :
Carcass.Pat.env ->
Carcass.Bone.t -> (string, [> Carcass.Error.eval ]) Rresult.result
end
module Body :
sig
type id = Fpath.t
val find : Carcass.Env.t -> Carcass.Body.id -> Fpath.t option
val list : ?hidden:bool -> Carcass.Env.t -> Fpath.t Fpath.map
type binding_id = Fpath.t
type t
val id : Carcass.Body.t -> Carcass.Body.id
val doc : Carcass.Body.t -> string * string
val var_docs : Carcass.Body.t -> string Astring.String.map
val bindings :
Carcass.Body.t ->
(Carcass.Pat.t * (Carcass.Body.binding_id * Carcass.Loc.t)) list
val of_input :
src:Carcass.Loc.src ->
[ `Channel of Pervasives.in_channel | `String of string ] ->
Carcass.Body.id ->
(Carcass.Body.t, [> Carcass.Error.parse ]) Result.result
val of_path :
Fpath.t ->
Carcass.Body.id ->
(Carcass.Body.t,
[> `Carcass_parse of Carcass.Error.parse_err * Carcass.Loc.t
| `Msg of string ])
Rresult.result
val eval_paths :
Carcass.Env.t ->
Carcass.Pat.env ->
Carcass.Body.t ->
((Carcass.Bone.id * Carcass.Loc.trace) Fpath.map,
[> `Carcass_eval of Carcass.Error.eval_err * Carcass.Loc.trace
| `Msg of string ])
Rresult.result
val eval_bones :
Carcass.Env.t ->
Carcass.Pat.env ->
(Carcass.Bone.id * Carcass.Loc.trace) Fpath.map ->
((string * bool) Fpath.map,
[> `Carcass_eval of Carcass.Error.eval_err * Carcass.Loc.trace
| `Msg of string ])
Rresult.result
val write :
?wrote:(Fpath.t -> unit) ->
?over:(Fpath.t -> bool) ->
dst:Fpath.t ->
(string * bool) Fpath.map ->
(unit, [> Rresult.R.msg ]) Rresult.result
end
end