[Pcre-svn] [292] code/trunk: Fix EBCDIC 0x41 omission and gi…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [292] code/trunk: Fix EBCDIC 0x41 omission and give error for \p and \P in a class when not
Revision: 292
          http://www.exim.org/viewvc/pcre2?view=rev&revision=292
Author:   ph10
Date:     2015-06-19 17:41:22 +0100 (Fri, 19 Jun 2015)
Log Message:
-----------
Fix EBCDIC 0x41 omission and give error for \p and \P in a class when not 
supported.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/src/pcre2_compile.c
    code/trunk/src/pcre2_internal.h
    code/trunk/testdata/testinputEBC
    code/trunk/testdata/testoutputEBC


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2015-06-19 10:16:33 UTC (rev 291)
+++ code/trunk/ChangeLog    2015-06-19 16:41:22 UTC (rev 292)
@@ -1,7 +1,7 @@
 Change Log for PCRE2
 --------------------


- Version 10.20 16-June-2015
+Version 10.20 16-June-2015
--------------------------

1. Callouts with string arguments have been added.
@@ -167,7 +167,15 @@
43. Single character repetition in JIT has been improved. 20-30% speedup
was achieved on certain patterns.

+44. The EBCDIC character 0x41 is a non-breaking space, equivalent to 0xa0 in
+ASCII/Unicode. This has now been added to the list of characters that are
+recognized as white space in EBCDIC.
+    
+45. When PCRE2 was compiled without Unicode support, the use of \p and \P gave
+an error (correctly) when used outside a class, but did not give an error
+within a class.


+
Version 10.10 06-March-2015
---------------------------


Modified: code/trunk/src/pcre2_compile.c
===================================================================
--- code/trunk/src/pcre2_compile.c    2015-06-19 10:16:33 UTC (rev 291)
+++ code/trunk/src/pcre2_compile.c    2015-06-19 16:41:22 UTC (rev 292)
@@ -4397,9 +4397,9 @@
               cb, PRIV(vspace_list));
             break;


-#ifdef SUPPORT_UNICODE
             case ESC_p:
             case ESC_P:
+#ifdef SUPPORT_UNICODE
               {
               BOOL negated;
               unsigned int ptype = 0, pdata = 0;
@@ -4413,6 +4413,9 @@
               class_has_8bitchar--;                /* Undo! */
               }
             break;
+#else
+            *errorcodeptr = ERR45;
+            goto FAILED;              
 #endif
             /* Unrecognized escapes are faulted. */



Modified: code/trunk/src/pcre2_internal.h
===================================================================
--- code/trunk/src/pcre2_internal.h    2015-06-19 10:16:33 UTC (rev 291)
+++ code/trunk/src/pcre2_internal.h    2015-06-19 16:41:22 UTC (rev 292)
@@ -382,7 +382,7 @@
 PCRE for a long time. */


 #define HSPACE_LIST \
-  CHAR_HT, CHAR_SPACE, 0xa0, \
+  CHAR_HT, CHAR_SPACE, CHAR_NBSP, \
   0x1680, 0x180e, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, \
   0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202f, 0x205f, 0x3000, \
   NOTACHAR
@@ -408,7 +408,7 @@
 #define HSPACE_BYTE_CASES \
   case CHAR_HT: \
   case CHAR_SPACE: \
-  case 0xa0     /* NBSP */
+  case CHAR_NBSP


#define HSPACE_CASES \
HSPACE_BYTE_CASES: \
@@ -435,11 +435,12 @@
/* -------------- EBCDIC environments -------------- */

#else
-#define HSPACE_LIST CHAR_HT, CHAR_SPACE
+#define HSPACE_LIST CHAR_HT, CHAR_SPACE, CHAR_NBSP

#define HSPACE_BYTE_CASES \
case CHAR_HT: \
- case CHAR_SPACE
+ case CHAR_SPACE: \
+ case CHAR_NBSP

#define HSPACE_CASES HSPACE_BYTE_CASES

@@ -633,6 +634,7 @@

 #define CHAR_ESC                    '\047'
 #define CHAR_DEL                    '\007'
+#define CHAR_NBSP                   ((unsigned char)'\x41')
 #define STR_ESC                     "\047"
 #define STR_DEL                     "\007"


@@ -647,6 +649,7 @@
 #define CHAR_NEL                    ((unsigned char)'\x85')
 #define CHAR_ESC                    '\033'
 #define CHAR_DEL                    '\177'
+#define CHAR_NBSP                   ((unsigned char)'\xa0')


 #define STR_LF                      "\n"
 #define STR_NL                      STR_LF
@@ -1029,6 +1032,7 @@
 #define CHAR_VERTICAL_LINE          '\174'
 #define CHAR_RIGHT_CURLY_BRACKET    '\175'
 #define CHAR_TILDE                  '\176'
+#define CHAR_NBSP                   ((unsigned char)'\xa0')


 #define STR_HT                      "\011"
 #define STR_VT                      "\013"


Modified: code/trunk/testdata/testinputEBC
===================================================================
--- code/trunk/testdata/testinputEBC    2015-06-19 10:16:33 UTC (rev 291)
+++ code/trunk/testdata/testinputEBC    2015-06-19 16:41:22 UTC (rev 292)
@@ -29,13 +29,16 @@


 /^A\\x88/
     A B
+    A\x41B 


# Test \H

 /^A\\xC8/
     AB
+    A\x42B 
     ** Fail
     A B
+    A\x41B 


# Test \R


Modified: code/trunk/testdata/testoutputEBC
===================================================================
--- code/trunk/testdata/testoutputEBC    2015-06-19 10:16:33 UTC (rev 291)
+++ code/trunk/testdata/testoutputEBC    2015-06-19 16:41:22 UTC (rev 292)
@@ -41,6 +41,8 @@
 /^A\\x88/
     A B
  0: A\x20
+    A\x41B 
+ 0: AA


# Test \H

@@ -47,10 +49,14 @@
 /^A\\xC8/
     AB
  0: AB
+    A\x42B 
+ 0: AB
     ** Fail
 No match
     A B
 No match
+    A\x41B 
+No match


# Test \R