diff options
author | Charlie Stanton <charlie@shtanton.xyz> | 2023-04-19 16:00:04 +0100 |
---|---|---|
committer | Charlie Stanton <charlie@shtanton.xyz> | 2023-04-19 16:00:04 +0100 |
commit | b80b72cfe2e02ce7b9467e161703a47e433f992d (patch) | |
tree | 81ad3202715f807cb4bf2987b8068e73f44e2a1a /main/main.go | |
parent | dae74317d84471f6a859117fcbba1cf546be8ea1 (diff) | |
download | stred-go-b80b72cfe2e02ce7b9467e161703a47e433f992d.tar |
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)
Diffstat (limited to 'main/main.go')
-rw-r--r-- | main/main.go | 13 |
1 files changed, 9 insertions, 4 deletions
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, + } } } } |