diff options
Diffstat (limited to 'main/command.go')
-rw-r--r-- | main/command.go | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/main/command.go b/main/command.go index bad5b1e..91cb5e4 100644 --- a/main/command.go +++ b/main/command.go @@ -47,10 +47,10 @@ func (cmd SequenceCommand) exec(state *ProgramState) { } } -type AppendCommand struct { +type AppendLiteralCommand struct { values []WalkValue } -func (cmd AppendCommand) exec(state *ProgramState) { +func (cmd AppendLiteralCommand) exec(state *ProgramState) { for _, value := range cmd.values { state.space = append(state.space, WalkItem { path: nil, @@ -59,10 +59,10 @@ func (cmd AppendCommand) exec(state *ProgramState) { } } -type PrependCommand struct { +type PrependLiteralCommand struct { values []WalkValue } -func (cmd PrependCommand) exec(state *ProgramState) { +func (cmd PrependLiteralCommand) exec(state *ProgramState) { var newItems []WalkItem for _, value := range cmd.values { newItems = append(newItems, WalkItem { @@ -73,6 +73,18 @@ func (cmd PrependCommand) exec(state *ProgramState) { state.space = append(newItems, state.space...) } +type NextCommand struct {} +func (cmd NextCommand) exec(state *ProgramState) { + nextItem := <- state.in + state.space = []WalkItem{nextItem} +} + +type AppendNextCommand struct {} +func (cmd AppendNextCommand) exec(state *ProgramState) { + nextItem := <- state.in + state.space = append(state.space, nextItem) +} + type PrintLiteralsCommand struct { items []WalkItem } |