diff options
author | Charlie Stanton <charlie@shtanton.xyz> | 2023-04-26 14:41:25 +0100 |
---|---|---|
committer | Charlie Stanton <charlie@shtanton.xyz> | 2023-04-26 14:41:25 +0100 |
commit | 1aa08f927c7043a643e847c434399fc76d053df0 (patch) | |
tree | 3a6d5872a87395f44fced57d0aa0bf73564bf2f4 /main/main.go | |
parent | 58bbf68238e7711da1dda53d9656444ed6ccbd4d (diff) | |
download | stred-go-1aa08f927c7043a643e847c434399fc76d053df0.tar |
Store stred programs as a flat list of commands with no nesting, using a new jump command to simulate command blocks
Diffstat (limited to 'main/main.go')
-rw-r--r-- | main/main.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/main/main.go b/main/main.go index 2067920..55ed5b5 100644 --- a/main/main.go +++ b/main/main.go @@ -13,6 +13,7 @@ type ProgramState struct { in walk.JSONIn out walk.JSONOut program []Command + pc int } func main() { @@ -55,8 +56,9 @@ func main() { } state.value = walkItem.Value state.path = walkItem.Path - for _, cmd := range state.program { - cmd.exec(&state) + state.pc = 0 + for state.pc < len(state.program) { + state.program[state.pc].exec(&state) } if !quiet { pathValues, err := walk.Compound(state.path) |