<- Back to shtanton's homepage
summaryrefslogtreecommitdiff
path: root/main/regexstate.go
diff options
context:
space:
mode:
authorCharlie Stanton <charlie@shtanton.xyz>2022-12-24 10:03:56 +0000
committerCharlie Stanton <charlie@shtanton.xyz>2022-12-24 10:03:56 +0000
commitce2db2bc333ed938ec93d5ad0838f8cb720c4865 (patch)
tree3478f894bd29875c2d4fb5247577d196883bab8a /main/regexstate.go
parentc19df3ff75e7693e38940f20a5f3b40931be424a (diff)
downloadsubex-ce2db2bc333ed938ec93d5ad0838f8cb720c4865.tar
Remove the redundant regex implementation
Diffstat (limited to 'main/regexstate.go')
-rw-r--r--main/regexstate.go48
1 files changed, 0 insertions, 48 deletions
diff --git a/main/regexstate.go b/main/regexstate.go
deleted file mode 100644
index 16d5581..0000000
--- a/main/regexstate.go
+++ /dev/null
@@ -1,48 +0,0 @@
-package main
-
-type RegexState interface {
- eat(char rune) []RegexState
- accepting() bool
-}
-
-type RegexNoneState struct {}
-func (state RegexNoneState) eat(char rune) []RegexState {
- return nil
-}
-func (state RegexNoneState) accepting() bool {
- return true
-}
-
-type RegexAnyState struct {
- next RegexState
-}
-func (state RegexAnyState) eat(char rune) []RegexState {
- return []RegexState{state.next}
-}
-func (state RegexAnyState) accepting() bool {
- return false
-}
-
-type RegexRuneState struct {
- rune rune
- next RegexState
-}
-func (state RegexRuneState) eat(char rune) []RegexState {
- if char == state.rune {
- return []RegexState{state.next}
- }
- return nil
-}
-func (state RegexRuneState) accepting() bool {
- return false
-}
-
-type RegexGroupState struct {
- first, second RegexState
-}
-func (state RegexGroupState) eat(char rune) []RegexState {
- return append(state.first.eat(char), state.second.eat(char)...)
-}
-func (state RegexGroupState) accepting() bool {
- return state.first.accepting() || state.second.accepting()
-}