MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / push_onecapture

Function push_onecapture

Source/Misc/lua/src/lua.c:14143–14159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14141
14142
14143static void push_onecapture (MatchState *ms, int i, const char *s,
14144const char *e) {
14145if (i >= ms->level) {
14146if (i == 0) /* ms->level == 0, too */
14147lua_pushlstring(ms->L, s, e - s); /* add whole match */
14148else
14149luaL_error(ms->L, "invalid capture index");
14150}
14151else {
14152ptrdiff_t l = ms->capture[i].len;
14153if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture");
14154if (l == CAP_POSITION)
14155lua_pushinteger(ms->L, ms->capture[i].init - ms->src_init + 1);
14156else
14157lua_pushlstring(ms->L, ms->capture[i].init, l);
14158}
14159}
14160
14161
14162static int push_captures (MatchState *ms, const char *s, const char *e) {

Callers 3

push_capturesFunction · 0.85
add_sFunction · 0.85
add_valueFunction · 0.85

Calls 3

lua_pushlstringFunction · 0.85
luaL_errorFunction · 0.85
lua_pushintegerFunction · 0.85

Tested by

no test coverage detected