repl_windows.go 369 Bytes
Newer Older
obscuren's avatar
obscuren committed
1 2 3 4 5 6 7 8 9 10 11
package main

import (
	"bufio"
	"fmt"
	"os"
)

func (self *JSRepl) read() {
	reader := bufio.NewReader(os.Stdin)
	for {
obscuren's avatar
obscuren committed
12
		fmt.Printf(self.prompt)
obscuren's avatar
obscuren committed
13 14 15 16 17 18 19 20
		str, _, err := reader.ReadLine()
		if err != nil {
			fmt.Println("Error reading input", err)
		} else {
			self.parseInput(string(str))
		}
	}
}
obscuren's avatar
obscuren committed
21 22 23 24

func (self *JSRepl) PrintValue(value otto.Value) {
	fmt.Println(value)
}