2005-01-08 Miguel de Icaza <miguel@ximian.com>
authorMiguel de Icaza <miguel@gnome.org>
Sat, 8 Jan 2005 06:21:04 +0000 (06:21 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Sat, 8 Jan 2005 06:21:04 +0000 (06:21 -0000)
* syntax.cs: Applied patch from mei@work.email.ne.jp to fix bug
#71077.

* parser.cs: Turns out that \digit sequences are octal sequences
(no leading zero is needed);  And the three octal digit rule
applies to the leading zero as well.

This fixes the Unescape method.

2005-01-08  Miguel de Icaza  <miguel@ximian.com>

* RegexBugs.cs: Add new test.

svn path=/trunk/mcs/; revision=38517

mcs/class/System/System.Text.RegularExpressions/ChangeLog
mcs/class/System/System.Text.RegularExpressions/category.cs
mcs/class/System/System.Text.RegularExpressions/parser.cs
mcs/class/System/System.Text.RegularExpressions/syntax.cs
mcs/class/System/Test/System.Text.RegularExpressions/ChangeLog
mcs/class/System/Test/System.Text.RegularExpressions/RegexBugs.cs

index 76318c180eb4e061f490334bee4c02e93043e7ff..d77bf50cbf9c8a92989cd48f67fd1e16a1014cd0 100644 (file)
@@ -1,3 +1,14 @@
+2005-01-08  Miguel de Icaza  <miguel@ximian.com>
+
+       * syntax.cs: Applied patch from mei@work.email.ne.jp to fix bug
+       #71077.
+
+       * parser.cs: Turns out that \digit sequences are octal sequences
+       (no leading zero is needed);  And the three octal digit rule
+       applies to the leading zero as well.
+
+       This fixes the Unescape method.
+
 2004-11-29 Gonzalo Paniagua Javier <gonzalo@ximian.com>
 
        * regex.cs: use NextMatch to move on to the next match. Fixes bug
index 6b465e407901ad35d4a9920760bcfc6d58203b1e..c3048629a7e255488b062f2fc79a85ea1c88ad39 100644 (file)
@@ -219,7 +219,7 @@ namespace System.Text.RegularExpressions {
                                return false;\r
                        \r
                        case Category.Any:\r
-                               return c != '\n';\r
+                               return c != '\n';
 \r
                        case Category.AnySingleline:\r
                                return true;\r
index 80ce31eb301bcdddfd638653f56d2507cfd67d2b..15512d9539beece9c1f02161b80b070b1f69837c 100644 (file)
@@ -930,6 +930,13 @@ namespace System.Text.RegularExpressions.Syntax {
                        // character codes
 
                        case '0':
+                               //
+                               // Turns out that octal values can be specified
+                               // without a leading zero.   But also the limit
+                               // of three character should include this first
+                               // one.  
+                               //
+                               ptr--;
                                int prevptr = ptr;
                                int result = ParseOctal (pattern, ref ptr);
                                if (result == -1 && prevptr == ptr)
index a350b73d64297263b9527b9053eb16911d32a9fe..46a24cb8a04750e873c9fdca75d1ad1ddf8f7709 100644 (file)
@@ -887,7 +887,7 @@ namespace System.Text.RegularExpressions.Syntax {
                        for (int i = 0; i < pos_cats.Length; ++ i) {
                                if (pos_cats[i]) {
                                        if (neg_cats [i])
-                                               cmp.EmitCategory (Category.Any, negate, reverse);
+                                               cmp.EmitCategory (Category.AnySingleline, negate, reverse);
                                        else
                                                cmp.EmitCategory ((Category)i, negate, reverse);
                                } else if (neg_cats[i]) {
index a11557809ecc195d60f7e87888b60222e86ee023..d2387a6ace4f4ed178b2fe41d7d6df8bf88678a6 100644 (file)
@@ -1,3 +1,7 @@
+2005-01-08  Miguel de Icaza  <miguel@ximian.com>
+
+       * RegexBugs.cs: Add new test.
+
 2005-01-08  Nick Drochak  <ndrochak@ieee.org>
 
        * RegexTest.cs: Make pass on MS.NET
index f81973175d2e3fc056b24338bb46b69f0d70b45e..03d13ac93c54581b1e2d8038ec42a557da9b547e 100644 (file)
@@ -80,6 +80,15 @@ namespace MonoTests.System.Text.RegularExpressions
                        AssertEquals ("BR #01", false, m.Success);
                }
 
+               [Test]
+               public void WhiteSpaceGroupped () // bug 71077
+               {
+                       string s = "\n";
+                       string p = @"[\s\S]";   // =Category.Any
+
+                       AssertEquals ("WSG#1", true, Regex.IsMatch (s, p));
+               }
+
                 [Test]
                 public void RangeIgnoreCase() // bug 45976
                 {