<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/main/command.go
diff options
context:
space:
mode:
authorCharlie Stanton <charlie@shtanton.xyz>2023-07-19 11:57:59 +0100
committerCharlie Stanton <charlie@shtanton.xyz>2023-07-19 11:57:59 +0100
commit8cf10efe3b5a1bcc70bc6e5590ee63fd5eb00c5b (patch)
tree7a16883c17c2bdcc49b2f9d4f333dfc76c66248f /main/command.go
parent3c34366bdd5d817a184d6b1c901d03a16b6faa4b (diff)
downloadstred-go-8cf10efe3b5a1bcc70bc6e5590ee63fd5eb00c5b.tar
Huge refactor to a more value based system, doing away with terminals. Also introduces unit testing
Diffstat (limited to 'main/command.go')
-rw-r--r--main/command.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/main/command.go b/main/command.go
index ef48596..5a898e2 100644
--- a/main/command.go
+++ b/main/command.go
@@ -1,8 +1,8 @@
package main
import (
- "main/walk"
"main/subex"
+ "main/walk"
"fmt"
)
@@ -46,7 +46,7 @@ func (cmd AppendNextCommand) exec(state *ProgramState) {
if err != nil {
panic("Missing next value")
}
- state.value = walk.ConcatData(state.value, nextItem.Value)
+ state.value = append(state.value, nextItem.Value...)
state.path = nextItem.Path
state.pc++
}
@@ -72,12 +72,12 @@ func (cmd DeletePathCommand) String() string {
return "D"
}
-func runSubex(state subex.Transducer, in []walk.Atom) (out []walk.Atom, error bool) {
- atomsOut, error := subex.RunTransducer(state, in)
+func runSubex(state subex.Transducer, in walk.ValueList) (walk.ValueList, bool) {
+ out, error := subex.RunTransducer(state, in)
if error {
return nil, true
}
- return atomsOut, false
+ return out, false
}
type SubstituteValueCommand struct {
@@ -193,7 +193,7 @@ func (cmd SwapPathCommand) String() string {
type AppendPathCommand struct {}
func (cmd AppendPathCommand) exec(state *ProgramState) {
- state.path = walk.ConcatData(state.path, state.value)
+ state.path = append(state.path, state.value...)
state.pc++
}
func (cmd AppendPathCommand) String() string {