Commit ddd25de0 authored by erwan's avatar erwan
Browse files

New: add a value printer that prints arrays as if they were expanded (so the...

New: add a value printer that prints arrays as if they were expanded (so the RIF readers can do something with it)
parent 002dc28f
(* Time-stamp: <modified the 10/08/2015 (at 14:59) by Erwan Jahier> *)
(* Time-stamp: <modified the 04/04/2019 (at 21:27) by Erwan Jahier> *)
type ident = string
type v = I of int | F of float | B of bool
......@@ -41,6 +41,23 @@ let rec (val_to_string : (float -> string) -> v -> string) =
(!str^"]")
| U -> "nil"
let rec (val_to_rif_string : (float -> string) -> v -> string) =
fun s2f ->
function
| I i -> string_of_int i
| F f -> s2f f
| B true -> "t"
| B false -> "f"
| E (e,_) -> e
| S fl -> ""^(String.concat ";"
(List.map (fun (fn,fv) -> " "^(val_to_string s2f fv)) fl))^""
| A a ->
let str = ref "" in
let f i a = str := !str ^ (if i = 0 then "" else " ") ^ (val_to_string s2f a) in
Array.iteri f a;
(!str)
| U -> "nil"
let rec (type_to_string_gen : bool -> t -> string) =
fun alias v ->
......
(* Time-stamp: <modified the 26/06/2014 (at 17:29) by Erwan Jahier> *)
(* Time-stamp: <modified the 04/04/2019 (at 21:27) by Erwan Jahier> *)
type ident = string
type v = I of int | F of float | B of bool
......@@ -16,6 +16,7 @@ type t =
val val_to_string : (float -> string) -> v -> string
val val_to_rif_string : (float -> string) -> v -> string
val val_to_string_type : v -> string
val type_of_string : string -> t
val type_to_string : t -> string
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment