Permalink
Browse files

remove external package.

  • Loading branch information...
1 parent 7b0dd5c commit 0535d334400da1701e6e9f38f0c076d548bc05c2 @mattn committed May 26, 2011
Showing with 9 additions and 8 deletions.
  1. +9 −8 go-repl.go
View
@@ -1,30 +1,31 @@
package main
import (
+ "bufio"
"fmt"
"os"
- "github.com/kless/go-readin/readin"
"exp/eval"
"go/token"
)
func main() {
world := eval.NewWorld()
var fset = token.NewFileSet()
+ r := bufio.NewReader(os.Stdin)
for {
- line, err := readin.RepeatPrompt("go> ")
- if err != nil {
- fmt.Fprintln(os.Stderr, "go-repl: ", err.String())
- continue
- }
+ print("# ")
+ line, err := r.ReadString('\n')
+ if err != nil {
+ break
+ }
code, err := world.Compile(fset, line+";")
if err != nil {
- fmt.Fprintln(os.Stderr, "go-repl: ", err.String())
+ fmt.Fprintln(os.Stderr, err.String())
continue
}
ret, err := code.Run()
if err != nil {
- fmt.Fprintln(os.Stderr, "go-repl: ", err.String())
+ fmt.Fprintln(os.Stderr, err.String())
continue
}
if ret != nil {

0 comments on commit 0535d33

Please sign in to comment.