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

Function trigramsImply

index/regexp.go:198–224  ·  view source on GitHub ↗
(t []string, q *Query)

Source from the content-addressed store, hash-verified

196}
197
198func trigramsImply(t []string, q *Query) bool {
199 switch q.Op {
200 case QOr:
201 for _, qq := range q.Sub {
202 if trigramsImply(t, qq) {
203 return true
204 }
205 }
206 for i := range t {
207 if stringSet.isSubsetOf(t[i:i+1], q.Trigram) {
208 return true
209 }
210 }
211 return false
212 case QAnd:
213 for _, qq := range q.Sub {
214 if !trigramsImply(t, qq) {
215 return false
216 }
217 }
218 if !stringSet.isSubsetOf(q.Trigram, t) {
219 return false
220 }
221 return true
222 }
223 return false
224}
225
226// maybeRewrite rewrites q to use op if it is possible to do so
227// without changing the meaning. It also simplifies if the node

Callers 1

impliesMethod · 0.85

Calls 1

isSubsetOfMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…