Bug 10670 fix.
[mono.git] / mcs / class / System / System.Text.RegularExpressions / parser.cs
index 241a5967960042c1cee33e8b3f4307ca6e2bb853..f3ddf196730bb8879cbdc0dd8fc5a82829c91486 100644 (file)
@@ -529,7 +529,7 @@ namespace System.Text.RegularExpressions.Syntax {
                                }
                                else {                                          // capture test
                                        ++ ptr;
-                                       asn = new CaptureAssertion ();
+                                       asn = new CaptureAssertion (new Literal (name, IsIgnoreCase (options)));
                                        refs.Add (asn, name);
                                }
 
@@ -761,8 +761,8 @@ namespace System.Text.RegularExpressions.Syntax {
 
                        /* check bounds and ordering */
 
-                       if (n >= 0xffff || m >= 0xffff)
-                               throw NewParseException ("Illegal {x, y} - maximum of 65535.");
+                       if (n > 0x7fffffff || m > 0x7fffffff)
+                               throw NewParseException ("Illegal {x, y} - maximum of 2147483647.");
                        if (m >= 0 && m < n)
                                throw NewParseException ("Illegal {x, y} with x > y.");
 
@@ -772,7 +772,7 @@ namespace System.Text.RegularExpressions.Syntax {
                        if (m > 0)
                                max = m;
                        else
-                               max = 0xffff;
+                               max = 0x7fffffff;
 
                        return true;
                }
@@ -1097,6 +1097,8 @@ namespace System.Text.RegularExpressions.Syntax {
                        foreach (Expression expr in refs.Keys) {
                                string name = (string)refs[expr];
                                if (!dict.Contains (name)) {
+                                       if (expr is CaptureAssertion && !Char.IsDigit (name [0]))
+                                               continue;
                                        throw NewParseException ("Reference to undefined group " +
                                                (Char.IsDigit (name[0]) ? "number " : "name ") +
                                                name);