lib/re1.5: Distinguish between subject start-of-line and start-of-srch.

Otherwise a repeated sub/split will continue to match ^ to the start of
that search.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2022-03-10 11:49:01 +11:00
parent 1692cad673
commit adfd57c5fe
2 changed files with 2 additions and 1 deletions

View File

@ -130,6 +130,7 @@ Sub *update(Sub*, int, const char*);
void decref(Sub*); void decref(Sub*);
struct Subject { struct Subject {
const char *begin_line;
const char *begin; const char *begin;
const char *end; const char *end;
}; };

View File

@ -68,7 +68,7 @@ recursiveloop(char *pc, const char *sp, Subject *input, const char **subp, int n
subp[off] = old; subp[off] = old;
return 0; return 0;
case Bol: case Bol:
if(sp != input->begin) if(sp != input->begin_line)
return 0; return 0;
continue; continue;
case Eol: case Eol: