From: Raja R Harinath Date: Mon, 10 Aug 2009 16:24:45 +0000 (-0000) Subject: Distinguish between the potentially ambiguous \nnn and the non-ambiguous \k<...>... X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=54481772e913d5b487e48f3a0301786fc00f7c78;p=mono.git Distinguish between the potentially ambiguous \nnn and the non-ambiguous \k<...> back-references * 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 --- diff --git a/mcs/class/System/System.Text.RegularExpressions/ChangeLog b/mcs/class/System/System.Text.RegularExpressions/ChangeLog index 79707d381bf..e6e83332e02 100644 --- a/mcs/class/System/System.Text.RegularExpressions/ChangeLog +++ b/mcs/class/System/System.Text.RegularExpressions/ChangeLog @@ -1,3 +1,9 @@ +2009-08-10 Raja R Harinath + + * 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 * parser.cs (ResolveReferences): Allow named groups to be diff --git a/mcs/class/System/System.Text.RegularExpressions/parser.cs b/mcs/class/System/System.Text.RegularExpressions/parser.cs index 7cf261deb4f..ee115c17556 100644 --- a/mcs/class/System/System.Text.RegularExpressions/parser.cs +++ b/mcs/class/System/System.Text.RegularExpressions/parser.cs @@ -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; diff --git a/mcs/class/System/System.Text.RegularExpressions/syntax.cs b/mcs/class/System/System.Text.RegularExpressions/syntax.cs index 9204010c2d8..d9cc4a36141 100644 --- a/mcs/class/System/System.Text.RegularExpressions/syntax.cs +++ b/mcs/class/System/System.Text.RegularExpressions/syntax.cs @@ -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;