interpreter

Function interpreter 

Source
pub fn interpreter(
    st: &mut State,
    start: Utf8Iter<'_>,
    io: Arc<Mutex<IOStreams>>,
    ll: LogLevel,
    kill: Option<&Receiver<()>>,
    restrict: bool,
) -> Result<ExecResult>
Expand description

Interpreter entry point, executes ADC commands to modify state

§Arguments

  • st: State struct to work on, modified in-place
  • start: Initial commands to run
  • io: Bundle of IO stream handles
    • io.0: Input, read by ? one line at a time
    • io.1: Output, written to by printing commands
    • io.2: Error messages, one per line
  • ll: Level of verbosity for io.2
  • kill: Receiver for a kill signal from a parent thread, checked with try_recv in the command parsing loop
  • restrict: Restricted mode switch, prevents OS access (for untrusted input). If false, the interpreter may read/write files and execute OS commands, subject to any OS-level permissions.

§Errors

Any IO errors that arise when accessing the IO streams are returned early, aborting the interpreter. Keep that possibility to a minimum when preparing custom IO streams.

§Panics

Shouldn’t™