[][src]Function molt_shell::repl

pub fn repl(interp: &mut Interp, prompt: &str)

Invokes an interactive REPL for the given interpreter, using rustyline line editing.

The REPL will display the given prompt to the user. Press ^C to terminate the REPL, returning control to the caller. Entering exit will also normallycause the application to terminate (but the exit command can be removed or redefined by the application).

See molt::interp for details on how to configure and add commands to a Molt interpreter.

Example

use molt::Interp;

// FIRST, create and initialize the interpreter.
let mut interp = Interp::new();

// NOTE: commands can be added to the interpreter here.

// NEXT, invoke the REPL.
molt_shell::repl(&mut interp, "% ");