aboutsummaryrefslogtreecommitdiff
path: root/repl/repl.go
diff options
context:
space:
mode:
Diffstat (limited to 'repl/repl.go')
-rw-r--r--repl/repl.go28
1 files changed, 8 insertions, 20 deletions
diff --git a/repl/repl.go b/repl/repl.go
index 41bfe79..43a65f3 100644
--- a/repl/repl.go
+++ b/repl/repl.go
@@ -2,6 +2,7 @@ package repl
import (
"bufio"
+ _ "embed"
"fmt"
"io"
@@ -20,8 +21,7 @@ func Start(in io.Reader, out io.Writer) {
for {
fmt.Print(prompt)
- scanned := scanner.Scan()
- if !scanned {
+ if !scanner.Scan() {
return
}
@@ -46,24 +46,12 @@ func Start(in io.Reader, out io.Writer) {
}
}
-const monkeyFace = ` __,__
- .--. .-" "-. .--.
- / .. \/ .-. .-. \/ .. \
- | | '| / Y \ |' | |
- | \ \ \ 0 | 0 / / / |
- \ '- ,\.-"""""""-./, -' /
- ''-' /_ ^ ^ _\ '-''
- | \._ _./ |
- \ \ '~' / /
- '._ '-=-' _.'
- '-----'
-`
+//go:embed face.txt
+var monkeyFace string
-func printParserErrors(out io.Writer, errors []string) {
- io.WriteString(out, monkeyFace)
- io.WriteString(out, "Woops! We ran into some monkey business here!\n")
- io.WriteString(out, " parser errors:\n")
- for _, msg := range errors {
- io.WriteString(out, "\t"+msg+"\n")
+func printParserErrors(out io.Writer, errors []error) {
+ fmt.Fprintln(out, monkeyFace)
+ for _, err := range errors {
+ fmt.Fprintln(out, err)
}
}