Imported Upstream version 5.4.0.167

Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-08-21 15:34:15 +00:00
parent e49d6f06c0
commit 536cd135cc
12856 changed files with 563812 additions and 223249 deletions

View File

@@ -138,7 +138,7 @@ namespace System.Text.RegularExpressions {
#else
// desktop build still uses non-generic collections for AppCompat with .NET Framework 3.5 pre-compiled assemblies
protected internal Hashtable caps;
protected internal Hashtable capnames;
protected internal Hashtable capnames;
#endif
protected internal String[] capslist; // if captures are sparse or named captures are used, this is the sorted list of names
protected internal int capsize; // the size of the capture array
@@ -445,7 +445,7 @@ namespace System.Text.RegularExpressions {
/// Unescapes any escaped characters in the input string.
/// </para>
/// </devdoc>
[SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId="Unescape", Justification="[....]: already shipped since v1 - can't fix without causing a breaking change")]
[SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId="Unescape", Justification="Microsoft: already shipped since v1 - can't fix without causing a breaking change")]
public static String Unescape(String str) {
if (str==null)
throw new ArgumentNullException("str");
@@ -1255,7 +1255,7 @@ namespace System.Text.RegularExpressions {
#endif
[ResourceExposure(ResourceScope.Machine)] // The AssemblyName is interesting.
[ResourceConsumption(ResourceScope.Machine)]
[SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId="assemblyname", Justification="[....]: already shipped since v1 - can't fix without causing a breaking change")]
[SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId="assemblyname", Justification="Microsoft: already shipped since v1 - can't fix without causing a breaking change")]
public static void CompileToAssembly(RegexCompilationInfo[] regexinfos, AssemblyName assemblyname) {
CompileToAssemblyInternal(regexinfos, assemblyname, null, null);
@@ -1268,7 +1268,7 @@ namespace System.Text.RegularExpressions {
#endif
[ResourceExposure(ResourceScope.Machine)] // The AssemblyName is interesting.
[ResourceConsumption(ResourceScope.Machine)]
[SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId="assemblyname", Justification="[....]: already shipped since v1 - can't fix without causing a breaking change")]
[SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId="assemblyname", Justification="Microsoft: already shipped since v1 - can't fix without causing a breaking change")]
public static void CompileToAssembly(RegexCompilationInfo[] regexinfos, AssemblyName assemblyname, CustomAttributeBuilder[] attributes) {
CompileToAssemblyInternal(regexinfos, assemblyname, attributes, null);
}
@@ -1278,7 +1278,7 @@ namespace System.Text.RegularExpressions {
#endif
[ResourceExposure(ResourceScope.Machine)]
[ResourceConsumption(ResourceScope.Machine)]
[SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId="assemblyname", Justification="[....]: already shipped since v1 - can't fix without causing a breaking change")]
[SuppressMessage("Microsoft.Naming","CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId="assemblyname", Justification="Microsoft: already shipped since v1 - can't fix without causing a breaking change")]
public static void CompileToAssembly(RegexCompilationInfo[] regexinfos, AssemblyName assemblyname, CustomAttributeBuilder[] attributes, String resourceFile) {
CompileToAssemblyInternal(regexinfos, assemblyname, attributes, resourceFile);
}

View File

@@ -1 +1 @@
5a60311ee31fcc8fcb19b911668c562b11ce4123
8658e1dd4fe0a9f71f2b6ffeb7d72d20fdea9eef

View File

@@ -10,6 +10,7 @@
namespace System.Text.RegularExpressions {
using System.Security.Permissions;
using System.Runtime.Serialization;
/// <devdoc>
/// Group
@@ -22,19 +23,24 @@ namespace System.Text.RegularExpressions {
#endif
public class Group : Capture {
// the empty group object
internal static Group _emptygroup = new Group(String.Empty, new int[0], 0);
internal static Group _emptygroup = new Group(String.Empty, new int[0], 0, string.Empty);
internal int[] _caps;
internal int _capcount;
internal CaptureCollection _capcoll;
#if !SILVERLIGHT
[OptionalField]
#endif
internal string _name;
internal Group(String text, int[] caps, int capcount)
internal Group(String text, int[] caps, int capcount, string name)
: base(text, capcount == 0 ? 0 : caps[(capcount - 1) * 2],
capcount == 0 ? 0 : caps[(capcount * 2) - 1]) {
_caps = caps;
_capcount = capcount;
_name = name;
}
/*
@@ -49,6 +55,17 @@ namespace System.Text.RegularExpressions {
}
}
/// <summary>
/// Provides the name of the group.
/// </summary>
public string Name
{
get
{
return _name;
}
}
/*
* The collection of all captures for this group
*/

View File

@@ -147,7 +147,8 @@ namespace System.Text.RegularExpressions {
if (_groups == null) {
_groups = new Group[_match._matchcount.Length - 1];
for (int i = 0; i < _groups.Length; i++) {
_groups[i] = new Group(_match._text, _match._matches[i + 1], _match._matchcount[i + 1]);
string groupname = _match._regex.GroupNameFromNumber(i + 1);
_groups[i] = new Group(_match._text, _match._matches[i + 1], _match._matchcount[i + 1], groupname);
}
}

View File

@@ -77,7 +77,7 @@ namespace System.Text.RegularExpressions {
*/
internal Match(Regex regex, int capcount, String text, int begpos, int len, int startpos)
: base(text, new int[2], 0) {
: base(text, new int[2], 0, "0") {
_regex = regex;
_matchcount = new int[capcount];