[Pcre-svn] [849] code/trunk: Allow octal escapes up to \777 …

Startseite
Nachricht löschen
Autor: Subversion repository
Datum:  
To: pcre-svn
Betreff: [Pcre-svn] [849] code/trunk: Allow octal escapes up to \777 in 16-bit non-UTF mode.
Revision: 849
          http://vcs.pcre.org/viewvc?view=rev&revision=849
Author:   ph10
Date:     2012-01-04 17:02:01 +0000 (Wed, 04 Jan 2012)


Log Message:
-----------
Allow octal escapes up to \777 in 16-bit non-UTF mode.

Modified Paths:
--------------
    code/trunk/pcre_compile.c
    code/trunk/testdata/testinput14
    code/trunk/testdata/testinput15
    code/trunk/testdata/testinput2
    code/trunk/testdata/testinput5
    code/trunk/testdata/testoutput14
    code/trunk/testdata/testoutput15
    code/trunk/testdata/testoutput2
    code/trunk/testdata/testoutput5


Modified: code/trunk/pcre_compile.c
===================================================================
--- code/trunk/pcre_compile.c    2012-01-04 16:34:01 UTC (rev 848)
+++ code/trunk/pcre_compile.c    2012-01-04 17:02:01 UTC (rev 849)
@@ -991,14 +991,16 @@
     /* \0 always starts an octal number, but we may drop through to here with a
     larger first octal digit. The original code used just to take the least
     significant 8 bits of octal numbers (I think this is what early Perls used
-    to do). Nowadays we allow for larger numbers in UTF-8 mode, but no more
-    than 3 octal digits. */
+    to do). Nowadays we allow for larger numbers in UTF-8 mode and 16-bit mode,
+    but no more than 3 octal digits. */


     case CHAR_0:
     c -= CHAR_0;
     while(i++ < 2 && ptr[1] >= CHAR_0 && ptr[1] <= CHAR_7)
         c = c * 8 + *(++ptr) - CHAR_0;
+#ifdef COMPILE_PCRE8         
     if (!utf && c > 0xff) *errorcodeptr = ERR51;
+#endif     
     break;


     /* \x is complicated. \x{ddd} is a character number which can be greater


Modified: code/trunk/testdata/testinput14
===================================================================
--- code/trunk/testdata/testinput14    2012-01-04 16:34:01 UTC (rev 848)
+++ code/trunk/testdata/testinput14    2012-01-04 17:02:01 UTC (rev 849)
@@ -307,4 +307,6 @@


/[\x0a\V]/BZ

+/\777/I
+
/-- End of testinput14 --/

Modified: code/trunk/testdata/testinput15
===================================================================
--- code/trunk/testdata/testinput15    2012-01-04 16:34:01 UTC (rev 848)
+++ code/trunk/testdata/testinput15    2012-01-04 17:02:01 UTC (rev 849)
@@ -275,4 +275,6 @@


/\R/SI8

+/\777/8DZ
+
/-- End of testinput15 --/

Modified: code/trunk/testdata/testinput2
===================================================================
--- code/trunk/testdata/testinput2    2012-01-04 16:34:01 UTC (rev 848)
+++ code/trunk/testdata/testinput2    2012-01-04 17:02:01 UTC (rev 849)
@@ -1569,8 +1569,6 @@
 /()()()()()()()()()(?:(?(A)(?P=A)a|b)(?P<A>X|Y))+/I
     bXXaYYaY


-/\777/I
-
 /\s*,\s*/IS
     \x0b,\x0b
     \x0c,\x0d


Modified: code/trunk/testdata/testinput5
===================================================================
--- code/trunk/testdata/testinput5    2012-01-04 16:34:01 UTC (rev 848)
+++ code/trunk/testdata/testinput5    2012-01-04 17:02:01 UTC (rev 849)
@@ -129,8 +129,6 @@


/^\ሴ/8DZ

-/\777/I
-
/\x{100}*\d/8DZ

/\x{100}*\s/8DZ

Modified: code/trunk/testdata/testoutput14
===================================================================
--- code/trunk/testdata/testoutput14    2012-01-04 16:34:01 UTC (rev 848)
+++ code/trunk/testdata/testoutput14    2012-01-04 17:02:01 UTC (rev 849)
@@ -445,4 +445,7 @@
         End
 ------------------------------------------------------------------


+/\777/I
+Failed: octal value is greater than \377 in 8-bit non-UTF-8 mode at offset 3
+
/-- End of testinput14 --/

Modified: code/trunk/testdata/testoutput15
===================================================================
--- code/trunk/testdata/testoutput15    2012-01-04 16:34:01 UTC (rev 848)
+++ code/trunk/testdata/testoutput15    2012-01-04 17:02:01 UTC (rev 849)
@@ -898,4 +898,16 @@
 Subject length lower bound = 1
 Starting byte set: \x0a \x0b \x0c \x0d \xc2 \xe2 


+/\777/8DZ
+------------------------------------------------------------------
+        Bra
+        \x{1ff}
+        Ket
+        End
+------------------------------------------------------------------
+Capturing subpattern count = 0
+Options: utf
+First char = \x{c7}
+Need char = \x{bf}
+
 /-- End of testinput15 --/


Modified: code/trunk/testdata/testoutput2
===================================================================
--- code/trunk/testdata/testoutput2    2012-01-04 16:34:01 UTC (rev 848)
+++ code/trunk/testdata/testoutput2    2012-01-04 17:02:01 UTC (rev 849)
@@ -6365,9 +6365,6 @@
  9: 
 10: Y


-/\777/I
-Failed: octal value is greater than \377 in 8-bit non-UTF-8 mode at offset 3
-
/\s*,\s*/IS
Capturing subpattern count = 0
No options

Modified: code/trunk/testdata/testoutput5
===================================================================
--- code/trunk/testdata/testoutput5    2012-01-04 16:34:01 UTC (rev 848)
+++ code/trunk/testdata/testoutput5    2012-01-04 17:02:01 UTC (rev 849)
@@ -482,9 +482,6 @@
 No first char
 No need char


-/\777/I
-Failed: octal value is greater than \377 in 8-bit non-UTF-8 mode at offset 3
-
 /\x{100}*\d/8DZ
 ------------------------------------------------------------------
         Bra