<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/subex/subexstate.go
diff options
context:
space:
mode:
authorCharlie Stanton <charlie@shtanton.xyz>2023-04-18 12:47:55 +0100
committerCharlie Stanton <charlie@shtanton.xyz>2023-04-18 12:47:55 +0100
commit8e9f0b186745afd51579d2a6136a57705efc7574 (patch)
tree7ae5fa77518e2e9f4f4f6b87470ae314506daf0b /subex/subexstate.go
parentebd4f72fb2d1968ac9c13e5b5e743d265a9df6ca (diff)
downloadstred-go-8e9f0b186745afd51579d2a6136a57705efc7574.tar
Adds the repeat construct, obsoleting maximise, minimise, try, maybe and probably more
The repeat construct repeats a subex a number of times, this number is based on a provided list which is ordered by priority and can be unbounded.
Diffstat (limited to 'subex/subexstate.go')
-rw-r--r--subex/subexstate.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/subex/subexstate.go b/subex/subexstate.go
index 6318376..3c554a2 100644
--- a/subex/subexstate.go
+++ b/subex/subexstate.go
@@ -123,6 +123,15 @@ func (state SubexNoneState) accepting(store Store) [][]walk.Atom {
return [][]walk.Atom{nil}
}
+// A dead end state, handy for making internals work nicer but technically redundant
+type SubexDeadState struct {}
+func (state SubexDeadState) eat(store Store, char walk.Atom) []SubexBranch {
+ return nil
+}
+func (state SubexDeadState) accepting (store Store) [][]walk.Atom {
+ return nil
+}
+
// Read in a specific Atom and output it
type SubexCopyAtomState struct {
atom walk.Atom