glob/match/super.go

36 lines
513 B
Go
Raw Normal View History

2016-01-08 20:14:31 +03:00
package match
import (
"fmt"
2016-01-09 02:34:41 +03:00
"unicode/utf8"
2016-01-08 20:14:31 +03:00
)
type Super struct{}
func (self Super) Match(s string) bool {
return true
}
2016-01-09 02:34:41 +03:00
func (self Super) Len() int {
return -1
}
func (self Super) Index(s string) (int, []int) {
segments := make([]int, utf8.RuneCountInString(s))
for i := range s {
segments = append(segments, i)
}
segments = append(segments, len(s))
return 0, segments
2016-01-08 20:14:31 +03:00
}
func (self Super) Kind() Kind {
return KindSuper
}
func (self Super) String() string {
return fmt.Sprintf("[super]")
}