diff options
author | Raja R Harinath <harinath@hurrynot.org> | 2009-08-10 20:24:45 +0400 |
---|---|---|
committer | Raja R Harinath <harinath@hurrynot.org> | 2009-08-10 20:24:45 +0400 |
commit | 54481772e913d5b487e48f3a0301786fc00f7c78 (patch) | |
tree | 201e0c3a40f0e3a4302757ade72cf5eb630ca294 /mcs | |
parent | 88c39f81b9bddbd3e1a8309b94c945526e36ba77 (diff) |
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
Diffstat (limited to 'mcs')
3 files changed, 18 insertions, 1 deletions
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,5 +1,11 @@ 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 referred-to by their group numbers too. 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; |