2016-01-08 20:14:31 +03:00
|
|
|
package match
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Super struct{}
|
|
|
|
|
2016-02-24 12:36:15 +03:00
|
|
|
func NewSuper() Super {
|
|
|
|
return Super{}
|
|
|
|
}
|
|
|
|
|
2016-01-08 20:14:31 +03:00
|
|
|
func (self Super) Match(s string) bool {
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
2016-01-09 02:34:41 +03:00
|
|
|
func (self Super) Len() int {
|
2016-01-14 18:29:13 +03:00
|
|
|
return lenNo
|
2016-01-09 02:34:41 +03:00
|
|
|
}
|
|
|
|
|
2016-02-05 17:29:41 +03:00
|
|
|
func (self Super) Index(s string) (int, []int) {
|
2016-02-24 12:36:15 +03:00
|
|
|
segments := acquireSegments(len(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) String() string {
|
2016-01-13 01:26:48 +03:00
|
|
|
return fmt.Sprintf("<super>")
|
2016-01-08 20:14:31 +03:00
|
|
|
}
|