module Pa_estring:sig..end
typespecifier =string
type context
val register_expr_specifier : specifier ->
(context ->
Camlp4.PreCast.Loc.t -> string -> Camlp4.PreCast.Ast.expr) ->
unitregister_expr_specifier spec f registers f as a mapping
function for string with the specifier spec in expressions.val register_patt_specifier : specifier ->
(context ->
Camlp4.PreCast.Loc.t -> string -> Camlp4.PreCast.Ast.patt) ->
unitregister_patt_specifier spec f same thing but for strings in
patternsval register_when_specifier : specifier ->
(context ->
Camlp4.PreCast.Loc.t ->
Camlp4.PreCast.Ast.ident -> string -> Camlp4.PreCast.Ast.expr) ->
unitregister_when_specifier spec f same thing, but for strings in
match case, which will be compared using a when clause. f
takes as argument the identifier used in the pattern and the
string. : context -> Camlp4.PreCast.Ast.expr -> Camlp4.PreCast.Ast.identregister_shared_expr context expr registers expr as a shared
constant and return the identifier to which it is bound. The
binding will be placed in the current definition.
for example with the following specifier:
register_expr_specifier "u"
(fun context _loc str ->
let id = register_shared_expr context <:expr< UTF8.of_string $str:str$ >> in
<:expr< $id:id$ >>)
The following definition:
let f x y z = u"foo"
will be expanded to:
let f =
let __estring_shared_0 = UTF8.of_string "foo" in
fun x y z -> __estring_shared_0
(char * Loc.t) list is not
suitable since we do not know the location of the end of the
list. The right choise is:type 'a llist =
| |
Nil of |
| |
Cons of |
val loc_of_llist : 'a llist -> Camlp4.PreCast.Loc.tval llength : 'a llist -> intval lfoldr : (Camlp4.PreCast.Loc.t -> 'a -> 'acc -> 'acc) ->
(Camlp4.PreCast.Loc.t -> 'acc) -> 'a llist -> 'acclfoldr f g l fold_right-like function for llist.
For example:
lfoldr f g (Cons(loc1, 1, Cons(loc2, 2, Nil loc3)))
is the same as:
f loc1 1 (f loc2 2 (g loc3))
val list_of_llist : 'a llist -> 'a listval llist_of_list : Camlp4.PreCast.Loc.t -> 'a list -> 'a llistllist_of_list loc l Create a llist with all elements from l.
The nth element will be at loc + n.val ldrop : int -> 'a llist -> 'a llistldrop count ll returns ll without its firsts count
elements.val ltake : int -> 'a llist -> 'a llistltake count ll returns the firsts count elements of ll.val lappend : 'a llist -> 'a llist -> 'a llistlappend ll1 ll2 appends ll2 to ll1val llist_expr : (Camlp4.PreCast.Loc.t -> 'a -> Camlp4.PreCast.Ast.expr) ->
'a llist -> Camlp4.PreCast.Ast.exprllist_expr f ll returns the expression representing a list
with element obtained by applying f on element of llval llist_patt : (Camlp4.PreCast.Loc.t -> 'a -> Camlp4.PreCast.Ast.patt) ->
'a llist -> Camlp4.PreCast.Ast.patt
val unescape : Camlp4.PreCast.Loc.t -> string -> char llistunescape loc str returns the unescaped version of str where
each unescaped character position has been computed