示例#1
0
func Interpret(n *Node, common *Node) (string, bool) {
	dsl.Spawn("bash")
	fmt.Printf("\n== %s ==\n\n", GetName(n))
	s := scope{defs: make(map[string]*Node), blocks: make([]*Node, 0), test: false}
	interpret(common, &s)
	_, i := interpret(n, &s)
	dsl.Quit()
	//time.Sleep(1000*time.Millisecond)

	if i.typ == "lesson" {
		return i.value, false
	} else if i.typ == "done" {
		return i.value, true
	} else {
		return "", false
	}
}
示例#2
0
func InterpretTest(n *Node, common *Node) {
	dsl.Spawn("bash")
	s := scope{defs: make(map[string]*Node), blocks: make([]*Node, 0), test: true}
	interpret(common, &s)
	interpret(n, &s)
}