bunch of changes
This commit is contained in:
@@ -12,27 +12,29 @@ func main() {
|
||||
compile bool
|
||||
version bool
|
||||
simple bool
|
||||
debug bool
|
||||
)
|
||||
|
||||
flag.BoolVar(&compile, "c", false, "Compile a monkey file into a '.monkeyc' bytecode file.")
|
||||
flag.BoolVar(&simple, "s", false, "Use simple REPL instead of opening a terminal.")
|
||||
flag.BoolVar(&version, "v", false, "Print Monkey version information.")
|
||||
flag.BoolVar(&compile, "c", false, "Compile a monkey file into a '.mc' bytecode file")
|
||||
flag.BoolVar(&simple, "s", false, "Use simple REPL instead of opening a terminal")
|
||||
flag.BoolVar(&version, "v", false, "Print Monkey version information")
|
||||
flag.BoolVar(&debug, "d", false, "Enable debug mode")
|
||||
flag.Parse()
|
||||
|
||||
switch {
|
||||
case compile:
|
||||
monkey.CompileFiles(flag.Args())
|
||||
monkey.CompileFiles(flag.Args(), debug)
|
||||
|
||||
case version:
|
||||
monkey.PrintVersionInfo(os.Stdout)
|
||||
|
||||
case flag.NArg() > 0:
|
||||
monkey.ExecFileVM(flag.Arg(0))
|
||||
monkey.ExecFileVM(flag.Arg(0), flag.Args()[1:], debug)
|
||||
|
||||
case simple:
|
||||
monkey.SimpleVmREPL()
|
||||
monkey.SimpleVmREPL(flag.Args(), debug)
|
||||
|
||||
default:
|
||||
monkey.VmREPL()
|
||||
monkey.VmREPL(flag.Args(), debug)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user