diff options
| author | Joel Martin <github@martintribe.org> | 2014-10-09 18:27:47 -0500 |
|---|---|---|
| committer | Joel Martin <github@martintribe.org> | 2014-10-09 18:27:47 -0500 |
| commit | ad7e866ea1d4d035d876e58bca681a72099449af (patch) | |
| tree | cbd73a7cda5adc4aba7293231ab0efa3f107edb0 /go/src/step2_eval | |
| parent | d667a1bb2e7294f8722bb31f1e6e8207b971c913 (diff) | |
| download | mal-ad7e866ea1d4d035d876e58bca681a72099449af.tar.gz mal-ad7e866ea1d4d035d876e58bca681a72099449af.zip | |
go: add readline.go that wraps libreadline/libedit
Diffstat (limited to 'go/src/step2_eval')
| -rw-r--r-- | go/src/step2_eval/step2_eval.go | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/go/src/step2_eval/step2_eval.go b/go/src/step2_eval/step2_eval.go index 3ab35ed..9b3aa28 100644 --- a/go/src/step2_eval/step2_eval.go +++ b/go/src/step2_eval/step2_eval.go @@ -1,15 +1,13 @@ package main import ( - "bufio" - //"io" "fmt" - "os" "strings" "errors" ) import ( + "readline" . "types" "reader" "printer" @@ -110,11 +108,9 @@ func rep(str string) (MalType, error) { } func main() { - rdr := bufio.NewReader(os.Stdin); // repl loop for { - fmt.Print("user> "); - text, err := rdr.ReadString('\n'); + text, err := readline.Readline("user> ") text = strings.TrimRight(text, "\n"); if (err != nil) { return |
