src/repl/commands

Source   Edit  

Types

Command = object
  name*: string
  help*: string
  run*: CommandProc
Source   Edit  
CommandProc = proc (api: var CommandsApi; args: seq[string]): Evaluation
Source   Edit  
CommandsApi = object
  output*: Output
  vm*: Vm
Source   Edit  

Procs

proc command(name: string; help: string; run: CommandProc): Command {.
    ...raises: [], tags: [], forbids: [].}
Creates a new command with a help and run proc. Source   Edit  
proc commands(commands: varargs[Command]): Table[string, Command] {....raises: [],
    tags: [], forbids: [].}
Creates a commands table. Source   Edit  
proc quitCmd(commandsApi: var CommandsApi; args: seq[string]): Evaluation {.
    ...raises: [], tags: [], forbids: [].}
Source   Edit  
proc sourceCmd(commandsApi: var CommandsApi; args: seq[string]): Evaluation {.
    ...raises: [IOError], tags: [ReadIOEffect], forbids: [].}
Shows the generated source code for each component of Reploid's vm.
  • imports: the declared imports.
  • declarations: type, proc, template, macro, func, method, iterator, and converter declarations.
  • state: variable declarations that hold the state of the vm, including internal getters and setters.
  • command: the last command that was run.
Source   Edit