Distinguish between the potentially ambiguous \nnn and the non-ambiguous \k<...>...
authorRaja R Harinath <harinath@hurrynot.org>
Mon, 10 Aug 2009 16:24:45 +0000 (16:24 -0000)
committerRaja R Harinath <harinath@hurrynot.org>
Mon, 10 Aug 2009 16:24:45 +0000 (16:24 -0000)
* syntax.cs (BackslashNumber): New class.
* parser.cs (ParseSpecial): Create it instead of 'Reference' if a
numeric backreference is seen.

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

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

index 79707d381bf8ee96d6c283063b0b2980e93ad93d..e6e83332e02c9009ddaccb22880b0f9fca5d0c3d 100644 (file)
@@ -1,3 +1,9 @@
+2009-08-10  Raja R Harinath  <harinath@hurrynot.org>
+
+       * syntax.cs (BackslashNumber): New class.
+       * parser.cs (ParseSpecial): Create it instead of 'Reference' if a
+       numeric backreference is seen.
+
 2009-08-10  Raja R Harinath  <harinath@hurrynot.org>
 
        * parser.cs (ResolveReferences): Allow named groups to be
index 7cf261deb4f60407b691ede2cfc40c4e4cd5f313..ee115c175568ce8955eb7bedcfd1695f3890ebaa 100644 (file)
@@ -864,7 +864,7 @@ namespace System.Text.RegularExpressions.Syntax {
                                // FIXME test if number is within number of assigned groups
                                // this may present a problem for right-to-left matching
 
-                               Reference reference = new Reference (IsIgnoreCase (options));
+                               Reference reference = new BackslashNumber (IsIgnoreCase (options), ecma);
                                refs.Add (reference, n.ToString ());
                                expr = reference;
                                break;
index 9204010c2d849d2078c63abfdbca16ba9a32926a..d9cc4a36141f0531a1d8404678694924966e3de8 100644 (file)
@@ -797,6 +797,17 @@ namespace System.Text.RegularExpressions.Syntax {
                private bool ignore;
        }
 
+       class BackslashNumber : Reference {
+               string literal;
+               bool ecma;
+
+               public BackslashNumber (bool ignore, bool ecma)
+                       : base (ignore)
+               {
+                       this.ecma = ecma;
+               }
+       }
+
        class CharacterClass : Expression {
                public CharacterClass (bool negate, bool ignore) {
                        this.negate = negate;