()
| 27 | } |
| 28 | |
| 29 | func repl() { |
| 30 | s := flag.String("x", "run", "debug or run, the debug mode will print the AST tree.") |
| 31 | flag.Parse() |
| 32 | if *s == "debug" { |
| 33 | syntax.InitRuntime(true) |
| 34 | } else { |
| 35 | syntax.InitRuntime(false) |
| 36 | } |
| 37 | reader := bufio.NewReader(os.Stdin) |
| 38 | fmt.Print(syntax.Logo) |
| 39 | var script bytes.Buffer |
| 40 | |
| 41 | for { |
| 42 | fmt.Print("-> ") |
| 43 | text, _ := reader.ReadString('\n') |
| 44 | script.WriteString(text) |
| 45 | ret := gscript.NewCompiler().Compiler(script.String()) |
| 46 | fmt.Println(ret) |
| 47 | |
| 48 | } |
| 49 | } |
no test coverage detected