diff options
Diffstat (limited to 'main/command.go')
-rw-r--r-- | main/command.go | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/main/command.go b/main/command.go index ea6fb59..e676255 100644 --- a/main/command.go +++ b/main/command.go @@ -135,4 +135,28 @@ type Command interface { } type NoopCommand struct {} -func (cmd NoopCommand) exec(state *ProgramState) {}
\ No newline at end of file +func (cmd NoopCommand) exec(state *ProgramState) {} + +type SwapXRegCommand struct {} +func (cmd SwapXRegCommand) exec(state *ProgramState) { + v := state.value + state.value = state.xreg + state.xreg = v +} + +type AppendXRegCommand struct {} +func (cmd AppendXRegCommand) exec(state *ProgramState) { + state.xreg = append(state.xreg, state.value...) +} + +type SwapPathCommand struct {} +func (cmd SwapPathCommand) exec(state *ProgramState) { + v := state.value + state.value = state.path + state.path = v +} + +type AppendPathCommand struct {} +func (cmd AppendPathCommand) exec(state *ProgramState) { + state.path = append(state.path, state.value...) +}
\ No newline at end of file |