| 588 | |
| 589 | |
| 590 | static void add_s (MatchState *ms, luaL_Buffer *b, const char *s, |
| 591 | const char *e) { |
| 592 | size_t l, i; |
| 593 | const char *news = lua_tolstring(ms->L, 3, &l); |
| 594 | for (i = 0; i < l; i++) { |
| 595 | if (news[i] != L_ESC) |
| 596 | luaL_addchar(b, news[i]); |
| 597 | else { |
| 598 | i++; /* skip ESC */ |
| 599 | if (!isdigit(uchar(news[i]))) |
| 600 | luaL_addchar(b, news[i]); |
| 601 | else if (news[i] == '0') |
| 602 | luaL_addlstring(b, s, e - s); |
| 603 | else { |
| 604 | push_onecapture(ms, news[i] - '1', s, e); |
| 605 | luaL_addvalue(b); /* add capture to accumulated result */ |
| 606 | } |
| 607 | } |
| 608 | } |
| 609 | } |
| 610 | |
| 611 | |
| 612 | static void add_value (MatchState *ms, luaL_Buffer *b, const char *s, |
no test coverage detected