[Pcre-svn] [1385] code/trunk: Update perltest.pl to add /u w…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [1385] code/trunk: Update perltest.pl to add /u when /W is in the test.
Revision: 1385
          http://vcs.pcre.org/viewvc?view=rev&revision=1385
Author:   ph10
Date:     2013-10-29 16:08:15 +0000 (Tue, 29 Oct 2013)


Log Message:
-----------
Update perltest.pl to add /u when /W is in the test.

Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/perltest.pl


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2013-10-25 17:37:50 UTC (rev 1384)
+++ code/trunk/ChangeLog    2013-10-29 16:08:15 UTC (rev 1385)
@@ -142,6 +142,11 @@
 29. Whereas an item such as A{4}+ ignored the possessivenes of the quantifier 
     (because it's meaningless), this was not happening when PCRE_CASELESS was 
     set. Not wrong, but inefficient. 
+    
+30. Updated perltest.pl to add /u (force Unicode mode) when /W (use Unicode 
+    properties for \w, \d, etc) is present in a test regex. Otherwise if the 
+    test contains no characters greater than 255, Perl doesn't realise it 
+    should be using Unicode semantics. 



Version 8.33 28-May-2013

Modified: code/trunk/perltest.pl
===================================================================
--- code/trunk/perltest.pl    2013-10-25 17:37:50 UTC (rev 1384)
+++ code/trunk/perltest.pl    2013-10-29 16:08:15 UTC (rev 1385)
@@ -1,20 +1,17 @@
 #! /usr/bin/env perl


# Program for testing regular expressions with perl to check that PCRE handles
-# them the same. This version supports /8 for UTF-8 testing. However, it needs
-# to have "use utf8" at the start for running the UTF-8 tests, but *not* for
-# the other tests. The only way I've found for doing this is to cat this line
-# in explicitly in the RunPerlTest script. I've also used this method to supply
-# "require Encode" for the UTF-8 tests, so that the main test will still run
-# where Encode is not installed.
+# them the same. This version needs to have "use utf8" at the start for running
+# the UTF-8 tests, but *not* for the other tests. The only way I've found for
+# doing this is to cat this line in explicitly in the RunPerlTest script. I've
+# also used this method to supply "require Encode" for the UTF-8 tests, so that
+# the main test will still run where Encode is not installed.

-# use locale; # With this included, \x0b matches \s!
-
-# Function for turning a string into a string of printing chars.
-
#use utf8;
#require Encode;

+# Function for turning a string into a string of printing chars.
+
sub pchars {
my($t) = "";

@@ -106,9 +103,9 @@

$pattern =~ s/K(?=[a-zA-Z]*$)//;

- # Remove /W from a pattern (asks pcretest to set PCRE_UCP)
+ # /W asks pcretest to set PCRE_UCP; change this to /u for Perl

- $pattern =~ s/W(?=[a-zA-Z]*$)//;
+ $pattern =~ s/W(?=[a-zA-Z]*$)/u/;

# Remove /S or /SS from a pattern (asks pcretest to study or not to study)