create debug module
This commit is contained in:
parent
881253d833
commit
781b2adde6
23
lib/debug.ml
Normal file
23
lib/debug.ml
Normal file
@ -0,0 +1,23 @@
|
||||
open Types
|
||||
|
||||
let print_colour = function
|
||||
| Simple n | Intrinsic n ->
|
||||
print_endline ("fg simple/intrinsic " ^ string_of_int n)
|
||||
| RGB (r, g, b) ->
|
||||
print_endline
|
||||
("fg rgb: "
|
||||
^ List.fold_left
|
||||
(fun acc el -> acc ^ ", " ^ string_of_int el)
|
||||
"" [ r; g; b ])
|
||||
|
||||
let print_ansi =
|
||||
List.fold_left (fun _acc el ->
|
||||
match el with
|
||||
| Fg c -> print_colour c
|
||||
| Bg c -> print_colour c
|
||||
| Reset -> print_endline "ansi reset"
|
||||
| Other n -> print_endline ("other ansi: " ^ string_of_int n))
|
||||
|
||||
let debug_print = function
|
||||
| Text s | Separator s | Delimiter s -> print_endline ("parsed '" ^ s ^ "'")
|
||||
| Ansi a -> print_ansi () a
|
Loading…
Reference in New Issue
Block a user