MCPcopy Create free account
hub / github.com/DFHack/dfhack / classend

Function classend

depends/lua/src/lstrlib.c:258–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

256
257
258static const char *classend (MatchState *ms, const char *p) {
259 switch (*p++) {
260 case L_ESC: {
261 if (p == ms->p_end)
262 luaL_error(ms->L, "malformed pattern (ends with '%%')");
263 return p+1;
264 }
265 case '[': {
266 if (*p == '^') p++;
267 do { /* look for a ']' */
268 if (p == ms->p_end)
269 luaL_error(ms->L, "malformed pattern (missing ']')");
270 if (*(p++) == L_ESC && p < ms->p_end)
271 p++; /* skip escapes (e.g. '%]') */
272 } while (*p != ']');
273 return p+1;
274 }
275 default: {
276 return p;
277 }
278 }
279}
280
281
282static int match_class (int c, int cl) {

Callers 1

matchFunction · 0.85

Calls 1

luaL_errorFunction · 0.85

Tested by

no test coverage detected