diff options
author | Charlie Stanton <charlie@shtanton.xyz> | 2022-08-26 18:15:56 +0100 |
---|---|---|
committer | Charlie Stanton <charlie@shtanton.xyz> | 2022-08-26 18:15:56 +0100 |
commit | 094c9a8921fb5f54a34d8cdcb924b5dbacd336d8 (patch) | |
tree | 1ceb06246b2d5bd196746de7f300bdfe32a4a18a /main/pathfilter.go | |
parent | ce5c224211a94bfd4c898b51d15febdf2ed9d6f2 (diff) | |
download | stred-go-094c9a8921fb5f54a34d8cdcb924b5dbacd336d8.tar |
Adds a bunch of new path pattern features
- Bracketting in expressions
- OR with |
- Optional with ?
Diffstat (limited to 'main/pathfilter.go')
-rw-r--r-- | main/pathfilter.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/main/pathfilter.go b/main/pathfilter.go index b64872e..7e21efe 100644 --- a/main/pathfilter.go +++ b/main/pathfilter.go @@ -12,10 +12,10 @@ func (filter AnySegmentPathFilter) accept() bool { return false } -type GroupPathFilter struct { - filters []PathFilterState +type OrPathFilter struct { + filters [2]PathFilterState } -func (filter GroupPathFilter) eat(segment PathSegment) map[PathFilterState]struct{} { +func (filter OrPathFilter) eat(segment PathSegment) map[PathFilterState]struct{} { res := make(map[PathFilterState]struct{}) for _, f := range filter.filters { for r := range f.eat(segment) { @@ -24,7 +24,7 @@ func (filter GroupPathFilter) eat(segment PathSegment) map[PathFilterState]struc } return res } -func (filter GroupPathFilter) accept() bool { +func (filter OrPathFilter) accept() bool { for _, f := range filter.filters { if f.accept() { return true |