MCPcopy Create free account
hub / github.com/pymupdf/PyMuPDF / match_string

Function match_string

src/__init__.py:24221–24249  ·  view source on GitHub ↗
(h0, n0)

Source from the content-addressed store, hash-verified

24219
24220
24221def match_string(h0, n0):
24222 h = 0
24223 n = 0
24224 e = h
24225 delta_h, hc = chartocanon(h0[h:])
24226 h += delta_h
24227 delta_n, nc = chartocanon(n0[n:])
24228 n += delta_n
24229 while hc == nc:
24230 e = h
24231 if hc == ord(' '):
24232 while 1:
24233 delta_h, hc = chartocanon(h0[h:])
24234 h += delta_h
24235 if hc != ord(' '):
24236 break
24237 else:
24238 delta_h, hc = chartocanon(h0[h:])
24239 h += delta_h
24240 if nc == ord(' '):
24241 while 1:
24242 delta_n, nc = chartocanon(n0[n:])
24243 n += delta_n
24244 if nc != ord(' '):
24245 break
24246 else:
24247 delta_n, nc = chartocanon(n0[n:])
24248 n += delta_n
24249 return None if nc != 0 else e
24250
24251
24252def on_highlight_char(hits, line, ch):

Callers 1

find_stringFunction · 0.85

Calls 1

chartocanonFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…