Module Camlp4Utils

module Camlp4Utils: sig .. end
Utility functions related to the camlp4 library.

val line_and_column_of_location : Camlp4.PreCast.Ast.Loc.t -> int * int option
Converts the passed location into a (line, column) pair.
val string_of_ident : Camlp4.PreCast.Ast.ident -> string
Converts the passed identifier into a string.
val use_original_syntax : bool Pervasives.ref
Whether to use the original syntax (as opposed to the revised one), initially set to true.

Whitespace functions

val check_white : string -> string -> (string -> unit) -> Camlp4.Sig.camlp4_token -> unit
check_white kind symbol report token calls report with a message about symbol (of kind kind) if token is not a white element. Does nothing otherwise.
val check_not_white : string -> string -> (string -> unit) -> Camlp4.Sig.camlp4_token -> unit
check_not_white kind symbol report token calls report with a message about symbol (of kind kind) if token is a white element. Does nothing otherwise.
val check_first_white : string ->
string ->
(string -> unit) -> ('a * 'b * Camlp4.Sig.camlp4_token) list -> unit
check_first_white kind symbol report l applies check_white on the head of l if non-empty, does nothing otherwise.
val check_first_not_white : string ->
string ->
(string -> unit) -> ('a * 'b * Camlp4.Sig.camlp4_token) list -> unit
check_first_not_white kind symbol report l applies check_not_white on the head of l if non-empty, does nothing otherwise.

Debug functions

val print_structure : Camlp4.PreCast.Ast.str_item -> unit
Prints the passed element for debuging purposes.
val print_signature : Camlp4.PreCast.Ast.sig_item -> unit
Prints the passed element for debuging purposes.
val string_of_token : Camlp4.Sig.camlp4_token -> string
Converts the passed element into a string.
val print_tokens : (int * int * Camlp4.Sig.camlp4_token) list -> unit
Prints the passed element for debuging purposes.

Miscellaneous functions

val binary_names : string list
Base name of camlp4 syntax binaries.
val is_revised_binary : string -> bool
Tests whether a string from binary_names is related to revised syntax. Returns false if the string is not in binary_names.
val predefined_modules : string list
Predefined modules from camlp4 binaries.