From a0a416e7762fcdcc066617da8083b0372b87155c Mon Sep 17 00:00:00 2001 From: Charlie Stanton Date: Thu, 20 Apr 2023 09:59:59 +0100 Subject: Remove filters and various commands that are no longer wanted These have all been made redundant by the incredible substitute command --- main/pathfilterast.go | 74 --------------------------------------------------- 1 file changed, 74 deletions(-) delete mode 100644 main/pathfilterast.go (limited to 'main/pathfilterast.go') 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{}), - } -} -- cgit v1.2.3