better EOF handling in repl

master
Jordan Orelli 12 years ago
parent 926911a7c6
commit 101ee99edd

@ -337,10 +337,16 @@ func main() {
if prefix { if prefix {
fmt.Println("(prefix)") fmt.Println("(prefix)")
} }
if err != nil { switch err {
case nil:
break
case io.EOF:
fmt.Print("\n")
return
default:
fmt.Println("error: ", err) fmt.Println("error: ", err)
continue continue
} }
c := make(chan token) c := make(chan token)
go lexs(string(line) + "\n", c) go lexs(string(line) + "\n", c)

Loading…
Cancel
Save