MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / matchbracketclass

Function matchbracketclass

extlibs/lua/src/lstrlib.c:444–464  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

442
443
444static int matchbracketclass (int c, const char *p, const char *ec) {
445 int sig = 1;
446 if (*(p+1) == '^') {
447 sig = 0;
448 p++; /* skip the '^' */
449 }
450 while (++p < ec) {
451 if (*p == L_ESC) {
452 p++;
453 if (match_class(c, uchar(*p)))
454 return sig;
455 }
456 else if ((*(p+1) == '-') && (p+2 < ec)) {
457 p+=2;
458 if (uchar(*(p-2)) <= c && c <= uchar(*p))
459 return sig;
460 }
461 else if (uchar(*p) == c) return sig;
462 }
463 return !sig;
464}
465
466
467static 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