MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / push_onecapture

Function push_onecapture

third-party/lua-5.2.4/src/lstrlib.c:536–552  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

534
535
536static void push_onecapture (MatchState *ms, int i, const char *s,
537 const char *e) {
538 if (i >= ms->level) {
539 if (i == 0) /* ms->level == 0, too */
540 lua_pushlstring(ms->L, s, e - s); /* add whole match */
541 else
542 luaL_error(ms->L, "invalid capture index");
543 }
544 else {
545 ptrdiff_t l = ms->capture[i].len;
546 if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture");
547 if (l == CAP_POSITION)
548 lua_pushinteger(ms->L, ms->capture[i].init - ms->src_init + 1);
549 else
550 lua_pushlstring(ms->L, ms->capture[i].init, l);
551 }
552}
553
554
555static int push_captures (MatchState *ms, const char *s, const char *e) {

Callers 3

push_capturesFunction · 0.70
add_sFunction · 0.70
add_valueFunction · 0.70

Calls 3

lua_pushlstringFunction · 0.70
luaL_errorFunction · 0.70
lua_pushintegerFunction · 0.70

Tested by

no test coverage detected