package reason

  1. Overview
  2. Docs
val is_prefixed : string -> string -> int -> bool

is_prefixed prefix i str checks if prefix is the prefix of str * starting from position i

val pick_while : ('a -> bool) -> 'a list -> 'a list * 'a list

* pick_while returns a tuple where first element is longest prefix (possibly empty) of the list of elements that satisfy p * and second element is the remainder of the list

val replace_string_ : string -> string -> int -> string -> Buffer.t -> unit
val replace_string : string -> string -> string -> string

replace_string old_str new_str str replaces old_str to new_str in str

val split_by : ?keep_empty:bool -> (char -> bool) -> string -> string list
val trim_right_idx : string -> int -> int
val trim_right : string -> string
val strip_trailing_whitespace : string -> string
module StringMap : sig ... end
val syntax_error_extension_node : Ast_404.Location.t -> string -> string Ast_404.Location.loc * Ast_404.Parsetree.payload

Generate a suitable extension node for Merlin's consumption, for the purposes of reporting a syntax error - only used in recovery mode.

val reason_to_ml_swapping_alist : (string * string) list
val identifier_mapper : (string -> string) -> Ast_404.Ast_mapper.mapper

identifier_mapper maps all identifiers in an AST with a mapping function f

val create_auto_printer_mapper : Ast_404.Ast_mapper.mapper
val unescape_stars_slashes_mapper : Ast_404.Ast_mapper.mapper

unescape_stars_slashes_mapper unescapes all stars and slases in an AST

val escape_stars_slashes_mapper : Ast_404.Ast_mapper.mapper

escape_stars_slashes_mapper escapes all stars and slases in an AST

* swap_operator_mapper is a mapper that swaps two operators at parse/print time. * We need this since we want to transform operator such as "=" in Ocaml to "==" in Reason. * In this case, in the parser, everytime we see a token "==" in Reason, we transform it into "="; * Similarly, in the printer, everytime we see a token "=", we transform it into "==";

val reason_to_ml_swap_map : string StringMap.t
val ml_to_reason_swap_map : string StringMap.t
val reason_to_ml_swap_operator_mapper : Ast_404.Ast_mapper.mapper
val ml_to_reason_swap_operator_mapper : Ast_404.Ast_mapper.mapper
val attribute_equals : 'a -> ('a Ast_404.Asttypes.loc * 'b) -> bool
val attribute_exists : 'a -> ('a Ast_404.Asttypes.loc * 'b) list -> bool
val attributes_conflicted : 'a -> 'a -> ('a Ast_404.Asttypes.loc * 'b) list -> bool
val normalized_attributes : 'a -> ('a Ast_404.Asttypes.loc * 'b) list -> ('a Ast_404.Asttypes.loc * 'b) list
type error =
  1. | Syntax_error of string
exception Error of Ast_404.Location.t * error
val report_error : Format.formatter -> error -> unit
type menhirMessagesError = {
  1. msg : string;
  2. loc : Ast_404.Location.t;
}
type menhirError =
  1. | NoMenhirMessagesError
  2. | MenhirMessagesError of menhirMessagesError
val menhirMessagesError : menhirError list Pervasives.ref
val findMenhirErrorMessage : Ast_404.Location.t -> menhirError
val add_error_message : menhirMessagesError -> unit
OCaml

Innovation. Community. Security.