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

Function classend

extlibs/lua/src/lstrlib.c:400–421  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

398
399
400static const char *classend (MatchState *ms, const char *p) {
401 switch (*p++) {
402 case L_ESC: {
403 if (p == ms->p_end)
404 luaL_error(ms->L, "malformed pattern (ends with '%%')");
405 return p+1;
406 }
407 case '[': {
408 if (*p == '^') p++;
409 do { /* look for a ']' */
410 if (p == ms->p_end)
411 luaL_error(ms->L, "malformed pattern (missing ']')");
412 if (*(p++) == L_ESC && p < ms->p_end)
413 p++; /* skip escapes (e.g. '%]') */
414 } while (*p != ']');
415 return p+1;
416 }
417 default: {
418 return p;
419 }
420 }
421}
422
423
424static int match_class (int c, int cl) {

Callers 1

matchFunction · 0.85

Calls 1

luaL_errorFunction · 0.85

Tested by

no test coverage detected