package ppxlib

  1. Overview
  2. Docs
type t
val get : t -> Base.String.t -> (Ppxlib_ast__.Import.Parsetree.expression, 'a -> 'a, 'b) Ast_pattern.t -> 'b Base.Option.t

get cookies name pattern look for a cookie named name and parse it using pattern.

val set : t -> Base.String.t -> Ppxlib_ast__.Import.Parsetree.expression -> Base.Unit.t

set cookies name expr set cookie name to expr.

val add_handler : (t -> Base.Unit.t) -> Base.Unit.t

Register a callback that is called before a rewriting. The handler is expected to lookup some cookies and set some global variables.

This API is a temporary hack to allow to migrate from add_arg to the use of cookie, until ppxlib has been upgraded to pass cookies through.

val add_simple_handler : Base.String.t -> (Ppxlib_ast__.Import.Parsetree.expression, 'a -> 'a, 'b) Ast_pattern.t -> f:('b Base.Option.t -> Base.Unit.t) -> Base.Unit.t

Shorthand for: add_handler (fun t -> f (get t name pattern))

val add_post_handler : (t -> Base.Unit.t) -> Base.Unit.t

Register a callback that is called after a rewriting. The handler is expected to set some cookies from some global variables.

OCaml

Innovation. Community. Security.