(b string, beginText, endText bool)
| 310 | } |
| 311 | |
| 312 | func (m *matcher) matchString(b string, beginText, endText bool) (end int) { |
| 313 | d := m.startLine |
| 314 | if beginText { |
| 315 | d = m.start |
| 316 | } |
| 317 | for i := 0; i < len(b); i++ { |
| 318 | c := b[i] |
| 319 | d1 := d.next[c] |
| 320 | if d1 == nil { |
| 321 | if c == '\n' { |
| 322 | if d.matchNL { |
| 323 | return i |
| 324 | } |
| 325 | d1 = m.startLine |
| 326 | } else { |
| 327 | d1 = m.computeNext(d, int(c)) |
| 328 | } |
| 329 | d.next[c] = d1 |
| 330 | } |
| 331 | d = d1 |
| 332 | } |
| 333 | if d.matchNL || endText && d.matchEOT { |
| 334 | return len(b) |
| 335 | } |
| 336 | return -1 |
| 337 | } |
| 338 | |
| 339 | // isWordByte reports whether the byte c is a word character: ASCII only. |
| 340 | // This is used to implement \b and \B. This is not right for Unicode, but: |
no test coverage detected