diff options
Diffstat (limited to 'main/main.go')
-rw-r--r-- | main/main.go | 37 |
1 files changed, 8 insertions, 29 deletions
diff --git a/main/main.go b/main/main.go index 46b83e7..d657ea2 100644 --- a/main/main.go +++ b/main/main.go @@ -5,36 +5,15 @@ import ( "bufio" "fmt" "main/subex" + "main/walk" ) -type PathSegment interface {} -type Path []PathSegment - -type TerminalValue int -const ( - ArrayBegin TerminalValue = iota - ArrayEnd - MapBegin - MapEnd -) -type ValueNull struct {} -type ValueBool bool -type ValueNumber float64 -type ValueString string - -type WalkValue interface {} - -type WalkItem struct { - value WalkValue - path Path -} - type Program []Command type ProgramState struct { - space []WalkItem - in chan WalkItem - out chan WalkItem + space []walk.WalkItem + in chan walk.WalkItem + out chan walk.WalkItem program []Command } @@ -78,17 +57,17 @@ func mainISH() { program := Parse(tokens) stdin := bufio.NewReader(os.Stdin) - dataStream := Json(stdin) + dataStream := walk.Json(stdin) state := ProgramState { in: dataStream, - out: make(chan WalkItem), + out: make(chan walk.WalkItem), program: program, } go func () { for walkItem := range dataStream { - state.space = []WalkItem{walkItem} + state.space = []walk.WalkItem{walkItem} for _, cmd := range state.program { cmd.exec(&state) } @@ -101,5 +80,5 @@ func mainISH() { close(state.out) }() - JsonOut(state.out) + walk.JsonOut(state.out) }
\ No newline at end of file |