MCPcopy Create free account
hub / github.com/F-Stack/f-stack / matchbracketclass

Function matchbracketclass

freebsd/contrib/openzfs/module/lua/lstrlib.c:297–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 2

singlematchFunction · 0.70
matchFunction · 0.70

Calls 1

match_classFunction · 0.70

Tested by

no test coverage detected