Library
Module
Module type
Parameter
Class
Class type
the different kinds of litteral corresponding to the (Pconst_int) ast node
the different kinds of base for litteral numbers
the different kind of notation for floats
raised when a string does not match the format defined by OCaml's lexer for floats and integer litterals
val categorize_repr : string -> string * integer_kind
Categorizes a non-empty string into an integer_kind. Returns the pair formed by the string where the suffixes (n,l,L) where removed if present, and the corresponding integer_kind
val categorize_base : string -> string * base_kind
categorizes a non-empty string into a base. Returns the pair formed by the string where the prefixes (0o,0x,0b) where removed if present, and the corresponding base
val categorize_notation : string -> base_kind -> float_notation
Given a non-empty string representation of a float, and a base (either hexa or decimal), computes the associated float_notation
val q_of_char : char -> Q.t
val int_of_base : base_kind -> int
val parse_base : int -> string -> Q.t
Computes exactly the rational corresponding to the litteral in the given base. Works for both integers and floats, for all bases
Computes exactly the rational corresponding to the litteral in the given base. Works for both integers and floats, for all bases, and for both scientific and regular notation
val positive_rat_of_string : string -> Q.t
builds the rationnal corresponding to a string following OCaml's lexical conventions : | (0…9) 0…9 ∣ _
| (0x) (0…9∣ A…F∣ a…f) 0…9∣ A…F∣ a…f∣ _
| (0o) (0…7) 0…7∣ _
| (0b) (0…1) 0…1∣ _
val rat_of_string : string -> Q.t
builds the rationnal corresponding to a string following OCaml's lexical conventions : | -
(0…9) 0…9 ∣ _
| -
(0x) (0…9∣ A…F∣ a…f) 0…9∣ A…F∣ a…f∣ _
| -
(0o) (0…7) 0…7∣ _
| -
(0b) (0…1) 0…1∣ _
val build_os :
(string -> 'a option) ->
('a -> Q.t) ->
string ->
('a, 'a option) Stdlib.result
builds an 'of_string' that convert a string representation of a value of a numeric type, to its corresponding value, while indicating if a loss of precision occured during the conversion