MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / matchbracketclass

Function matchbracketclass

src/Chain/libraries/glua/lstrlib.cpp:313–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

311
312
313static int matchbracketclass(int c, const char *p, const char *ec) {
314 int sig = 1;
315 if (*(p + 1) == '^') {
316 sig = 0;
317 p++; /* skip the '^' */
318 }
319 while (++p < ec) {
320 if (*p == L_ESC) {
321 p++;
322 if (match_class(c, uchar(*p)))
323 return sig;
324 }
325 else if ((*(p + 1) == '-') && (p + 2 < ec)) {
326 p += 2;
327 if (uchar(*(p - 2)) <= c && c <= uchar(*p))
328 return sig;
329 }
330 else if (uchar(*p) == c) return sig;
331 }
332 return !sig;
333}
334
335
336static 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