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

Function add_s

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

Source from the content-addressed store, hash-verified

687
688
689static void add_s (MatchState *ms, luaL_Buffer *b, const char *s,
690 const char *e) {
691 size_t l, i;
692 const char *news = lua_tolstring(ms->L, 3, &l);
693 for (i = 0; i < l; i++) {
694 if (news[i] != L_ESC)
695 luaL_addchar(b, news[i]);
696 else {
697 i++; /* skip ESC */
698 if (!isdigit(uchar(news[i]))) {
699 if (news[i] != L_ESC)
700 luaL_error(ms->L, "invalid use of " LUA_QL("%c")
701 " in replacement string", L_ESC);
702 luaL_addchar(b, news[i]);
703 }
704 else if (news[i] == '0')
705 luaL_addlstring(b, s, e - s);
706 else {
707 push_onecapture(ms, news[i] - '1', s, e);
708 luaL_addvalue(b); /* add capture to accumulated result */
709 }
710 }
711 }
712}
713
714
715static void add_value (MatchState *ms, luaL_Buffer *b, const char *s,

Callers 1

add_valueFunction · 0.70

Calls 6

isdigitFunction · 0.85
lua_tolstringFunction · 0.70
luaL_errorFunction · 0.70
luaL_addlstringFunction · 0.70
push_onecaptureFunction · 0.70
luaL_addvalueFunction · 0.70

Tested by

no test coverage detected