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

Function add_s

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

Source from the content-addressed store, hash-verified

676
677
678static void add_s (MatchState *ms, luaL_Buffer *b, const char *s,
679 const char *e) {
680 size_t l, i;
681 const char *news = lua_tolstring(ms->L, 3, &l);
682 for (i = 0; i < l; i++) {
683 if (news[i] != L_ESC)
684 luaL_addchar(b, news[i]);
685 else {
686 i++; /* skip ESC */
687 if (!isdigit(uchar(news[i]))) {
688 if (news[i] != L_ESC)
689 luaL_error(ms->L, "invalid use of " LUA_QL("%c")
690 " in replacement string", L_ESC);
691 luaL_addchar(b, news[i]);
692 }
693 else if (news[i] == '0')
694 luaL_addlstring(b, s, e - s);
695 else {
696 push_onecapture(ms, news[i] - '1', s, e);
697 luaL_addvalue(b); /* add capture to accumulated result */
698 }
699 }
700 }
701}
702
703
704static void add_value (MatchState *ms, luaL_Buffer *b, const char *s,

Callers 1

add_valueFunction · 0.70

Calls 5

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