MCPcopy Create free account
hub / github.com/DFHack/dfhack / singlematch

Function singlematch

depends/lua/src/lstrlib.c:325–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

323
324
325static int singlematch (MatchState *ms, const char *s, const char *p,
326 const char *ep) {
327 if (s >= ms->src_end)
328 return 0;
329 else {
330 int c = uchar(*s);
331 switch (*p) {
332 case '.': return 1; /* matches any char */
333 case L_ESC: return match_class(c, uchar(*(p+1)));
334 case '[': return matchbracketclass(c, p, ep-1);
335 default: return (uchar(*p) == c);
336 }
337 }
338}
339
340
341static const char *matchbalance (MatchState *ms, const char *s,

Callers 3

max_expandFunction · 0.85
min_expandFunction · 0.85
matchFunction · 0.85

Calls 2

match_classFunction · 0.85
matchbracketclassFunction · 0.85

Tested by

no test coverage detected