<- Back to shtanton's homepage
aboutsummaryrefslogtreecommitdiff
path: root/main/pathfilterast.go
diff options
context:
space:
mode:
authorCharlie Stanton <charlie@shtanton.xyz>2023-04-20 09:59:59 +0100
committerCharlie Stanton <charlie@shtanton.xyz>2023-04-20 09:59:59 +0100
commita0a416e7762fcdcc066617da8083b0372b87155c (patch)
tree84217b9d1a9496944ddfeee8687cd01f6997cc3e /main/pathfilterast.go
parentb95e5ddaa1b182dfe58a386bfc107fa7d95c4393 (diff)
downloadstred-go-a0a416e7762fcdcc066617da8083b0372b87155c.tar
Remove filters and various commands that are no longer wanted
These have all been made redundant by the incredible substitute command
Diffstat (limited to 'main/pathfilterast.go')
-rw-r--r--main/pathfilterast.go74
1 files changed, 0 insertions, 74 deletions
diff --git a/main/pathfilterast.go b/main/pathfilterast.go
deleted file mode 100644
index c84b8af..0000000
--- a/main/pathfilterast.go
+++ /dev/null
@@ -1,74 +0,0 @@
-package main
-
-type StringSegmentPathFilterAST struct {
- index string
-}
-func (ast StringSegmentPathFilterAST) compileWith(next PathFilterState) PathFilterState {
- return StringSegmentPathFilter {
- index: ast.index,
- next: next,
- }
-}
-
-type IntegerSegmentPathFilterAST struct {
- index int
-}
-func (ast IntegerSegmentPathFilterAST) compileWith(next PathFilterState) PathFilterState {
- return IntegerSegmentPathFilter {
- index: ast.index,
- next: next,
- }
-}
-
-type RepeatPathFilterAST struct {
- content PathFilterAST
-}
-func (ast RepeatPathFilterAST) compileWith(next PathFilterState) PathFilterState {
- nextGroup := &OrPathFilter{}
- repeatStart := ast.content.compileWith(nextGroup)
- nextGroup.filters = [2]PathFilterState{next, repeatStart}
- return nextGroup
-}
-
-type SequencePathFilterAST struct {
- first PathFilterAST
- second PathFilterAST
-}
-func (ast SequencePathFilterAST) compileWith(next PathFilterState) PathFilterState {
- next = ast.second.compileWith(next)
- next = ast.first.compileWith(next)
- return next
-}
-
-type AnySegmentPathFilterAST struct {}
-func (ast AnySegmentPathFilterAST) compileWith(next PathFilterState) PathFilterState {
- return AnySegmentPathFilter{next: next}
-}
-
-type OrPathFilterAST struct {
- first PathFilterAST
- second PathFilterAST
-}
-func (ast OrPathFilterAST) compileWith(next PathFilterState) PathFilterState {
- return OrPathFilter {
- filters: [2]PathFilterState{
- ast.first.compileWith(next),
- ast.second.compileWith(next),
- },
- }
-}
-
-type NonePathFilterAST struct {}
-func (ast NonePathFilterAST) compileWith(next PathFilterState) PathFilterState {
- return next
-}
-
-type PathFilterAST interface {
- compileWith(PathFilterState) PathFilterState
-}
-
-func compilePathFilterAST(ast PathFilterAST) PathFilter {
- return PathFilter{
- initial: ast.compileWith(NonePathFilter{}),
- }
-}