Reorganize code and document functions
This commit is contained in:
parent
96b3fc6c52
commit
5752995272
9 changed files with 93 additions and 41 deletions
15
lib/repl.ml
Normal file
15
lib/repl.ml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
let rec loop state =
|
||||
print_string "inspector> ";
|
||||
flush stdout;
|
||||
try
|
||||
match read_line () |> String.lowercase_ascii with
|
||||
| "exit" | "quit" -> print_endline "bye"
|
||||
| "next" -> loop (State.next state)
|
||||
| "prev" -> loop (State.prev state)
|
||||
| "show" ->
|
||||
Printf.printf "[%d]: %s\n" (State.cursor state) (State.show_line state);
|
||||
loop state
|
||||
| str ->
|
||||
print_endline str;
|
||||
loop state
|
||||
with End_of_file -> print_endline "bye"
|
||||
Loading…
Add table
Add a link
Reference in a new issue