From b80b72cfe2e02ce7b9467e161703a47e433f992d Mon Sep 17 00:00:00 2001 From: Charlie Stanton Date: Wed, 19 Apr 2023 16:00:04 +0100 Subject: Replaces the workspace with 3 distinct registers: path, value and xreg workspace contained a list of WalkItems, pairs of paths and values. The new system can still hold a list of values but only one path, which is in itself a list of values. The X register is miscellaneous. All 3 hold a list of values (which are JSON tokens) --- main/main.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'main/main.go') diff --git a/main/main.go b/main/main.go index 902c5b9..923ffa6 100644 --- a/main/main.go +++ b/main/main.go @@ -9,7 +9,7 @@ import ( type Program []Command type ProgramState struct { - space []walk.WalkItem + path, value, xreg []walk.WalkValue in chan walk.WalkItem out chan walk.WalkItem program []Command @@ -50,13 +50,18 @@ func main() { go func () { for walkItem := range dataStream { - state.space = []walk.WalkItem{walkItem} + state.value = []walk.WalkValue{walkItem.Value} + state.path = walkItem.Path.ToWalkValues() for _, cmd := range state.program { cmd.exec(&state) } if !quiet { - for _, item := range state.space { - state.out <- item + path := walk.PathFromWalkValues(state.path) + for _, value := range state.value { + state.out <- walk.WalkItem { + Value: value, + Path: path, + } } } } -- cgit v1.2.3