+2004-03-24 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * parser.cs: fixed group numbering.
+
2004-03-22 Jackson Harper <jackson@ximian.com>
- * parser.cs: Use the group number as the name in mapping. Patch by Gert Driesen.
+ * parser.cs: Use the group number as the name in mapping. Patch by
+ Gert Driesen.
* regex.cs: Fix off by one error. Patch by Gert Driesen.
2004-03-17 Francois Beauchemin <beauche@softhome.net>
\r
public IDictionary GetMapping () {\r
Hashtable mapping = new Hashtable ();\r
+ Hashtable numbers = new Hashtable ();\r
int end = caps.Count;\r
mapping.Add ("0", 0);\r
- for (int i = 0; i < end;) {\r
+ for (int i = 0; i < end; i++) {\r
CapturingGroup group = (CapturingGroup) caps [i];\r
- i++;\r
- if (group.Name != null && !mapping.Contains (group.Name))\r
+ if (group.Name != null && !mapping.Contains (group.Name)) {\r
mapping.Add (group.Name, group.Number);\r
- else\r
- mapping.Add (group.Number.ToString (), group.Number);\r
+ numbers.Add (group.Number, group.Number);\r
+ }\r
+ }\r
+\r
+ for (int i = 1; i < end; i++) {\r
+ if (numbers [i] == null)\r
+ mapping.Add (i.ToString (), i);\r
}\r
\r
return mapping;\r