MCPcopy Create free account
hub / github.com/google/codesearch / fold

Function fold

index/regexp.go:543–555  ·  view source on GitHub ↗

fold is the usual higher-order function.

(f func(x, y regexpInfo) regexpInfo, sub []*syntax.Regexp, zero regexpInfo)

Source from the content-addressed store, hash-verified

541
542// fold is the usual higher-order function.
543func fold(f func(x, y regexpInfo) regexpInfo, sub []*syntax.Regexp, zero regexpInfo) regexpInfo {
544 if len(sub) == 0 {
545 return zero
546 }
547 if len(sub) == 1 {
548 return analyze(sub[0])
549 }
550 info := f(analyze(sub[0]), analyze(sub[1]))
551 for i := 2; i < len(sub); i++ {
552 info = f(info, analyze(sub[i]))
553 }
554 return info
555}
556
557// concat returns the regexp info for xy given x and y.
558func concat(x, y regexpInfo) (out regexpInfo) {

Callers 1

analyzeFunction · 0.85

Calls 1

analyzeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…