MCPcopy Create free account
hub / github.com/crossoverJie/gscript / repl

Function repl

cmd/gscript.go:29–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

27}
28
29func 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}

Callers 1

mainFunction · 0.85

Calls 6

InitRuntimeFunction · 0.92
NewCompilerFunction · 0.92
ParseMethod · 0.80
PrintMethod · 0.80
CompilerMethod · 0.80
StringMethod · 0.65

Tested by

no test coverage detected