34 lines
470 B
Go
34 lines
470 B
Go
package lox
|
|
|
|
import (
|
|
"bufio"
|
|
"fmt"
|
|
"io/ioutil"
|
|
"os"
|
|
)
|
|
|
|
func RunFile(filename string) {
|
|
bytes, err := ioutil.ReadFile(filename)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
lexer := newLexer(string(bytes))
|
|
lexer.lex()
|
|
}
|
|
|
|
func RunFormat(filename string) {
|
|
|
|
}
|
|
|
|
func RunPrompt() {
|
|
scanner := bufio.NewScanner(os.Stdin)
|
|
scanner.Split(bufio.ScanLines)
|
|
fmt.Print("> ")
|
|
|
|
for scanner.Scan() {
|
|
text := scanner.Text()
|
|
fmt.Printf("Input was: %s\n", text)
|
|
fmt.Print("> ")
|
|
}
|
|
}
|