further improvements
This commit is contained in:
8
repl.go
8
repl.go
@@ -20,7 +20,7 @@ import (
|
||||
// Package repl implements the Read-Eval-Print-Loop or interactive console
|
||||
// by lexing, parsing and evaluating the input in the interpreter
|
||||
|
||||
func VmREPL(args []string, debug bool) error {
|
||||
func VmREPL(args []string, debug, trace bool) error {
|
||||
var state = vm.NewVMState()
|
||||
|
||||
object.Args = args
|
||||
@@ -73,6 +73,8 @@ func VmREPL(args []string, debug bool) error {
|
||||
|
||||
mvm := vm.NewWithState("<stdin>", c.Bytecode(), state)
|
||||
mvm.Debug = debug
|
||||
mvm.Trace = trace
|
||||
|
||||
if err := mvm.Run(); err != nil {
|
||||
fmt.Fprintf(t, "runtime error: %v\n", err)
|
||||
continue
|
||||
@@ -129,7 +131,7 @@ func acceptUntil(t *term.Terminal, start, end string) (string, error) {
|
||||
return buf.String(), nil
|
||||
}
|
||||
|
||||
func SimpleVmREPL(args []string, debug bool) {
|
||||
func SimpleVmREPL(args []string, debug, trace bool) {
|
||||
var (
|
||||
state = vm.NewVMState()
|
||||
reader = bufio.NewReader(os.Stdin)
|
||||
@@ -171,6 +173,8 @@ func SimpleVmREPL(args []string, debug bool) {
|
||||
|
||||
mvm := vm.NewWithState("<stdin>", c.Bytecode(), state)
|
||||
mvm.Debug = debug
|
||||
mvm.Trace = trace
|
||||
|
||||
if err := mvm.Run(); err != nil {
|
||||
fmt.Printf("runtime error: %v\n", err)
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user