Bump VERSION to commit e892c9f

This commit is contained in:
Alec Murphy
2026-05-07 10:57:52 -04:00
parent 4d8e2799b7
commit d382f85b92
4 changed files with 14 additions and 7 deletions
+1 -1
View File
@@ -1 +1 @@
commit 0b4ed7e4ba37030fdd00f6a17b6de75cd7d7954b commit e892c9fdbbddba94e52f656ccb378ed4885e30cc
+4 -2
View File
@@ -67,7 +67,8 @@ void js_RegExp_prototype_exec(js_State *J, js_Regexp *re, const char *text)
} }
if (re->last > 0) { if (re->last > 0) {
haystack = text + re->last; haystack = text + re->last;
opts |= REG_NOTBOL; if (!(re->flags & JS_REGEXP_M) || haystack[-1] != '\n')
opts |= REG_NOTBOL;
} }
} }
@@ -115,7 +116,8 @@ static void Rp_test(js_State *J)
} }
if (re->last > 0) { if (re->last > 0) {
text += re->last; text += re->last;
opts |= REG_NOTBOL; if (!(re->flags & JS_REGEXP_M) || text[-1] != '\n')
opts |= REG_NOTBOL;
} }
} }
+8 -3
View File
@@ -417,6 +417,11 @@ static void Sp_toUpperCase(js_State *J)
js_free(J, dst); js_free(J, dst);
} }
static int isbol(js_Regexp *re, const char *text, const char *a)
{
return a == text || ((re->flags & JS_REGEXP_M) && a[-1] == '\n');
}
static int istrim(int c) static int istrim(int c)
{ {
return c == 0x9 || c == 0xB || c == 0xC || c == 0x20 || c == 0xA0 || c == 0xFEFF || return c == 0x9 || c == 0xB || c == 0xC || c == 0x20 || c == 0xA0 || c == 0xFEFF ||
@@ -492,7 +497,7 @@ static void Sp_match(js_State *J)
a = text; a = text;
e = text + strlen(text); e = text + strlen(text);
while (a <= e) { while (a <= e) {
if (js_doregexec(J, re->prog, a, &m, a > text ? REG_NOTBOL : 0)) if (js_doregexec(J, re->prog, a, &m, isbol(re, text, a) ? 0 : REG_NOTBOL))
break; break;
b = m.sub[0].sp; b = m.sub[0].sp;
@@ -625,7 +630,7 @@ loop:
else else
goto end; goto end;
} }
if (!js_doregexec(J, re->prog, source, &m, REG_NOTBOL)) if (!js_doregexec(J, re->prog, source, &m, isbol(re, source0, source) ? 0 : REG_NOTBOL))
goto loop; goto loop;
} }
@@ -740,7 +745,7 @@ static void Sp_split_regexp(js_State *J)
p = a = text; p = a = text;
while (a < e) { while (a < e) {
if (js_doregexec(J, re->prog, a, &m, a > text ? REG_NOTBOL : 0)) if (js_doregexec(J, re->prog, a, &m, isbol(re, text, a) ? 0 : REG_NOTBOL))
break; /* no match */ break; /* no match */
b = m.sub[0].sp; b = m.sub[0].sp;
+1 -1
View File
@@ -18,7 +18,7 @@
#define REG_MAXPROG (32 << 10) #define REG_MAXPROG (32 << 10)
#endif #endif
#ifndef REG_MAXREC #ifndef REG_MAXREC
#define REG_MAXREC 1024 #define REG_MAXREC 4096
#endif #endif
#ifndef REG_MAXSPAN #ifndef REG_MAXSPAN
#define REG_MAXSPAN 64 #define REG_MAXSPAN 64