2002-10-25 Gonzalo Paniagua Javier <gonzalo@ximian.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Fri, 25 Oct 2002 15:09:02 +0000 (15:09 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Fri, 25 Oct 2002 15:09:02 +0000 (15:09 -0000)
* parser.cs: applied fix from Tim Haynes (thaynes@openlinksw.com) to
solve bug #32807. Also modified GetMapping to return the same as MS.

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

mcs/class/System/System.Text.RegularExpressions/ChangeLog
mcs/class/System/System.Text.RegularExpressions/parser.cs

index 415124ba16e2ccbda7d1cc04b51f1dd5467ec282..f947fca6500318582ab3738105a1f55667eb71fe 100644 (file)
@@ -1,3 +1,8 @@
+2002-10-25  Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * parser.cs: applied fix from Tim Haynes (thaynes@openlinksw.com) to
+       solve bug #32807. Also modified GetMapping to return the same as MS.
+
 2002-08-28  Juli Mallett  <jmallett@FreeBSD.org>
 
        * arch.cs, compiler.cs: Give the interpreter machine a property
index 3327cf3024ab7498936c49502efd920dae9c6bcf..67f81f243d35ce5ec438e678af2e013920e403b6 100644 (file)
@@ -128,9 +128,15 @@ namespace System.Text.RegularExpressions.Syntax {
 \r
                public IDictionary GetMapping () {\r
                        Hashtable mapping = new Hashtable ();\r
-                       foreach (CapturingGroup group in caps) {\r
-                               if (group.Name != null)\r
+                       int end = caps.Count;\r
+                       mapping.Add ("0", 0);\r
+                       for (int i = 0; i < end;) {\r
+                               CapturingGroup group = (CapturingGroup) caps [i];\r
+                               i++;\r
+                               if (group.Name != null && !mapping.Contains (group.Name))\r
                                        mapping.Add (group.Name, group.Number);\r
+                               else\r
+                                       mapping.Add (i.ToString (), i);\r
                        }\r
 \r
                        return mapping;\r