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

Function matchbracketclass

depends/lua/src/lstrlib.c:302–322  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

300
301
302static int matchbracketclass (int c, const char *p, const char *ec) {
303 int sig = 1;
304 if (*(p+1) == '^') {
305 sig = 0;
306 p++; /* skip the '^' */
307 }
308 while (++p < ec) {
309 if (*p == L_ESC) {
310 p++;
311 if (match_class(c, uchar(*p)))
312 return sig;
313 }
314 else if ((*(p+1) == '-') && (p+2 < ec)) {
315 p+=2;
316 if (uchar(*(p-2)) <= c && c <= uchar(*p))
317 return sig;
318 }
319 else if (uchar(*p) == c) return sig;
320 }
321 return !sig;
322}
323
324
325static int singlematch (MatchState *ms, const char *s, const char *p,

Callers 2

singlematchFunction · 0.85
matchFunction · 0.85

Calls 1

match_classFunction · 0.85

Tested by

no test coverage detected