From: Jarkko Hietaniemi Date: Fri, 18 Apr 2003 19:28:04 +0000 (+0000) Subject: UTF8 regexp patch from Inaba Hiroto. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=14ebb1a2c3090470663d3e2baaf3787edad7c9a7;p=p5sagit%2Fp5-mst-13.2.git UTF8 regexp patch from Inaba Hiroto. p4raw-id: //depot/perl@19264 --- diff --git a/regcomp.c b/regcomp.c index c1ec5f9..8f52e28 100644 --- a/regcomp.c +++ b/regcomp.c @@ -576,14 +576,17 @@ S_cl_and(pTHX_ struct regnode_charclass_class *cl, if (!(and_with->flags & ANYOF_EOS)) cl->flags &= ~ANYOF_EOS; - if (cl->flags & ANYOF_UNICODE_ALL && and_with->flags & ANYOF_UNICODE) { + if (cl->flags & ANYOF_UNICODE_ALL && and_with->flags & ANYOF_UNICODE && + !(and_with->flags & ANYOF_INVERT)) { cl->flags &= ~ANYOF_UNICODE_ALL; cl->flags |= ANYOF_UNICODE; ARG_SET(cl, ARG(and_with)); } - if (!(and_with->flags & ANYOF_UNICODE_ALL)) + if (!(and_with->flags & ANYOF_UNICODE_ALL) && + !(and_with->flags & ANYOF_INVERT)) cl->flags &= ~ANYOF_UNICODE_ALL; - if (!(and_with->flags & (ANYOF_UNICODE|ANYOF_UNICODE_ALL))) + if (!(and_with->flags & (ANYOF_UNICODE|ANYOF_UNICODE_ALL)) && + !(and_with->flags & ANYOF_INVERT)) cl->flags &= ~ANYOF_UNICODE; } diff --git a/t/op/pat.t b/t/op/pat.t index 26e8594..006e1b6 100755 --- a/t/op/pat.t +++ b/t/op/pat.t @@ -6,7 +6,7 @@ $| = 1; -print "1..997\n"; +print "1..998\n"; BEGIN { chdir 't' if -d 't'; @@ -3166,4 +3166,10 @@ ok("bbbbac" =~ /$pattern/ && $1 eq 'a', "[perl #3547]"); "[perl #17757] Parse::RecDescent triggers infinite loop"); } -# last test 997 +{ + my $re = qq/^([^X]*)X/; + utf8::upgrade($re); + ok("\x{100}X" =~ /$re/, "S_cl_and ANYOF_UNICODE & ANYOF_INVERTED"); +} + +# last test 998