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) {
|
2016-01-12 14:06:59 +03:00
|
|
|
segments := make([]int, 0, utf8.RuneCountInString(s)+1)
|
2016-01-09 02:34:41 +03:00
|
|
|
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 {
|
2016-01-13 01:26:48 +03:00
|
|
|
return fmt.Sprintf("<super>")
|
2016-01-08 20:14:31 +03:00
|
|
|
}
|