MCPcopy Create free account
hub / github.com/F-Stack/f-stack / push_onecapture

Function push_onecapture

freebsd/contrib/openzfs/module/lua/lstrlib.c:547–563  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

545
546
547static void push_onecapture (MatchState *ms, int i, const char *s,
548 const char *e) {
549 if (i >= ms->level) {
550 if (i == 0) /* ms->level == 0, too */
551 lua_pushlstring(ms->L, s, e - s); /* add whole match */
552 else
553 luaL_error(ms->L, "invalid capture index");
554 }
555 else {
556 ptrdiff_t l = ms->capture[i].len;
557 if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture");
558 if (l == CAP_POSITION)
559 lua_pushinteger(ms->L, ms->capture[i].init - ms->src_init + 1);
560 else
561 lua_pushlstring(ms->L, ms->capture[i].init, l);
562 }
563}
564
565
566static 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