nothing.go 371 B

123456789101112131415161718192021222324252627
  1. package match
  2. import (
  3. "fmt"
  4. )
  5. type Nothing struct{}
  6. func NewNothing() Nothing {
  7. return Nothing{}
  8. }
  9. func (self Nothing) Match(s string) bool {
  10. return len(s) == 0
  11. }
  12. func (self Nothing) Index(s string) (int, []int) {
  13. return 0, segments0
  14. }
  15. func (self Nothing) Len() int {
  16. return lenZero
  17. }
  18. func (self Nothing) String() string {
  19. return fmt.Sprintf("<nothing>")
  20. }