2014-05-17 13:15:46 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bufio"
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (self *JSRepl) read() {
|
|
|
|
reader := bufio.NewReader(os.Stdin)
|
|
|
|
for {
|
2014-05-19 11:04:31 +00:00
|
|
|
fmt.Printf(self.prompt)
|
2014-05-17 13:15:46 +00:00
|
|
|
str, _, err := reader.ReadLine()
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println("Error reading input", err)
|
|
|
|
} else {
|
|
|
|
self.parseInput(string(str))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2014-05-19 14:32:45 +00:00
|
|
|
|
|
|
|
func (self *JSRepl) PrintValue(value otto.Value) {
|
|
|
|
fmt.Println(value)
|
|
|
|
}
|