optimizations
This commit is contained in:
@@ -3,6 +3,7 @@ package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"monkey"
|
||||
"os"
|
||||
)
|
||||
@@ -24,6 +25,7 @@ func main() {
|
||||
flag.Parse()
|
||||
|
||||
opts := &monkey.Options{
|
||||
Args: flag.Args(),
|
||||
Debug: debug,
|
||||
Trace: trace,
|
||||
}
|
||||
@@ -37,12 +39,15 @@ func main() {
|
||||
|
||||
case flag.NArg() > 0:
|
||||
opts.Args = flag.Args()[1:]
|
||||
monkey.ExecFile(flag.Arg(0), opts)
|
||||
if err := monkey.ExecFile(flag.Arg(0), opts); err != nil {
|
||||
fmt.Fprintf(os.Stderr, "runtime error: %v\n", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
case simple:
|
||||
monkey.SimpleREPL(flag.Args(), opts)
|
||||
monkey.SimpleREPL(opts)
|
||||
|
||||
default:
|
||||
monkey.REPL(flag.Args(), opts)
|
||||
monkey.REPL(opts)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user