<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/main/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main/main.go')
-rw-r--r--main/main.go18
1 files changed, 13 insertions, 5 deletions
diff --git a/main/main.go b/main/main.go
index 923ffa6..564d14a 100644
--- a/main/main.go
+++ b/main/main.go
@@ -9,7 +9,7 @@ import (
type Program []Command
type ProgramState struct {
- path, value, xreg []walk.WalkValue
+ path, value, xreg []walk.Atom
in chan walk.WalkItem
out chan walk.WalkItem
program []Command
@@ -50,14 +50,22 @@ func main() {
go func () {
for walkItem := range dataStream {
- state.value = []walk.WalkValue{walkItem.Value}
- state.path = walkItem.Path.ToWalkValues()
+ state.value = walk.Atomise([]walk.WalkValue{walkItem.Value})
+ state.path = walk.Atomise(walkItem.Path.ToWalkValues())
for _, cmd := range state.program {
cmd.exec(&state)
}
if !quiet {
- path := walk.PathFromWalkValues(state.path)
- for _, value := range state.value {
+ pathValues, err := walk.Compound(state.path)
+ if err != nil {
+ panic("Tried to convert invalid atoms to values")
+ }
+ path := walk.PathFromWalkValues(pathValues)
+ values, err := walk.Compound(state.value)
+ if err != nil {
+ panic("Tried to convert invalid atoms to values")
+ }
+ for _, value := range values {
state.out <- walk.WalkItem {
Value: value,
Path: path,