| 1 | package match |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | ) |
| 6 | |
| 7 | type Super struct{} |
| 8 | |
| 9 | func NewSuper() Super { |
| 10 | return Super{} |
| 11 | } |
| 12 | |
| 13 | func (self Super) Match(s string) bool { |
| 14 | return true |
| 15 | } |
| 16 | |
| 17 | func (self Super) Len() int { |
| 18 | return lenNo |
| 19 | } |
| 20 | |
| 21 | func (self Super) Index(s string) (int, []int) { |
| 22 | segments := acquireSegments(len(s) + 1) |
| 23 | for i := range s { |
| 24 | segments = append(segments, i) |
| 25 | } |
| 26 | segments = append(segments, len(s)) |
| 27 | |
| 28 | return 0, segments |
| 29 | } |
| 30 | |
| 31 | func (self Super) String() string { |
| 32 | return fmt.Sprintf("<super>") |
| 33 | } |