MCPcopy Index your code
hub / github.com/google/codesearch / matchString

Method matchString

regexp/match.go:312–337  ·  view source on GitHub ↗
(b string, beginText, endText bool)

Source from the content-addressed store, hash-verified

310}
311
312func (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:

Callers 1

MatchStringMethod · 0.80

Calls 1

computeNextMethod · 0.95

Tested by

no test coverage detected