(pattern string)
| 51 | } |
| 52 | |
| 53 | func NewBufferFilterForStringCase(pattern string) *BufferFilter { |
| 54 | if len(pattern) < 2 { |
| 55 | // Very short patterns are unprofitable. |
| 56 | return nil |
| 57 | } |
| 58 | for _, r := range pattern { |
| 59 | if r >= utf8.RuneSelf { |
| 60 | // stringCaseFinder is sensitive to case for letters |
| 61 | // with multibyte UTF-8 encodings. |
| 62 | return nil |
| 63 | } |
| 64 | } |
| 65 | return &BufferFilter{op: opStringCaseFinder, cf: stringsearch.NewCaseFinder(pattern)} |
| 66 | } |
| 67 | |
| 68 | // Eval returns true if buf matches the receiver and false otherwise. |
| 69 | func (b *BufferFilter) Eval(types super.TypeFetcher, buf []byte) bool { |
no test coverage detected