<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/subex/subexstate.go
diff options
context:
space:
mode:
Diffstat (limited to 'subex/subexstate.go')
-rw-r--r--subex/subexstate.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/subex/subexstate.go b/subex/subexstate.go
index 997e6ce..b5e1e9b 100644
--- a/subex/subexstate.go
+++ b/subex/subexstate.go
@@ -36,6 +36,19 @@ func (state SubexCaptureBeginState) accepting(store Store, outputStack OutputSta
return state.next.accepting(store, outputStack.push(nil))
}
+// Discard the top of the OutputStack
+type SubexDiscardState struct {
+ next SubexState
+}
+func (state SubexDiscardState) eat(store Store, outputStack OutputStack, char walk.Atom) []SubexBranch {
+ _, newStack := outputStack.pop()
+ return state.next.eat(store, newStack, char)
+}
+func (state SubexDiscardState) accepting(store Store, outputStack OutputStack) []OutputStack {
+ _, newStack := outputStack.pop()
+ return state.next.accepting(store, newStack)
+}
+
// Pop the top of the OutputStack which contains the stuff outputted since the start of the store
// This outputted data gets stored in a slot
type SubexStoreEndState struct {