(U8*)(off >= 0 ? reginfo->strend : reginfo->strbeg)) \
: (U8*)(pos + off))
-#define HOPBACKc(pos, off) \
- (char*)(reginfo->is_utf8_target \
- ? reghopmaybe3((U8*)pos, (SSize_t)0-off, (U8*)(reginfo->strbeg)) \
- : (pos - off >= reginfo->strbeg) \
- ? (U8*)pos - off \
+/* like HOPMAYBE3 but backwards. lim must be +ve. Returns NULL on overshoot */
+#define HOPBACK3(pos, off, lim) \
+ (reginfo->is_utf8_target \
+ ? reghopmaybe3((U8*)pos, (SSize_t)0-off, (U8*)(lim)) \
+ : (pos - off >= lim) \
+ ? (U8*)pos - off \
: NULL)
+#define HOPBACKc(pos, off) ((char*)HOPBACK3(pos, off, reginfo->strbeg))
+
#define HOP3(pos,off,lim) (reginfo->is_utf8_target ? reghop3((U8*)(pos), off, (U8*)(lim)) : (U8*)(pos + off))
#define HOP3c(pos,off,lim) ((char*)HOP3(pos,off,lim))
(IV)prog->check_end_shift);
});
- end_point = HOP3(strend, -end_shift, strbeg);
+ end_point = HOPBACK3(strend, end_shift, rx_origin);
+ if (!end_point)
+ goto fail_finish;
start_point = HOPMAYBE3(rx_origin, start_shift, end_point);
if (!start_point)
goto fail_finish;
/* Do not break within emoji flag sequences. That is, do not
* break between regional indicator (RI) symbols if there is an
* odd number of RI characters before the break point.
- * GB12 ^ (RI RI)* RI × RI
+ * GB12 sot (RI RI)* RI × RI
* GB13 [^RI] (RI RI)* RI × RI */
while (backup_one_GCB(strbeg,
* only if there are an even number of regional indicators
* preceding the position of the break.
*
- * sot (RI RI)* RI × RI
+ * sot (RI RI)* RI × RI
* [^RI] (RI RI)* RI × RI */
while (backup_one_LB(strbeg,
* odd number of RI characters before the potential break
* point.
*
- * WB15 ^ (RI RI)* RI × RI
+ * WB15 sot (RI RI)* RI × RI
* WB16 [^RI] (RI RI)* RI × RI */
while (backup_one_WB(&previous,
return TRUE;
}
+#ifndef PERL_IN_XSUB_RE
+
bool
Perl__is_grapheme(pTHX_ const U8 * strbeg, const U8 * s, const U8 * strend, const UV cp)
{
return isGCB(cp_gcb_val, next_cp_gcb_val, strbeg, s, TRUE);
}
+#endif