summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorKarl Williamson <public@khwilliamson.com>2011-03-08 17:06:47 -0700
committerKarl Williamson <public@khwilliamson.com>2011-03-08 23:22:17 -0700
commitc613755a4b4fc8e64a77639d47d7e208fee68edc (patch)
tree79d619f3808d2f33e5d8613e59e16ebf74c3fc03 /regexec.c
parentf0c16e54b3b5efbb4380952c7ba5e8d7626d7cae (diff)
downloadperl-c613755a4b4fc8e64a77639d47d7e208fee68edc.tar.gz
regex: /l in combo with others in syn start class
Now that regexes can be combinations of different charset modifiers, a synthetic start class can match locale and non-locale both. locale should generally match only things in the bitmap for code points < 256. But a synthetic start class with a non-locale component can match such code points. This patch makes an exception for synthetic nodes that will be resolved if it passes and is matched again for real.
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/regexec.c b/regexec.c
index 739eba6d8d..76784ee97f 100644
--- a/regexec.c
+++ b/regexec.c
@@ -6587,16 +6587,21 @@ S_reginclass(pTHX_ const regexp * const prog, register const regnode * const n,
/* If the bitmap didn't (or couldn't) match, and something outside the
* bitmap could match, try that. Locale nodes specifiy completely the
* behavior of code points in the bit map (otherwise, a utf8 target would
- * cause them to be treated as Unicode and not locale), except XXX in
+ * cause them to be treated as Unicode and not locale), except in
* the very unlikely event when this node is a synthetic start class, which
- * could be a combination of locale and non-locale nodes */
+ * could be a combination of locale and non-locale nodes. So allow locale
+ * to match for the synthetic start class, which will give a false
+ * positive that will be resolved when the match is done again as not part
+ * of the synthetic start class */
if (!match) {
if (utf8_target && (flags & ANYOF_UNICODE_ALL) && c >= 256) {
match = TRUE; /* Everything above 255 matches */
}
else if ((flags & ANYOF_NONBITMAP_NON_UTF8
|| (utf8_target && ANYOF_NONBITMAP(n)
- && (c >=256 || ! (flags & ANYOF_LOCALE)))))
+ && (c >=256
+ || (! (flags & ANYOF_LOCALE))
+ || (flags & ANYOF_IS_SYNTHETIC)))))
{
AV *av;
SV * const sw = regclass_swash(prog, n, TRUE, 0, (SV**)&av);