MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / classend

Function classend

lib/lua/src/lstrlib.c:403–424  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

matchFunction · 0.85

Calls 1

luaL_errorFunction · 0.85

Tested by

no test coverage detected