You've already forked linux-packaging-mono
Imported Upstream version 5.0.0.42
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
parent
1190d13a04
commit
6bdd276d05
86
external/corefx/src/System.Text.RegularExpressions/System.Text.RegularExpressions.sln
vendored
Normal file
86
external/corefx/src/System.Text.RegularExpressions/System.Text.RegularExpressions.sln
vendored
Normal file
@@ -0,0 +1,86 @@
|
||||

|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Text.RegularExpressions.Tests", "tests\System.Text.RegularExpressions.Tests.csproj", "{94B106C2-D574-4392-80AB-3EE308A078DF}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD} = {BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Text.RegularExpressions", "src\System.Text.RegularExpressions.csproj", "{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{C5A39CF5-01CB-4CD8-96A6-7D6E95EA5CCC}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
..\.nuget\packages.Windows_NT.config = ..\.nuget\packages.Windows_NT.config
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
DebugNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU = DebugNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU
|
||||
ReleaseNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU = ReleaseNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU
|
||||
DebugNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU = DebugNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU
|
||||
ReleaseNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU = ReleaseNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU
|
||||
DebugNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU = DebugNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU
|
||||
ReleaseNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU = ReleaseNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU
|
||||
DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU = DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU
|
||||
ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU = ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU
|
||||
DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU = DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU
|
||||
ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU = ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU
|
||||
DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU = DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU
|
||||
ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU = ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{94B106C2-D574-4392-80AB-3EE308A078DF}.DebugNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{94B106C2-D574-4392-80AB-3EE308A078DF}.DebugNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{94B106C2-D574-4392-80AB-3EE308A078DF}.ReleaseNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{94B106C2-D574-4392-80AB-3EE308A078DF}.ReleaseNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{94B106C2-D574-4392-80AB-3EE308A078DF}.DebugNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{94B106C2-D574-4392-80AB-3EE308A078DF}.DebugNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{94B106C2-D574-4392-80AB-3EE308A078DF}.ReleaseNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{94B106C2-D574-4392-80AB-3EE308A078DF}.ReleaseNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{94B106C2-D574-4392-80AB-3EE308A078DF}.DebugNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{94B106C2-D574-4392-80AB-3EE308A078DF}.DebugNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{94B106C2-D574-4392-80AB-3EE308A078DF}.ReleaseNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{94B106C2-D574-4392-80AB-3EE308A078DF}.ReleaseNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{94B106C2-D574-4392-80AB-3EE308A078DF}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{94B106C2-D574-4392-80AB-3EE308A078DF}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{94B106C2-D574-4392-80AB-3EE308A078DF}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{94B106C2-D574-4392-80AB-3EE308A078DF}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{94B106C2-D574-4392-80AB-3EE308A078DF}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{94B106C2-D574-4392-80AB-3EE308A078DF}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{94B106C2-D574-4392-80AB-3EE308A078DF}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{94B106C2-D574-4392-80AB-3EE308A078DF}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{94B106C2-D574-4392-80AB-3EE308A078DF}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{94B106C2-D574-4392-80AB-3EE308A078DF}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{94B106C2-D574-4392-80AB-3EE308A078DF}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{94B106C2-D574-4392-80AB-3EE308A078DF}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.DebugNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = net461-Windows_NT-Debug|Any CPU
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.DebugNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.Build.0 = net461-Windows_NT-Debug|Any CPU
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.ReleaseNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = net461-Windows_NT-Release|Any CPU
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.ReleaseNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.Build.0 = net461-Windows_NT-Release|Any CPU
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.DebugNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = net461-Windows_NT-Debug|Any CPU
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.DebugNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.Build.0 = net461-Windows_NT-Debug|Any CPU
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.ReleaseNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = net461-Windows_NT-Release|Any CPU
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.ReleaseNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.Build.0 = net461-Windows_NT-Release|Any CPU
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.DebugNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = net461-Windows_NT-Debug|Any CPU
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.DebugNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.Build.0 = net461-Windows_NT-Debug|Any CPU
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.ReleaseNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.ActiveCfg = net461-Windows_NT-Release|Any CPU
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.ReleaseNETCoreAppnet461-Windows_NTnetcoreapp|AnyCPU.Build.0 = net461-Windows_NT-Release|Any CPU
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Debug|Any CPU
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.DebugNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Debug|Any CPU
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.ActiveCfg = netcoreapp-Release|Any CPU
|
||||
{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}.ReleaseNETCoreAppnetcoreappnetcoreapp|AnyCPU.Build.0 = netcoreapp-Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
8
external/corefx/src/System.Text.RegularExpressions/dir.props
vendored
Normal file
8
external/corefx/src/System.Text.RegularExpressions/dir.props
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\dir.props" />
|
||||
<PropertyGroup>
|
||||
<AssemblyVersion>4.2.0.0</AssemblyVersion>
|
||||
<IsNETCoreApp>true</IsNETCoreApp>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
9
external/corefx/src/System.Text.RegularExpressions/ref/Configurations.props
vendored
Normal file
9
external/corefx/src/System.Text.RegularExpressions/ref/Configurations.props
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<BuildConfigurations>
|
||||
netcoreapp;
|
||||
uap;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
11
external/corefx/src/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.builds
vendored
Normal file
11
external/corefx/src/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.builds
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<ItemGroup>
|
||||
<Project Include="System.Text.RegularExpressions.csproj" />
|
||||
<Project Include="System.Text.RegularExpressions.csproj">
|
||||
<TargetGroup>netstandard</TargetGroup>
|
||||
</Project>
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
|
||||
</Project>
|
||||
209
external/corefx/src/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.cs
vendored
Normal file
209
external/corefx/src/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.cs
vendored
Normal file
@@ -0,0 +1,209 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
// ------------------------------------------------------------------------------
|
||||
// Changes to this file must follow the http://aka.ms/api-review process.
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace System.Text.RegularExpressions
|
||||
{
|
||||
public partial class Capture
|
||||
{
|
||||
internal Capture() { }
|
||||
public int Index { get { throw null; } }
|
||||
public int Length { get { throw null; } }
|
||||
public string Value { get { throw null; } }
|
||||
public override string ToString() { throw null; }
|
||||
}
|
||||
public partial class CaptureCollection : System.Collections.ICollection, System.Collections.IEnumerable
|
||||
{
|
||||
internal CaptureCollection() { }
|
||||
public int Count { get { throw null; } }
|
||||
public bool IsReadOnly { get { throw null; } }
|
||||
public bool IsSynchronized { get { throw null; } }
|
||||
public System.Text.RegularExpressions.Capture this[int i] { get { throw null; } }
|
||||
public object SyncRoot { get { throw null; } }
|
||||
public void CopyTo(System.Array array, int arrayIndex) { }
|
||||
public System.Collections.IEnumerator GetEnumerator() { throw null; }
|
||||
}
|
||||
public partial class Group : System.Text.RegularExpressions.Capture
|
||||
{
|
||||
internal Group() { }
|
||||
public System.Text.RegularExpressions.CaptureCollection Captures { get { throw null; } }
|
||||
public bool Success { get { throw null; } }
|
||||
public static System.Text.RegularExpressions.Group Synchronized(System.Text.RegularExpressions.Group inner) { throw null; }
|
||||
}
|
||||
public partial class GroupCollection : System.Collections.ICollection, System.Collections.IEnumerable
|
||||
{
|
||||
internal GroupCollection() { }
|
||||
public int Count { get { throw null; } }
|
||||
public bool IsReadOnly { get { throw null; } }
|
||||
public bool IsSynchronized { get { throw null; } }
|
||||
public System.Text.RegularExpressions.Group this[int groupnum] { get { throw null; } }
|
||||
public System.Text.RegularExpressions.Group this[string groupname] { get { throw null; } }
|
||||
public object SyncRoot { get { throw null; } }
|
||||
public void CopyTo(System.Array array, int arrayIndex) { }
|
||||
public System.Collections.IEnumerator GetEnumerator() { throw null; }
|
||||
}
|
||||
public partial class Match : System.Text.RegularExpressions.Group
|
||||
{
|
||||
internal Match() { }
|
||||
public static System.Text.RegularExpressions.Match Empty { get { throw null; } }
|
||||
public virtual System.Text.RegularExpressions.GroupCollection Groups { get { throw null; } }
|
||||
public System.Text.RegularExpressions.Match NextMatch() { throw null; }
|
||||
public virtual string Result(string replacement) { throw null; }
|
||||
public static System.Text.RegularExpressions.Match Synchronized(System.Text.RegularExpressions.Match inner) { throw null; }
|
||||
}
|
||||
public partial class MatchCollection : System.Collections.ICollection, System.Collections.IEnumerable
|
||||
{
|
||||
internal MatchCollection() { }
|
||||
public int Count { get { throw null; } }
|
||||
public bool IsReadOnly { get { throw null; } }
|
||||
public bool IsSynchronized { get { throw null; } }
|
||||
public virtual System.Text.RegularExpressions.Match this[int i] { get { throw null; } }
|
||||
public object SyncRoot { get { throw null; } }
|
||||
public void CopyTo(System.Array array, int arrayIndex) { }
|
||||
public System.Collections.IEnumerator GetEnumerator() { throw null; }
|
||||
}
|
||||
public delegate string MatchEvaluator(System.Text.RegularExpressions.Match match);
|
||||
public partial class Regex : System.Runtime.Serialization.ISerializable
|
||||
{
|
||||
protected internal System.Collections.Hashtable caps;
|
||||
protected internal System.Collections.Hashtable capnames;
|
||||
protected internal int capsize;
|
||||
protected internal string[] capslist;
|
||||
protected internal System.Text.RegularExpressions.RegexRunnerFactory factory;
|
||||
public static readonly System.TimeSpan InfiniteMatchTimeout;
|
||||
protected internal System.TimeSpan internalMatchTimeout;
|
||||
protected internal string pattern;
|
||||
protected internal System.Text.RegularExpressions.RegexOptions roptions;
|
||||
protected Regex() { }
|
||||
protected Regex(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
|
||||
public Regex(string pattern) { }
|
||||
public Regex(string pattern, System.Text.RegularExpressions.RegexOptions options) { }
|
||||
public Regex(string pattern, System.Text.RegularExpressions.RegexOptions options, System.TimeSpan matchTimeout) { }
|
||||
public static int CacheSize { get { throw null; } set { } }
|
||||
public System.TimeSpan MatchTimeout { get { throw null; } }
|
||||
public System.Text.RegularExpressions.RegexOptions Options { get { throw null; } }
|
||||
public bool RightToLeft { get { throw null; } }
|
||||
public static string Escape(string str) { throw null; }
|
||||
public string[] GetGroupNames() { throw null; }
|
||||
public int[] GetGroupNumbers() { throw null; }
|
||||
public string GroupNameFromNumber(int i) { throw null; }
|
||||
public int GroupNumberFromName(string name) { throw null; }
|
||||
protected void InitializeReferences() { }
|
||||
public bool IsMatch(string input) { throw null; }
|
||||
public bool IsMatch(string input, int startat) { throw null; }
|
||||
public static bool IsMatch(string input, string pattern) { throw null; }
|
||||
public static bool IsMatch(string input, string pattern, System.Text.RegularExpressions.RegexOptions options) { throw null; }
|
||||
public static bool IsMatch(string input, string pattern, System.Text.RegularExpressions.RegexOptions options, System.TimeSpan matchTimeout) { throw null; }
|
||||
public System.Text.RegularExpressions.Match Match(string input) { throw null; }
|
||||
public System.Text.RegularExpressions.Match Match(string input, int startat) { throw null; }
|
||||
public System.Text.RegularExpressions.Match Match(string input, int beginning, int length) { throw null; }
|
||||
public static System.Text.RegularExpressions.Match Match(string input, string pattern) { throw null; }
|
||||
public static System.Text.RegularExpressions.Match Match(string input, string pattern, System.Text.RegularExpressions.RegexOptions options) { throw null; }
|
||||
public static System.Text.RegularExpressions.Match Match(string input, string pattern, System.Text.RegularExpressions.RegexOptions options, System.TimeSpan matchTimeout) { throw null; }
|
||||
public System.Text.RegularExpressions.MatchCollection Matches(string input) { throw null; }
|
||||
public System.Text.RegularExpressions.MatchCollection Matches(string input, int startat) { throw null; }
|
||||
public static System.Text.RegularExpressions.MatchCollection Matches(string input, string pattern) { throw null; }
|
||||
public static System.Text.RegularExpressions.MatchCollection Matches(string input, string pattern, System.Text.RegularExpressions.RegexOptions options) { throw null; }
|
||||
public static System.Text.RegularExpressions.MatchCollection Matches(string input, string pattern, System.Text.RegularExpressions.RegexOptions options, System.TimeSpan matchTimeout) { throw null; }
|
||||
public string Replace(string input, string replacement) { throw null; }
|
||||
public string Replace(string input, string replacement, int count) { throw null; }
|
||||
public string Replace(string input, string replacement, int count, int startat) { throw null; }
|
||||
public static string Replace(string input, string pattern, string replacement) { throw null; }
|
||||
public static string Replace(string input, string pattern, string replacement, System.Text.RegularExpressions.RegexOptions options) { throw null; }
|
||||
public static string Replace(string input, string pattern, string replacement, System.Text.RegularExpressions.RegexOptions options, System.TimeSpan matchTimeout) { throw null; }
|
||||
public static string Replace(string input, string pattern, System.Text.RegularExpressions.MatchEvaluator evaluator) { throw null; }
|
||||
public static string Replace(string input, string pattern, System.Text.RegularExpressions.MatchEvaluator evaluator, System.Text.RegularExpressions.RegexOptions options) { throw null; }
|
||||
public static string Replace(string input, string pattern, System.Text.RegularExpressions.MatchEvaluator evaluator, System.Text.RegularExpressions.RegexOptions options, System.TimeSpan matchTimeout) { throw null; }
|
||||
public string Replace(string input, System.Text.RegularExpressions.MatchEvaluator evaluator) { throw null; }
|
||||
public string Replace(string input, System.Text.RegularExpressions.MatchEvaluator evaluator, int count) { throw null; }
|
||||
public string Replace(string input, System.Text.RegularExpressions.MatchEvaluator evaluator, int count, int startat) { throw null; }
|
||||
public string[] Split(string input) { throw null; }
|
||||
public string[] Split(string input, int count) { throw null; }
|
||||
public string[] Split(string input, int count, int startat) { throw null; }
|
||||
public static string[] Split(string input, string pattern) { throw null; }
|
||||
public static string[] Split(string input, string pattern, System.Text.RegularExpressions.RegexOptions options) { throw null; }
|
||||
public static string[] Split(string input, string pattern, System.Text.RegularExpressions.RegexOptions options, System.TimeSpan matchTimeout) { throw null; }
|
||||
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo si, System.Runtime.Serialization.StreamingContext context) { }
|
||||
public override string ToString() { throw null; }
|
||||
public static string Unescape(string str) { throw null; }
|
||||
protected bool UseOptionC() { throw null; }
|
||||
protected bool UseOptionR() { throw null; }
|
||||
protected internal static void ValidateMatchTimeout(System.TimeSpan matchTimeout) { }
|
||||
}
|
||||
public partial class RegexMatchTimeoutException : System.TimeoutException, System.Runtime.Serialization.ISerializable
|
||||
{
|
||||
public RegexMatchTimeoutException() { }
|
||||
protected RegexMatchTimeoutException(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
|
||||
public RegexMatchTimeoutException(string message) { }
|
||||
public RegexMatchTimeoutException(string message, System.Exception inner) { }
|
||||
public RegexMatchTimeoutException(string regexInput, string regexPattern, System.TimeSpan matchTimeout) { }
|
||||
public string Input { get { throw null; } }
|
||||
public System.TimeSpan MatchTimeout { get { throw null; } }
|
||||
public string Pattern { get { throw null; } }
|
||||
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo si, System.Runtime.Serialization.StreamingContext context) { }
|
||||
}
|
||||
[System.FlagsAttribute]
|
||||
public enum RegexOptions
|
||||
{
|
||||
Compiled = 8,
|
||||
CultureInvariant = 512,
|
||||
ECMAScript = 256,
|
||||
ExplicitCapture = 4,
|
||||
IgnoreCase = 1,
|
||||
IgnorePatternWhitespace = 32,
|
||||
Multiline = 2,
|
||||
None = 0,
|
||||
RightToLeft = 64,
|
||||
Singleline = 16,
|
||||
}
|
||||
public abstract partial class RegexRunner
|
||||
{
|
||||
protected internal int[] runcrawl;
|
||||
protected internal int runcrawlpos;
|
||||
protected internal System.Text.RegularExpressions.Match runmatch;
|
||||
protected internal System.Text.RegularExpressions.Regex runregex;
|
||||
protected internal int[] runstack;
|
||||
protected internal int runstackpos;
|
||||
protected internal string runtext;
|
||||
protected internal int runtextbeg;
|
||||
protected internal int runtextend;
|
||||
protected internal int runtextpos;
|
||||
protected internal int runtextstart;
|
||||
protected internal int[] runtrack;
|
||||
protected internal int runtrackcount;
|
||||
protected internal int runtrackpos;
|
||||
protected internal RegexRunner() { }
|
||||
protected void Capture(int capnum, int start, int end) { }
|
||||
protected static bool CharInClass(char ch, string charClass) { throw null; }
|
||||
protected static bool CharInSet(char ch, string @set, string category) { throw null; }
|
||||
protected void CheckTimeout() { }
|
||||
protected void Crawl(int i) { }
|
||||
protected int Crawlpos() { throw null; }
|
||||
protected void DoubleCrawl() { }
|
||||
protected void DoubleStack() { }
|
||||
protected void DoubleTrack() { }
|
||||
protected void EnsureStorage() { }
|
||||
protected abstract bool FindFirstChar();
|
||||
protected abstract void Go();
|
||||
protected abstract void InitTrackCount();
|
||||
protected bool IsBoundary(int index, int startpos, int endpos) { throw null; }
|
||||
protected bool IsECMABoundary(int index, int startpos, int endpos) { throw null; }
|
||||
protected bool IsMatched(int cap) { throw null; }
|
||||
protected int MatchIndex(int cap) { throw null; }
|
||||
protected int MatchLength(int cap) { throw null; }
|
||||
protected int Popcrawl() { throw null; }
|
||||
protected internal System.Text.RegularExpressions.Match Scan(System.Text.RegularExpressions.Regex regex, string text, int textbeg, int textend, int textstart, int prevlen, bool quick) { throw null; }
|
||||
protected internal System.Text.RegularExpressions.Match Scan(System.Text.RegularExpressions.Regex regex, string text, int textbeg, int textend, int textstart, int prevlen, bool quick, System.TimeSpan timeout) { throw null; }
|
||||
protected void TransferCapture(int capnum, int uncapnum, int start, int end) { }
|
||||
protected void Uncapture() { }
|
||||
}
|
||||
public abstract partial class RegexRunnerFactory
|
||||
{
|
||||
protected RegexRunnerFactory() { }
|
||||
protected internal abstract System.Text.RegularExpressions.RegexRunner CreateInstance();
|
||||
}
|
||||
}
|
||||
18
external/corefx/src/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.csproj
vendored
Normal file
18
external/corefx/src/System.Text.RegularExpressions/ref/System.Text.RegularExpressions.csproj
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'uap-Release|AnyCPU'" />
|
||||
<ItemGroup>
|
||||
<Compile Include="System.Text.RegularExpressions.cs" />
|
||||
<Compile Include="System.Text.RegularExpressions.netcoreapp.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" />
|
||||
<ProjectReference Include="..\..\System.Runtime.Extensions\ref\System.Runtime.Extensions.csproj" />
|
||||
<ProjectReference Include="..\..\System.Collections.NonGeneric\ref\System.Collections.NonGeneric.csproj" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,88 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
// ------------------------------------------------------------------------------
|
||||
// Changes to this file must follow the http://aka.ms/api-review process.
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace System.Text.RegularExpressions
|
||||
{
|
||||
public partial class Group
|
||||
{
|
||||
public string Name { get { throw null; } }
|
||||
}
|
||||
public partial class Regex
|
||||
{
|
||||
[System.CLSCompliant(false)]
|
||||
protected System.Collections.IDictionary Caps { get { throw null; } set { } }
|
||||
[System.CLSCompliant(false)]
|
||||
protected System.Collections.IDictionary CapNames { get { throw null; } set { } }
|
||||
}
|
||||
public partial class CaptureCollection : System.Collections.Generic.ICollection<System.Text.RegularExpressions.Capture>, System.Collections.Generic.IEnumerable<System.Text.RegularExpressions.Capture>, System.Collections.Generic.IList<System.Text.RegularExpressions.Capture>, System.Collections.Generic.IReadOnlyCollection<System.Text.RegularExpressions.Capture>, System.Collections.Generic.IReadOnlyList<System.Text.RegularExpressions.Capture>, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList
|
||||
{
|
||||
public void CopyTo(System.Text.RegularExpressions.Capture[] array, int arrayIndex) { }
|
||||
System.Collections.Generic.IEnumerator<System.Text.RegularExpressions.Capture> System.Collections.Generic.IEnumerable<System.Text.RegularExpressions.Capture>.GetEnumerator() { throw null; }
|
||||
int System.Collections.Generic.IList<System.Text.RegularExpressions.Capture>.IndexOf(System.Text.RegularExpressions.Capture item) { throw null; }
|
||||
void System.Collections.Generic.IList<System.Text.RegularExpressions.Capture>.Insert(int index, System.Text.RegularExpressions.Capture item) { }
|
||||
void System.Collections.Generic.IList<System.Text.RegularExpressions.Capture>.RemoveAt(int index) { }
|
||||
System.Text.RegularExpressions.Capture System.Collections.Generic.IList<System.Text.RegularExpressions.Capture>.this[int index] { get { throw null; } set { } }
|
||||
void System.Collections.Generic.ICollection<System.Text.RegularExpressions.Capture>.Add(System.Text.RegularExpressions.Capture item) { }
|
||||
void System.Collections.Generic.ICollection<System.Text.RegularExpressions.Capture>.Clear() { }
|
||||
bool System.Collections.Generic.ICollection<System.Text.RegularExpressions.Capture>.Contains(System.Text.RegularExpressions.Capture item) { throw null; }
|
||||
bool System.Collections.Generic.ICollection<System.Text.RegularExpressions.Capture>.Remove(System.Text.RegularExpressions.Capture item) { throw null; }
|
||||
int System.Collections.IList.Add(object value) { throw null; }
|
||||
void System.Collections.IList.Clear() { }
|
||||
bool System.Collections.IList.Contains(object value) { throw null; }
|
||||
int System.Collections.IList.IndexOf(object value) { throw null; }
|
||||
void System.Collections.IList.Insert(int index, object value) { }
|
||||
bool System.Collections.IList.IsFixedSize { get { throw null; } }
|
||||
void System.Collections.IList.Remove(object value) { }
|
||||
void System.Collections.IList.RemoveAt(int index) { }
|
||||
object System.Collections.IList.this[int index] { get { throw null; } set { } }
|
||||
}
|
||||
public partial class GroupCollection : System.Collections.Generic.ICollection<System.Text.RegularExpressions.Group>, System.Collections.Generic.IEnumerable<System.Text.RegularExpressions.Group>, System.Collections.Generic.IList<System.Text.RegularExpressions.Group>, System.Collections.Generic.IReadOnlyCollection<System.Text.RegularExpressions.Group>, System.Collections.Generic.IReadOnlyList<System.Text.RegularExpressions.Group>, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList
|
||||
{
|
||||
public void CopyTo(System.Text.RegularExpressions.Group[] array, int arrayIndex) { }
|
||||
System.Collections.Generic.IEnumerator<System.Text.RegularExpressions.Group> System.Collections.Generic.IEnumerable<System.Text.RegularExpressions.Group>.GetEnumerator() { throw null; }
|
||||
int System.Collections.Generic.IList<System.Text.RegularExpressions.Group>.IndexOf(System.Text.RegularExpressions.Group item) { throw null; }
|
||||
void System.Collections.Generic.IList<System.Text.RegularExpressions.Group>.Insert(int index, System.Text.RegularExpressions.Group item) { }
|
||||
void System.Collections.Generic.IList<System.Text.RegularExpressions.Group>.RemoveAt(int index) { }
|
||||
System.Text.RegularExpressions.Group System.Collections.Generic.IList<System.Text.RegularExpressions.Group>.this[int index] { get { throw null; } set { } }
|
||||
void System.Collections.Generic.ICollection<System.Text.RegularExpressions.Group>.Add(System.Text.RegularExpressions.Group item) { }
|
||||
void System.Collections.Generic.ICollection<System.Text.RegularExpressions.Group>.Clear() { }
|
||||
bool System.Collections.Generic.ICollection<System.Text.RegularExpressions.Group>.Contains(System.Text.RegularExpressions.Group item) { throw null; }
|
||||
bool System.Collections.Generic.ICollection<System.Text.RegularExpressions.Group>.Remove(System.Text.RegularExpressions.Group item) { throw null; }
|
||||
int System.Collections.IList.Add(object value) { throw null; }
|
||||
void System.Collections.IList.Clear() { }
|
||||
bool System.Collections.IList.Contains(object value) { throw null; }
|
||||
int System.Collections.IList.IndexOf(object value) { throw null; }
|
||||
void System.Collections.IList.Insert(int index, object value) { }
|
||||
bool System.Collections.IList.IsFixedSize { get { throw null; } }
|
||||
void System.Collections.IList.Remove(object value) { }
|
||||
void System.Collections.IList.RemoveAt(int index) { }
|
||||
object System.Collections.IList.this[int index] { get { throw null; } set { } }
|
||||
}
|
||||
public partial class MatchCollection : System.Collections.Generic.ICollection<System.Text.RegularExpressions.Match>, System.Collections.Generic.IEnumerable<System.Text.RegularExpressions.Match>, System.Collections.Generic.IList<System.Text.RegularExpressions.Match>, System.Collections.Generic.IReadOnlyCollection<System.Text.RegularExpressions.Match>, System.Collections.Generic.IReadOnlyList<System.Text.RegularExpressions.Match>, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList
|
||||
{
|
||||
public void CopyTo(System.Text.RegularExpressions.Match[] array, int arrayIndex) { }
|
||||
System.Collections.Generic.IEnumerator<System.Text.RegularExpressions.Match> System.Collections.Generic.IEnumerable<System.Text.RegularExpressions.Match>.GetEnumerator() { throw null; }
|
||||
int System.Collections.Generic.IList<System.Text.RegularExpressions.Match>.IndexOf(System.Text.RegularExpressions.Match item) { throw null; }
|
||||
void System.Collections.Generic.IList<System.Text.RegularExpressions.Match>.Insert(int index, System.Text.RegularExpressions.Match item) { }
|
||||
void System.Collections.Generic.IList<System.Text.RegularExpressions.Match>.RemoveAt(int index) { }
|
||||
System.Text.RegularExpressions.Match System.Collections.Generic.IList<System.Text.RegularExpressions.Match>.this[int index] { get { throw null; } set { } }
|
||||
void System.Collections.Generic.ICollection<System.Text.RegularExpressions.Match>.Add(System.Text.RegularExpressions.Match item) { }
|
||||
void System.Collections.Generic.ICollection<System.Text.RegularExpressions.Match>.Clear() { }
|
||||
bool System.Collections.Generic.ICollection<System.Text.RegularExpressions.Match>.Contains(System.Text.RegularExpressions.Match item) { throw null; }
|
||||
bool System.Collections.Generic.ICollection<System.Text.RegularExpressions.Match>.Remove(System.Text.RegularExpressions.Match item) { throw null; }
|
||||
int System.Collections.IList.Add(object value) { throw null; }
|
||||
void System.Collections.IList.Clear() { }
|
||||
bool System.Collections.IList.Contains(object value) { throw null; }
|
||||
int System.Collections.IList.IndexOf(object value) { throw null; }
|
||||
void System.Collections.IList.Insert(int index, object value) { }
|
||||
bool System.Collections.IList.IsFixedSize { get { throw null; } }
|
||||
void System.Collections.IList.Remove(object value) { }
|
||||
void System.Collections.IList.RemoveAt(int index) { }
|
||||
object System.Collections.IList.this[int index] { get { throw null; } set { } }
|
||||
}
|
||||
}
|
||||
9
external/corefx/src/System.Text.RegularExpressions/src/Configurations.props
vendored
Normal file
9
external/corefx/src/System.Text.RegularExpressions/src/Configurations.props
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<BuildConfigurations>
|
||||
net461-Windows_NT;
|
||||
netcoreapp;
|
||||
</BuildConfigurations>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
255
external/corefx/src/System.Text.RegularExpressions/src/Resources/Strings.resx
vendored
Normal file
255
external/corefx/src/System.Text.RegularExpressions/src/Resources/Strings.resx
vendored
Normal file
@@ -0,0 +1,255 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="AlternationCantCapture" xml:space="preserve">
|
||||
<value>Alternation conditions do not capture and cannot be named.</value>
|
||||
</data>
|
||||
<data name="AlternationCantHaveComment" xml:space="preserve">
|
||||
<value>Alternation conditions cannot be comments.</value>
|
||||
</data>
|
||||
<data name="Arg_ArrayPlusOffTooSmall" xml:space="preserve">
|
||||
<value>Destination array is not long enough to copy all the items in the collection. Check array index and length.</value>
|
||||
</data>
|
||||
<data name="BadClassInCharRange" xml:space="preserve">
|
||||
<value>Cannot include class \\{0} in character range.</value>
|
||||
</data>
|
||||
<data name="BeginIndexNotNegative" xml:space="preserve">
|
||||
<value>Start index cannot be less than 0 or greater than input length.</value>
|
||||
</data>
|
||||
<data name="CaptureGroupOutOfRange" xml:space="preserve">
|
||||
<value>Capture group numbers must be less than or equal to Int32.MaxValue.</value>
|
||||
</data>
|
||||
<data name="CapnumNotZero" xml:space="preserve">
|
||||
<value>Capture number cannot be zero.</value>
|
||||
</data>
|
||||
<data name="CountTooSmall" xml:space="preserve">
|
||||
<value>Count cannot be less than -1.</value>
|
||||
</data>
|
||||
<data name="EnumNotStarted" xml:space="preserve">
|
||||
<value>Enumeration has either not started or has already finished.</value>
|
||||
</data>
|
||||
<data name="IllegalCondition" xml:space="preserve">
|
||||
<value>Illegal conditional (?(...)) expression.</value>
|
||||
</data>
|
||||
<data name="IllegalEndEscape" xml:space="preserve">
|
||||
<value>Illegal \\ at end of pattern.</value>
|
||||
</data>
|
||||
<data name="IllegalRange" xml:space="preserve">
|
||||
<value>Illegal {x,y} with x > y.</value>
|
||||
</data>
|
||||
<data name="IncompleteSlashP" xml:space="preserve">
|
||||
<value>Incomplete \\p{X} character escape.</value>
|
||||
</data>
|
||||
<data name="InternalError" xml:space="preserve">
|
||||
<value>Internal error in ScanRegex.</value>
|
||||
</data>
|
||||
<data name="InvalidGroupName" xml:space="preserve">
|
||||
<value>Invalid group name: Group names must begin with a word character.</value>
|
||||
</data>
|
||||
<data name="LengthNotNegative" xml:space="preserve">
|
||||
<value>Length cannot be less than 0 or exceed input length.</value>
|
||||
</data>
|
||||
<data name="MalformedNameRef" xml:space="preserve">
|
||||
<value>Malformed \\k<...> named back reference.</value>
|
||||
</data>
|
||||
<data name="MalformedReference" xml:space="preserve">
|
||||
<value>(?({0}) ) malformed.</value>
|
||||
</data>
|
||||
<data name="MalformedSlashP" xml:space="preserve">
|
||||
<value>Malformed \\p{X} character escape.</value>
|
||||
</data>
|
||||
<data name="MakeException" xml:space="preserve">
|
||||
<value>parsing '{0}' - {1}</value>
|
||||
</data>
|
||||
<data name="MissingControl" xml:space="preserve">
|
||||
<value>Missing control character.</value>
|
||||
</data>
|
||||
<data name="NestedQuantify" xml:space="preserve">
|
||||
<value>Nested quantifier {0}.</value>
|
||||
</data>
|
||||
<data name="NoResultOnFailed" xml:space="preserve">
|
||||
<value>Result cannot be called on a failed Match.</value>
|
||||
</data>
|
||||
<data name="NotEnoughParens" xml:space="preserve">
|
||||
<value>Not enough )'s.</value>
|
||||
</data>
|
||||
<data name="NotSupported_ReadOnlyCollection" xml:space="preserve">
|
||||
<value>Collection is read-only.</value>
|
||||
</data>
|
||||
<data name="OnlyAllowedOnce" xml:space="preserve">
|
||||
<value>This operation is only allowed once per object.</value>
|
||||
</data>
|
||||
<data name="QuantifyAfterNothing" xml:space="preserve">
|
||||
<value>Quantifier {x,y} following nothing.</value>
|
||||
</data>
|
||||
<data name="RegexMatchTimeoutException_Occurred" xml:space="preserve">
|
||||
<value>The RegEx engine has timed out while trying to match a pattern to an input string. This can occur for many reasons, including very large inputs or excessive backtracking caused by nested quantifiers, back-references and other factors.</value>
|
||||
</data>
|
||||
<data name="ReplacementError" xml:space="preserve">
|
||||
<value>Replacement pattern error.</value>
|
||||
</data>
|
||||
<data name="ReversedCharRange" xml:space="preserve">
|
||||
<value>[x-y] range in reverse order.</value>
|
||||
</data>
|
||||
<data name="SubtractionMustBeLast" xml:space="preserve">
|
||||
<value>A subtraction must be the last element in a character class.</value>
|
||||
</data>
|
||||
<data name="TooFewHex" xml:space="preserve">
|
||||
<value>Insufficient hexadecimal digits.</value>
|
||||
</data>
|
||||
<data name="TooManyAlternates" xml:space="preserve">
|
||||
<value>Too many | in (?()|).</value>
|
||||
</data>
|
||||
<data name="TooManyParens" xml:space="preserve">
|
||||
<value>Too many )'s.</value>
|
||||
</data>
|
||||
<data name="UndefinedBackref" xml:space="preserve">
|
||||
<value>Reference to undefined group number {0}.</value>
|
||||
</data>
|
||||
<data name="UndefinedNameRef" xml:space="preserve">
|
||||
<value>Reference to undefined group name {0}.</value>
|
||||
</data>
|
||||
<data name="UndefinedReference" xml:space="preserve">
|
||||
<value>(?({0}) ) reference to undefined group.</value>
|
||||
</data>
|
||||
<data name="UnexpectedOpcode" xml:space="preserve">
|
||||
<value>Unexpected opcode in regular expression generation: {0}.</value>
|
||||
</data>
|
||||
<data name="UnimplementedState" xml:space="preserve">
|
||||
<value>Unimplemented state.</value>
|
||||
</data>
|
||||
<data name="UnknownProperty" xml:space="preserve">
|
||||
<value>Unknown property '{0}'.</value>
|
||||
</data>
|
||||
<data name="UnrecognizedControl" xml:space="preserve">
|
||||
<value>Unrecognized control character.</value>
|
||||
</data>
|
||||
<data name="UnrecognizedEscape" xml:space="preserve">
|
||||
<value>Unrecognized escape sequence \\{0}.</value>
|
||||
</data>
|
||||
<data name="UnrecognizedGrouping" xml:space="preserve">
|
||||
<value>Unrecognized grouping construct.</value>
|
||||
</data>
|
||||
<data name="UnterminatedBracket" xml:space="preserve">
|
||||
<value>Unterminated [] set.</value>
|
||||
</data>
|
||||
<data name="UnterminatedComment" xml:space="preserve">
|
||||
<value>Unterminated (?#...) comment.</value>
|
||||
</data>
|
||||
</root>
|
||||
66
external/corefx/src/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj
vendored
Normal file
66
external/corefx/src/System.Text.RegularExpressions/src/System.Text.RegularExpressions.csproj
vendored
Normal file
@@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{BE28323E-327A-4E0F-B7F9-16AB7EAB59DD}</ProjectGuid>
|
||||
<AssemblyName>System.Text.RegularExpressions</AssemblyName>
|
||||
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'net461'">true</IsPartialFacadeAssembly>
|
||||
<ResourcesSourceOutputDirectory Condition="'$(TargetGroup)' == 'net461'">None</ResourcesSourceOutputDirectory>
|
||||
</PropertyGroup>
|
||||
<!-- Default configurations to help VS understand the configurations -->
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='net461-Windows_NT-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='net461-Windows_NT-Release|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Release|AnyCPU'" />
|
||||
<ItemGroup Condition="'$(TargetGroup)' == 'net461'">
|
||||
<ContractProject Include="..\ref\System.Text.RegularExpressions.csproj">
|
||||
<TargetGroup>netcoreapp</TargetGroup>
|
||||
</ContractProject>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetGroup)' == 'netcoreapp'">
|
||||
<Compile Include="System\Text\RegularExpressions\HashtableExtensions.cs" />
|
||||
<Compile Include="System\Text\RegularExpressions\Regex.cs" />
|
||||
<Compile Include="System\Text\RegularExpressions\RegexBoyerMoore.cs" />
|
||||
<Compile Include="System\Text\RegularExpressions\RegexCapture.cs" />
|
||||
<Compile Include="System\Text\RegularExpressions\RegexCaptureCollection.cs" />
|
||||
<Compile Include="System\Text\RegularExpressions\RegexCharClass.cs" />
|
||||
<Compile Include="System\Text\RegularExpressions\RegexCode.cs" />
|
||||
<Compile Include="System\Text\RegularExpressions\RegexCollectionDebuggerProxy.cs" />
|
||||
<Compile Include="System\Text\RegularExpressions\RegexFCD.cs" />
|
||||
<Compile Include="System\Text\RegularExpressions\RegexGroup.cs" />
|
||||
<Compile Include="System\Text\RegularExpressions\RegexGroupCollection.cs" />
|
||||
<Compile Include="System\Text\RegularExpressions\RegexInterpreter.cs" />
|
||||
<Compile Include="System\Text\RegularExpressions\RegexMatch.cs" />
|
||||
<Compile Include="System\Text\RegularExpressions\RegexMatchCollection.cs" />
|
||||
<Compile Include="System\Text\RegularExpressions\RegexMatchTimeoutException.cs" />
|
||||
<Compile Include="System\Text\RegularExpressions\RegexNode.cs" />
|
||||
<Compile Include="System\Text\RegularExpressions\RegexOptions.cs" />
|
||||
<Compile Include="System\Text\RegularExpressions\RegexParser.cs" />
|
||||
<Compile Include="System\Text\RegularExpressions\RegexReplacement.cs" />
|
||||
<Compile Include="System\Text\RegularExpressions\RegexRunner.cs" />
|
||||
<Compile Include="System\Text\RegularExpressions\RegexTree.cs" />
|
||||
<Compile Include="System\Text\RegularExpressions\RegexWriter.cs" />
|
||||
<Compile Include="System\Text\RegularExpressions\RegexRunnerFactory.cs" />
|
||||
<!-- Common or Common-branched source files -->
|
||||
<Compile Include="$(CommonPath)\System\NotImplemented.cs">
|
||||
<Link>Common\System\NotImplemented.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="$(CommonPath)\System\IO\StringBuilderCache.cs">
|
||||
<Link>Common\System\IO\StringBuilderCache.cs</Link>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(TargetGroup)' == 'net461'">
|
||||
<TargetingPackReference Include="mscorlib" />
|
||||
<TargetingPackReference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Collections" />
|
||||
<Reference Include="System.Diagnostics.Debug" />
|
||||
<Reference Include="System.Diagnostics.Tools" />
|
||||
<Reference Include="System.Resources.ResourceManager" />
|
||||
<Reference Include="System.Runtime" />
|
||||
<Reference Include="System.Runtime.Extensions" />
|
||||
<Reference Include="System.Threading" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,22 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Collections;
|
||||
|
||||
namespace System.Text.RegularExpressions
|
||||
{
|
||||
internal static class HashtableExtensions
|
||||
{
|
||||
public static bool TryGetValue<T>(this Hashtable table, object key, out T value)
|
||||
{
|
||||
if (table.ContainsKey(key))
|
||||
{
|
||||
value = (T)table[key];
|
||||
return true;
|
||||
}
|
||||
value = default(T);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
1236
external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.cs
vendored
Normal file
1236
external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Regex.cs
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,410 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// The RegexBoyerMoore object precomputes the Boyer-Moore
|
||||
// tables for fast string scanning. These tables allow
|
||||
// you to scan for the first occurrence of a string within
|
||||
// a large body of text without examining every character.
|
||||
// The performance of the heuristic depends on the actual
|
||||
// string and the text being searched, but usually, the longer
|
||||
// the string that is being searched for, the fewer characters
|
||||
// need to be examined.
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
|
||||
namespace System.Text.RegularExpressions
|
||||
{
|
||||
internal sealed class RegexBoyerMoore
|
||||
{
|
||||
private readonly int[] _positive;
|
||||
private readonly int[] _negativeASCII;
|
||||
private readonly int[][] _negativeUnicode;
|
||||
private readonly string _pattern;
|
||||
private readonly int _lowASCII;
|
||||
private readonly int _highASCII;
|
||||
private readonly bool _rightToLeft;
|
||||
private readonly bool _caseInsensitive;
|
||||
private readonly CultureInfo _culture;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a Boyer-Moore state machine for searching for the string
|
||||
/// pattern. The string must not be zero-length.
|
||||
/// </summary>
|
||||
internal RegexBoyerMoore(string pattern, bool caseInsensitive, bool rightToLeft, CultureInfo culture)
|
||||
{
|
||||
// Sorry, you just can't use Boyer-Moore to find an empty pattern.
|
||||
// We're doing this for your own protection. (Really, for speed.)
|
||||
Debug.Assert(pattern.Length != 0, "RegexBoyerMoore called with an empty string. This is bad for perf");
|
||||
|
||||
int beforefirst;
|
||||
int last;
|
||||
int bump;
|
||||
int examine;
|
||||
int scan;
|
||||
int match;
|
||||
char ch;
|
||||
|
||||
// We do the ToLower character by character for consistency. With surrogate chars, doing
|
||||
// a ToLower on the entire string could actually change the surrogate pair. This is more correct
|
||||
// linguistically, but since Regex doesn't support surrogates, it's more important to be
|
||||
// consistent.
|
||||
if (caseInsensitive)
|
||||
{
|
||||
StringBuilder sb = StringBuilderCache.Acquire(pattern.Length);
|
||||
for (int i = 0; i < pattern.Length; i++)
|
||||
sb.Append(culture.TextInfo.ToLower(pattern[i]));
|
||||
pattern = StringBuilderCache.GetStringAndRelease(sb);
|
||||
}
|
||||
|
||||
_pattern = pattern;
|
||||
_rightToLeft = rightToLeft;
|
||||
_caseInsensitive = caseInsensitive;
|
||||
_culture = culture;
|
||||
|
||||
if (!rightToLeft)
|
||||
{
|
||||
beforefirst = -1;
|
||||
last = pattern.Length - 1;
|
||||
bump = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
beforefirst = pattern.Length;
|
||||
last = 0;
|
||||
bump = -1;
|
||||
}
|
||||
|
||||
// PART I - the good-suffix shift table
|
||||
//
|
||||
// compute the positive requirement:
|
||||
// if char "i" is the first one from the right that doesn't match,
|
||||
// then we know the matcher can advance by _positive[i].
|
||||
//
|
||||
// This algorithm is a simplified variant of the standard
|
||||
// Boyer-Moore good suffix calculation.
|
||||
|
||||
_positive = new int[pattern.Length];
|
||||
|
||||
examine = last;
|
||||
ch = pattern[examine];
|
||||
_positive[examine] = bump;
|
||||
examine -= bump;
|
||||
|
||||
for (; ;)
|
||||
{
|
||||
// find an internal char (examine) that matches the tail
|
||||
|
||||
for (; ;)
|
||||
{
|
||||
if (examine == beforefirst)
|
||||
goto OuterloopBreak;
|
||||
if (pattern[examine] == ch)
|
||||
break;
|
||||
examine -= bump;
|
||||
}
|
||||
|
||||
match = last;
|
||||
scan = examine;
|
||||
|
||||
// find the length of the match
|
||||
|
||||
for (; ;)
|
||||
{
|
||||
if (scan == beforefirst || pattern[match] != pattern[scan])
|
||||
{
|
||||
// at the end of the match, note the difference in _positive
|
||||
// this is not the length of the match, but the distance from the internal match
|
||||
// to the tail suffix.
|
||||
if (_positive[match] == 0)
|
||||
_positive[match] = match - scan;
|
||||
|
||||
// System.Diagnostics.Debug.WriteLine("Set positive[" + match + "] to " + (match - scan));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
scan -= bump;
|
||||
match -= bump;
|
||||
}
|
||||
|
||||
examine -= bump;
|
||||
}
|
||||
|
||||
OuterloopBreak:
|
||||
|
||||
match = last - bump;
|
||||
|
||||
// scan for the chars for which there are no shifts that yield a different candidate
|
||||
|
||||
|
||||
// The inside of the if statement used to say
|
||||
// "_positive[match] = last - beforefirst;"
|
||||
// This is slightly less aggressive in how much we skip, but at worst it
|
||||
// should mean a little more work rather than skipping a potential match.
|
||||
while (match != beforefirst)
|
||||
{
|
||||
if (_positive[match] == 0)
|
||||
_positive[match] = bump;
|
||||
|
||||
match -= bump;
|
||||
}
|
||||
|
||||
// PART II - the bad-character shift table
|
||||
//
|
||||
// compute the negative requirement:
|
||||
// if char "ch" is the reject character when testing position "i",
|
||||
// we can slide up by _negative[ch];
|
||||
// (_negative[ch] = str.Length - 1 - str.LastIndexOf(ch))
|
||||
//
|
||||
// the lookup table is divided into ASCII and Unicode portions;
|
||||
// only those parts of the Unicode 16-bit code set that actually
|
||||
// appear in the string are in the table. (Maximum size with
|
||||
// Unicode is 65K; ASCII only case is 512 bytes.)
|
||||
|
||||
_negativeASCII = new int[128];
|
||||
|
||||
for (int i = 0; i < 128; i++)
|
||||
_negativeASCII[i] = last - beforefirst;
|
||||
|
||||
_lowASCII = 127;
|
||||
_highASCII = 0;
|
||||
|
||||
for (examine = last; examine != beforefirst; examine -= bump)
|
||||
{
|
||||
ch = pattern[examine];
|
||||
|
||||
if (ch < 128)
|
||||
{
|
||||
if (_lowASCII > ch)
|
||||
_lowASCII = ch;
|
||||
|
||||
if (_highASCII < ch)
|
||||
_highASCII = ch;
|
||||
|
||||
if (_negativeASCII[ch] == last - beforefirst)
|
||||
_negativeASCII[ch] = last - examine;
|
||||
}
|
||||
else
|
||||
{
|
||||
int i = ch >> 8;
|
||||
int j = ch & 0xFF;
|
||||
|
||||
if (_negativeUnicode == null)
|
||||
{
|
||||
_negativeUnicode = new int[256][];
|
||||
}
|
||||
|
||||
if (_negativeUnicode[i] == null)
|
||||
{
|
||||
int[] newarray = new int[256];
|
||||
|
||||
for (int k = 0; k < newarray.Length; k++)
|
||||
newarray[k] = last - beforefirst;
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
Array.Copy(_negativeASCII, 0, newarray, 0, 128);
|
||||
_negativeASCII = newarray;
|
||||
}
|
||||
|
||||
_negativeUnicode[i] = newarray;
|
||||
}
|
||||
|
||||
if (_negativeUnicode[i][j] == last - beforefirst)
|
||||
_negativeUnicode[i][j] = last - examine;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool MatchPattern(string text, int index)
|
||||
{
|
||||
if (_caseInsensitive)
|
||||
{
|
||||
if (text.Length - index < _pattern.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
TextInfo textinfo = _culture.TextInfo;
|
||||
for (int i = 0; i < _pattern.Length; i++)
|
||||
{
|
||||
Debug.Assert(textinfo.ToLower(_pattern[i]) == _pattern[i], "pattern should be converted to lower case in constructor!");
|
||||
if (textinfo.ToLower(text[index + i]) != _pattern[i])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return (0 == string.CompareOrdinal(_pattern, 0, text, index, _pattern.Length));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When a regex is anchored, we can do a quick IsMatch test instead of a Scan
|
||||
/// </summary>
|
||||
internal bool IsMatch(string text, int index, int beglimit, int endlimit)
|
||||
{
|
||||
if (!_rightToLeft)
|
||||
{
|
||||
if (index < beglimit || endlimit - index < _pattern.Length)
|
||||
return false;
|
||||
|
||||
return MatchPattern(text, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (index > endlimit || index - beglimit < _pattern.Length)
|
||||
return false;
|
||||
|
||||
return MatchPattern(text, index - _pattern.Length);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scan uses the Boyer-Moore algorithm to find the first occurrence
|
||||
/// of the specified string within text, beginning at index, and
|
||||
/// constrained within beglimit and endlimit.
|
||||
///
|
||||
/// The direction and case-sensitivity of the match is determined
|
||||
/// by the arguments to the RegexBoyerMoore constructor.
|
||||
/// </summary>
|
||||
internal int Scan(string text, int index, int beglimit, int endlimit)
|
||||
{
|
||||
int test;
|
||||
int test2;
|
||||
int match;
|
||||
int startmatch;
|
||||
int endmatch;
|
||||
int advance;
|
||||
int defadv;
|
||||
int bump;
|
||||
char chMatch;
|
||||
char chTest;
|
||||
int[] unicodeLookup;
|
||||
|
||||
if (!_rightToLeft)
|
||||
{
|
||||
defadv = _pattern.Length;
|
||||
startmatch = _pattern.Length - 1;
|
||||
endmatch = 0;
|
||||
test = index + defadv - 1;
|
||||
bump = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
defadv = -_pattern.Length;
|
||||
startmatch = 0;
|
||||
endmatch = -defadv - 1;
|
||||
test = index + defadv;
|
||||
bump = -1;
|
||||
}
|
||||
|
||||
chMatch = _pattern[startmatch];
|
||||
|
||||
for (; ;)
|
||||
{
|
||||
if (test >= endlimit || test < beglimit)
|
||||
return -1;
|
||||
|
||||
chTest = text[test];
|
||||
|
||||
if (_caseInsensitive)
|
||||
chTest = _culture.TextInfo.ToLower(chTest);
|
||||
|
||||
if (chTest != chMatch)
|
||||
{
|
||||
if (chTest < 128)
|
||||
advance = _negativeASCII[chTest];
|
||||
else if (null != _negativeUnicode && (null != (unicodeLookup = _negativeUnicode[chTest >> 8])))
|
||||
advance = unicodeLookup[chTest & 0xFF];
|
||||
else
|
||||
advance = defadv;
|
||||
|
||||
test += advance;
|
||||
}
|
||||
else
|
||||
{ // if (chTest == chMatch)
|
||||
test2 = test;
|
||||
match = startmatch;
|
||||
|
||||
for (; ;)
|
||||
{
|
||||
if (match == endmatch)
|
||||
return (_rightToLeft ? test2 + 1 : test2);
|
||||
|
||||
match -= bump;
|
||||
test2 -= bump;
|
||||
|
||||
chTest = text[test2];
|
||||
|
||||
if (_caseInsensitive)
|
||||
chTest = _culture.TextInfo.ToLower(chTest);
|
||||
|
||||
if (chTest != _pattern[match])
|
||||
{
|
||||
advance = _positive[match];
|
||||
if ((chTest & 0xFF80) == 0)
|
||||
test2 = (match - startmatch) + _negativeASCII[chTest];
|
||||
else if (null != _negativeUnicode && (null != (unicodeLookup = _negativeUnicode[chTest >> 8])))
|
||||
test2 = (match - startmatch) + unicodeLookup[chTest & 0xFF];
|
||||
else
|
||||
{
|
||||
test += advance;
|
||||
break;
|
||||
}
|
||||
|
||||
if (_rightToLeft ? test2 < advance : test2 > advance)
|
||||
advance = test2;
|
||||
|
||||
test += advance;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Used when dumping for debugging.
|
||||
/// </summary>
|
||||
public override string ToString()
|
||||
{
|
||||
return _pattern;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
public string Dump(string indent)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.Append(indent + "BM Pattern: " + _pattern + "\n");
|
||||
sb.Append(indent + "Positive: ");
|
||||
for (int i = 0; i < _positive.Length; i++)
|
||||
{
|
||||
sb.Append(_positive[i].ToString(CultureInfo.InvariantCulture) + " ");
|
||||
}
|
||||
sb.Append("\n");
|
||||
|
||||
if (_negativeASCII != null)
|
||||
{
|
||||
sb.Append(indent + "Negative table\n");
|
||||
for (int i = 0; i < _negativeASCII.Length; i++)
|
||||
{
|
||||
if (_negativeASCII[i] != _pattern.Length)
|
||||
{
|
||||
sb.Append(indent + " " + Regex.Escape(Convert.ToString((char)i, CultureInfo.InvariantCulture)) + " " + _negativeASCII[i].ToString(CultureInfo.InvariantCulture) + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// Capture is just a location/length pair that indicates the
|
||||
// location of a regular expression match. A single regexp
|
||||
// search may return multiple Capture within each capturing
|
||||
// RegexGroup.
|
||||
|
||||
namespace System.Text.RegularExpressions
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the results from a single subexpression capture. The object represents
|
||||
/// one substring for a single successful capture.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class Capture
|
||||
{
|
||||
internal string _text;
|
||||
internal int _index;
|
||||
internal int _length;
|
||||
|
||||
internal Capture(string text, int i, int l)
|
||||
{
|
||||
_text = text;
|
||||
_index = i;
|
||||
_length = l;
|
||||
}
|
||||
|
||||
/*
|
||||
* The index of the beginning of the matched capture
|
||||
*/
|
||||
/// <summary>
|
||||
/// Returns the position in the original string where the first character of
|
||||
/// captured substring was found.
|
||||
/// </summary>
|
||||
public int Index
|
||||
{
|
||||
get
|
||||
{
|
||||
return _index;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The length of the matched capture
|
||||
*/
|
||||
/// <summary>
|
||||
/// Returns the length of the captured substring.
|
||||
/// </summary>
|
||||
public int Length
|
||||
{
|
||||
get
|
||||
{
|
||||
return _length;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the value of this Regex Capture.
|
||||
/// </summary>
|
||||
public string Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return _text.Substring(_index, _length);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The capture as a string
|
||||
*/
|
||||
/// <summary>
|
||||
/// Returns the substring that was matched.
|
||||
/// </summary>
|
||||
override public string ToString()
|
||||
{
|
||||
return Value;
|
||||
}
|
||||
|
||||
/*
|
||||
* The original string
|
||||
*/
|
||||
internal string GetOriginalString()
|
||||
{
|
||||
return _text;
|
||||
}
|
||||
|
||||
/*
|
||||
* The substring to the left of the capture
|
||||
*/
|
||||
internal string GetLeftSubstring()
|
||||
{
|
||||
return _text.Substring(0, _index);
|
||||
}
|
||||
|
||||
/*
|
||||
* The substring to the right of the capture
|
||||
*/
|
||||
internal string GetRightSubstring()
|
||||
{
|
||||
return _text.Substring(_index + _length, _text.Length - _index - _length);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
internal virtual string Description()
|
||||
{
|
||||
StringBuilder Sb = new StringBuilder();
|
||||
|
||||
Sb.Append("(I = ");
|
||||
Sb.Append(_index);
|
||||
Sb.Append(", L = ");
|
||||
Sb.Append(_length);
|
||||
Sb.Append("): ");
|
||||
Sb.Append(_text, _index, _length);
|
||||
|
||||
return Sb.ToString();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,242 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// The CaptureCollection lists the captured Capture numbers
|
||||
// contained in a compiled Regex.
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace System.Text.RegularExpressions
|
||||
{
|
||||
/*
|
||||
* This collection returns the Captures for a group
|
||||
* in the order in which they were matched (left to right
|
||||
* or right to left). It is created by Group.Captures
|
||||
*/
|
||||
/// <summary>
|
||||
/// Represents a sequence of capture substrings. The object is used
|
||||
/// to return the set of captures done by a single capturing group.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("Count = {Count}")]
|
||||
[DebuggerTypeProxy(typeof(RegexCollectionDebuggerProxy<Capture>))]
|
||||
[Serializable]
|
||||
public class CaptureCollection : IList<Capture>, IReadOnlyList<Capture>, IList
|
||||
{
|
||||
private readonly Group _group;
|
||||
private readonly int _capcount;
|
||||
private Capture[] _captures;
|
||||
|
||||
internal CaptureCollection(Group group)
|
||||
{
|
||||
_group = group;
|
||||
_capcount = _group._capcount;
|
||||
}
|
||||
|
||||
public bool IsReadOnly => true;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the number of captures.
|
||||
/// </summary>
|
||||
public int Count => _capcount;
|
||||
|
||||
/// <summary>
|
||||
/// Returns a specific capture, by index, in this collection.
|
||||
/// </summary>
|
||||
public Capture this[int i] => GetCapture(i);
|
||||
|
||||
/// <summary>
|
||||
/// Provides an enumerator in the same order as Item[].
|
||||
/// </summary>
|
||||
public IEnumerator GetEnumerator() => new Enumerator(this);
|
||||
|
||||
IEnumerator<Capture> IEnumerable<Capture>.GetEnumerator() => new Enumerator(this);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the set of captures for the group
|
||||
/// </summary>
|
||||
private Capture GetCapture(int i)
|
||||
{
|
||||
if (i == _capcount - 1 && i >= 0)
|
||||
return _group;
|
||||
|
||||
if (i >= _capcount || i < 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(i));
|
||||
|
||||
// first time a capture is accessed, compute them all
|
||||
if (_captures == null)
|
||||
{
|
||||
_captures = new Capture[_capcount];
|
||||
for (int j = 0; j < _capcount - 1; j++)
|
||||
{
|
||||
_captures[j] = new Capture(_group._text, _group._caps[j * 2], _group._caps[j * 2 + 1]);
|
||||
}
|
||||
}
|
||||
|
||||
return _captures[i];
|
||||
}
|
||||
|
||||
public bool IsSynchronized => false;
|
||||
|
||||
public object SyncRoot => _group;
|
||||
|
||||
public void CopyTo(Array array, int arrayIndex)
|
||||
{
|
||||
if (array == null)
|
||||
throw new ArgumentNullException(nameof(array));
|
||||
|
||||
for (int i = arrayIndex, j = 0; j < Count; i++, j++)
|
||||
{
|
||||
array.SetValue(this[j], i);
|
||||
}
|
||||
}
|
||||
|
||||
public void CopyTo(Capture[] array, int arrayIndex)
|
||||
{
|
||||
if (array == null)
|
||||
throw new ArgumentNullException(nameof(array));
|
||||
if (arrayIndex < 0 || arrayIndex > array.Length)
|
||||
throw new ArgumentOutOfRangeException(nameof(arrayIndex));
|
||||
if (array.Length - arrayIndex < Count)
|
||||
throw new ArgumentException(SR.Arg_ArrayPlusOffTooSmall);
|
||||
|
||||
for (int i = arrayIndex, j = 0; j < Count; i++, j++)
|
||||
{
|
||||
array[i] = this[j];
|
||||
}
|
||||
}
|
||||
|
||||
int IList<Capture>.IndexOf(Capture item)
|
||||
{
|
||||
var comparer = EqualityComparer<Capture>.Default;
|
||||
for (int i = 0; i < Count; i++)
|
||||
{
|
||||
if (comparer.Equals(this[i], item))
|
||||
return i;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void IList<Capture>.Insert(int index, Capture item)
|
||||
{
|
||||
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
|
||||
}
|
||||
|
||||
void IList<Capture>.RemoveAt(int index)
|
||||
{
|
||||
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
|
||||
}
|
||||
|
||||
Capture IList<Capture>.this[int index]
|
||||
{
|
||||
get { return this[index]; }
|
||||
set { throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection); }
|
||||
}
|
||||
|
||||
void ICollection<Capture>.Add(Capture item)
|
||||
{
|
||||
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
|
||||
}
|
||||
|
||||
void ICollection<Capture>.Clear()
|
||||
{
|
||||
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
|
||||
}
|
||||
|
||||
bool ICollection<Capture>.Contains(Capture item) =>
|
||||
((IList<Capture>)this).IndexOf(item) >= 0;
|
||||
|
||||
bool ICollection<Capture>.Remove(Capture item)
|
||||
{
|
||||
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
|
||||
}
|
||||
|
||||
int IList.Add(object value)
|
||||
{
|
||||
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
|
||||
}
|
||||
|
||||
void IList.Clear()
|
||||
{
|
||||
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
|
||||
}
|
||||
|
||||
bool IList.Contains(object value) =>
|
||||
value is Capture && ((ICollection<Capture>)this).Contains((Capture)value);
|
||||
|
||||
int IList.IndexOf(object value) =>
|
||||
value is Capture ? ((IList<Capture>)this).IndexOf((Capture)value) : -1;
|
||||
|
||||
void IList.Insert(int index, object value)
|
||||
{
|
||||
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
|
||||
}
|
||||
|
||||
bool IList.IsFixedSize => true;
|
||||
|
||||
void IList.Remove(object value)
|
||||
{
|
||||
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
|
||||
}
|
||||
|
||||
void IList.RemoveAt(int index)
|
||||
{
|
||||
throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection);
|
||||
}
|
||||
|
||||
object IList.this[int index]
|
||||
{
|
||||
get { return this[index]; }
|
||||
set { throw new NotSupportedException(SR.NotSupported_ReadOnlyCollection); }
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
private sealed class Enumerator : IEnumerator<Capture>
|
||||
{
|
||||
private readonly CaptureCollection _collection;
|
||||
private int _index;
|
||||
|
||||
internal Enumerator(CaptureCollection collection)
|
||||
{
|
||||
Debug.Assert(collection != null, "collection cannot be null.");
|
||||
|
||||
_collection = collection;
|
||||
_index = -1;
|
||||
}
|
||||
|
||||
public bool MoveNext()
|
||||
{
|
||||
int size = _collection.Count;
|
||||
|
||||
if (_index >= size)
|
||||
return false;
|
||||
|
||||
_index++;
|
||||
|
||||
return _index < size;
|
||||
}
|
||||
|
||||
public Capture Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_index < 0 || _index >= _collection.Count)
|
||||
throw new InvalidOperationException(SR.EnumNotStarted);
|
||||
|
||||
return _collection[_index];
|
||||
}
|
||||
}
|
||||
|
||||
object IEnumerator.Current => Current;
|
||||
|
||||
void IEnumerator.Reset()
|
||||
{
|
||||
_index = -1;
|
||||
}
|
||||
|
||||
void IDisposable.Dispose() { }
|
||||
}
|
||||
}
|
||||
}
|
||||
1371
external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCharClass.cs
vendored
Normal file
1371
external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCharClass.cs
vendored
Normal file
File diff suppressed because it is too large
Load Diff
374
external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCode.cs
vendored
Normal file
374
external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexCode.cs
vendored
Normal file
@@ -0,0 +1,374 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// This RegexCode class is internal to the regular expression package.
|
||||
// It provides operator constants for use by the Builder and the Machine.
|
||||
|
||||
// Implementation notes:
|
||||
//
|
||||
// Regexps are built into RegexCodes, which contain an operation array,
|
||||
// a string table, and some constants.
|
||||
//
|
||||
// Each operation is one of the codes below, followed by the integer
|
||||
// operands specified for each op.
|
||||
//
|
||||
// Strings and sets are indices into a string table.
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
|
||||
namespace System.Text.RegularExpressions
|
||||
{
|
||||
internal sealed class RegexCode
|
||||
{
|
||||
// The following primitive operations come directly from the parser
|
||||
|
||||
// lef/back operands description
|
||||
internal const int Onerep = 0; // lef,back char,min,max a {n}
|
||||
internal const int Notonerep = 1; // lef,back char,min,max .{n}
|
||||
internal const int Setrep = 2; // lef,back set,min,max [\d]{n}
|
||||
|
||||
internal const int Oneloop = 3; // lef,back char,min,max a {,n}
|
||||
internal const int Notoneloop = 4; // lef,back char,min,max .{,n}
|
||||
internal const int Setloop = 5; // lef,back set,min,max [\d]{,n}
|
||||
|
||||
internal const int Onelazy = 6; // lef,back char,min,max a {,n}?
|
||||
internal const int Notonelazy = 7; // lef,back char,min,max .{,n}?
|
||||
internal const int Setlazy = 8; // lef,back set,min,max [\d]{,n}?
|
||||
|
||||
internal const int One = 9; // lef char a
|
||||
internal const int Notone = 10; // lef char [^a]
|
||||
internal const int Set = 11; // lef set [a-z\s] \w \s \d
|
||||
|
||||
internal const int Multi = 12; // lef string abcd
|
||||
internal const int Ref = 13; // lef group \#
|
||||
|
||||
internal const int Bol = 14; // ^
|
||||
internal const int Eol = 15; // $
|
||||
internal const int Boundary = 16; // \b
|
||||
internal const int Nonboundary = 17; // \B
|
||||
internal const int Beginning = 18; // \A
|
||||
internal const int Start = 19; // \G
|
||||
internal const int EndZ = 20; // \Z
|
||||
internal const int End = 21; // \Z
|
||||
|
||||
internal const int Nothing = 22; // Reject!
|
||||
|
||||
// Primitive control structures
|
||||
|
||||
internal const int Lazybranch = 23; // back jump straight first
|
||||
internal const int Branchmark = 24; // back jump branch first for loop
|
||||
internal const int Lazybranchmark = 25; // back jump straight first for loop
|
||||
internal const int Nullcount = 26; // back val set counter, null mark
|
||||
internal const int Setcount = 27; // back val set counter, make mark
|
||||
internal const int Branchcount = 28; // back jump,limit branch++ if zero<=c<limit
|
||||
internal const int Lazybranchcount = 29; // back jump,limit same, but straight first
|
||||
internal const int Nullmark = 30; // back save position
|
||||
internal const int Setmark = 31; // back save position
|
||||
internal const int Capturemark = 32; // back group define group
|
||||
internal const int Getmark = 33; // back recall position
|
||||
internal const int Setjump = 34; // back save backtrack state
|
||||
internal const int Backjump = 35; // zap back to saved state
|
||||
internal const int Forejump = 36; // zap backtracking state
|
||||
internal const int Testref = 37; // backtrack if ref undefined
|
||||
internal const int Goto = 38; // jump just go
|
||||
|
||||
internal const int Prune = 39; // prune it baby
|
||||
internal const int Stop = 40; // done!
|
||||
|
||||
internal const int ECMABoundary = 41; // \b
|
||||
internal const int NonECMABoundary = 42; // \B
|
||||
|
||||
// Modifiers for alternate modes
|
||||
internal const int Mask = 63; // Mask to get unmodified ordinary operator
|
||||
internal const int Rtl = 64; // bit to indicate that we're reverse scanning.
|
||||
internal const int Back = 128; // bit to indicate that we're backtracking.
|
||||
internal const int Back2 = 256; // bit to indicate that we're backtracking on a second branch.
|
||||
internal const int Ci = 512; // bit to indicate that we're case-insensitive.
|
||||
|
||||
internal readonly int[] _codes; // the code
|
||||
internal readonly string[] _strings; // the string/set table
|
||||
internal readonly int _trackcount; // how many instructions use backtracking
|
||||
internal readonly Hashtable _caps; // mapping of user group numbers -> impl group slots
|
||||
internal readonly int _capsize; // number of impl group slots
|
||||
internal readonly RegexPrefix _fcPrefix; // the set of candidate first characters (may be null)
|
||||
internal readonly RegexBoyerMoore _bmPrefix; // the fixed prefix string as a Boyer-Moore machine (may be null)
|
||||
internal readonly int _anchors; // the set of zero-length start anchors (RegexFCD.Bol, etc)
|
||||
internal readonly bool _rightToLeft; // true if right to left
|
||||
|
||||
internal RegexCode(int[] codes, List<string> stringlist, int trackcount,
|
||||
Hashtable caps, int capsize,
|
||||
RegexBoyerMoore bmPrefix, RegexPrefix fcPrefix,
|
||||
int anchors, bool rightToLeft)
|
||||
{
|
||||
Debug.Assert(codes != null, "codes cannot be null.");
|
||||
Debug.Assert(stringlist != null, "stringlist cannot be null.");
|
||||
|
||||
_codes = codes;
|
||||
_strings = stringlist.ToArray();
|
||||
_trackcount = trackcount;
|
||||
_caps = caps;
|
||||
_capsize = capsize;
|
||||
_bmPrefix = bmPrefix;
|
||||
_fcPrefix = fcPrefix;
|
||||
_anchors = anchors;
|
||||
_rightToLeft = rightToLeft;
|
||||
}
|
||||
|
||||
internal static bool OpcodeBacktracks(int Op)
|
||||
{
|
||||
Op &= Mask;
|
||||
|
||||
switch (Op)
|
||||
{
|
||||
case Oneloop:
|
||||
case Notoneloop:
|
||||
case Setloop:
|
||||
case Onelazy:
|
||||
case Notonelazy:
|
||||
case Setlazy:
|
||||
case Lazybranch:
|
||||
case Branchmark:
|
||||
case Lazybranchmark:
|
||||
case Nullcount:
|
||||
case Setcount:
|
||||
case Branchcount:
|
||||
case Lazybranchcount:
|
||||
case Setmark:
|
||||
case Capturemark:
|
||||
case Getmark:
|
||||
case Setjump:
|
||||
case Backjump:
|
||||
case Forejump:
|
||||
case Goto:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
internal static int OpcodeSize(int opcode)
|
||||
{
|
||||
opcode &= Mask;
|
||||
|
||||
switch (opcode)
|
||||
{
|
||||
case Nothing:
|
||||
case Bol:
|
||||
case Eol:
|
||||
case Boundary:
|
||||
case Nonboundary:
|
||||
case ECMABoundary:
|
||||
case NonECMABoundary:
|
||||
case Beginning:
|
||||
case Start:
|
||||
case EndZ:
|
||||
case End:
|
||||
case Nullmark:
|
||||
case Setmark:
|
||||
case Getmark:
|
||||
case Setjump:
|
||||
case Backjump:
|
||||
case Forejump:
|
||||
case Stop:
|
||||
return 1;
|
||||
|
||||
case One:
|
||||
case Notone:
|
||||
case Multi:
|
||||
case Ref:
|
||||
case Testref:
|
||||
case Goto:
|
||||
case Nullcount:
|
||||
case Setcount:
|
||||
case Lazybranch:
|
||||
case Branchmark:
|
||||
case Lazybranchmark:
|
||||
case Prune:
|
||||
case Set:
|
||||
return 2;
|
||||
|
||||
case Capturemark:
|
||||
case Branchcount:
|
||||
case Lazybranchcount:
|
||||
case Onerep:
|
||||
case Notonerep:
|
||||
case Oneloop:
|
||||
case Notoneloop:
|
||||
case Onelazy:
|
||||
case Notonelazy:
|
||||
case Setlazy:
|
||||
case Setrep:
|
||||
case Setloop:
|
||||
return 3;
|
||||
|
||||
default:
|
||||
throw new ArgumentException(SR.Format(SR.UnexpectedOpcode, opcode.ToString(CultureInfo.CurrentCulture)));
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly string[] CodeStr = new string[]
|
||||
{
|
||||
"Onerep", "Notonerep", "Setrep",
|
||||
"Oneloop", "Notoneloop", "Setloop",
|
||||
"Onelazy", "Notonelazy", "Setlazy",
|
||||
"One", "Notone", "Set",
|
||||
"Multi", "Ref",
|
||||
"Bol", "Eol", "Boundary", "Nonboundary", "Beginning", "Start", "EndZ", "End",
|
||||
"Nothing",
|
||||
"Lazybranch", "Branchmark", "Lazybranchmark",
|
||||
"Nullcount", "Setcount", "Branchcount", "Lazybranchcount",
|
||||
"Nullmark", "Setmark", "Capturemark", "Getmark",
|
||||
"Setjump", "Backjump", "Forejump", "Testref", "Goto",
|
||||
"Prune", "Stop",
|
||||
#if ECMA
|
||||
"ECMABoundary", "NonECMABoundary",
|
||||
#endif
|
||||
};
|
||||
|
||||
internal static string OperatorDescription(int Opcode)
|
||||
{
|
||||
bool isCi = ((Opcode & Ci) != 0);
|
||||
bool isRtl = ((Opcode & Rtl) != 0);
|
||||
bool isBack = ((Opcode & Back) != 0);
|
||||
bool isBack2 = ((Opcode & Back2) != 0);
|
||||
|
||||
return CodeStr[Opcode & Mask] +
|
||||
(isCi ? "-Ci" : "") + (isRtl ? "-Rtl" : "") + (isBack ? "-Back" : "") + (isBack2 ? "-Back2" : "");
|
||||
}
|
||||
|
||||
internal string OpcodeDescription(int offset)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
int opcode = _codes[offset];
|
||||
|
||||
sb.AppendFormat("{0:D6} ", offset);
|
||||
sb.Append(OpcodeBacktracks(opcode & Mask) ? '*' : ' ');
|
||||
sb.Append(OperatorDescription(opcode));
|
||||
sb.Append('(');
|
||||
|
||||
opcode &= Mask;
|
||||
|
||||
switch (opcode)
|
||||
{
|
||||
case One:
|
||||
case Notone:
|
||||
case Onerep:
|
||||
case Notonerep:
|
||||
case Oneloop:
|
||||
case Notoneloop:
|
||||
case Onelazy:
|
||||
case Notonelazy:
|
||||
sb.Append("Ch = ");
|
||||
sb.Append(RegexCharClass.CharDescription((char)_codes[offset + 1]));
|
||||
break;
|
||||
|
||||
case Set:
|
||||
case Setrep:
|
||||
case Setloop:
|
||||
case Setlazy:
|
||||
sb.Append("Set = ");
|
||||
sb.Append(RegexCharClass.SetDescription(_strings[_codes[offset + 1]]));
|
||||
break;
|
||||
|
||||
case Multi:
|
||||
sb.Append("String = ");
|
||||
sb.Append(_strings[_codes[offset + 1]]);
|
||||
break;
|
||||
|
||||
case Ref:
|
||||
case Testref:
|
||||
sb.Append("Index = ");
|
||||
sb.Append(_codes[offset + 1]);
|
||||
break;
|
||||
|
||||
case Capturemark:
|
||||
sb.Append("Index = ");
|
||||
sb.Append(_codes[offset + 1]);
|
||||
if (_codes[offset + 2] != -1)
|
||||
{
|
||||
sb.Append(", Unindex = ");
|
||||
sb.Append(_codes[offset + 2]);
|
||||
}
|
||||
break;
|
||||
|
||||
case Nullcount:
|
||||
case Setcount:
|
||||
sb.Append("Value = ");
|
||||
sb.Append(_codes[offset + 1]);
|
||||
break;
|
||||
|
||||
case Goto:
|
||||
case Lazybranch:
|
||||
case Branchmark:
|
||||
case Lazybranchmark:
|
||||
case Branchcount:
|
||||
case Lazybranchcount:
|
||||
sb.Append("Addr = ");
|
||||
sb.Append(_codes[offset + 1]);
|
||||
break;
|
||||
}
|
||||
|
||||
switch (opcode)
|
||||
{
|
||||
case Onerep:
|
||||
case Notonerep:
|
||||
case Oneloop:
|
||||
case Notoneloop:
|
||||
case Onelazy:
|
||||
case Notonelazy:
|
||||
case Setrep:
|
||||
case Setloop:
|
||||
case Setlazy:
|
||||
sb.Append(", Rep = ");
|
||||
if (_codes[offset + 2] == int.MaxValue)
|
||||
sb.Append("inf");
|
||||
else
|
||||
sb.Append(_codes[offset + 2]);
|
||||
break;
|
||||
|
||||
case Branchcount:
|
||||
case Lazybranchcount:
|
||||
sb.Append(", Limit = ");
|
||||
if (_codes[offset + 2] == int.MaxValue)
|
||||
sb.Append("inf");
|
||||
else
|
||||
sb.Append(_codes[offset + 2]);
|
||||
break;
|
||||
}
|
||||
|
||||
sb.Append(')');
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
internal void Dump()
|
||||
{
|
||||
int i;
|
||||
|
||||
Debug.WriteLine("Direction: " + (_rightToLeft ? "right-to-left" : "left-to-right"));
|
||||
Debug.WriteLine("Firstchars: " + (_fcPrefix == null ? "n/a" : RegexCharClass.SetDescription(_fcPrefix.Prefix)));
|
||||
Debug.WriteLine("Prefix: " + (_bmPrefix == null ? "n/a" : Regex.Escape(_bmPrefix.ToString())));
|
||||
Debug.WriteLine("Anchors: " + RegexFCD.AnchorDescription(_anchors));
|
||||
Debug.WriteLine("");
|
||||
if (_bmPrefix != null)
|
||||
{
|
||||
Debug.WriteLine("BoyerMoore:");
|
||||
Debug.WriteLine(_bmPrefix.Dump(" "));
|
||||
}
|
||||
for (i = 0; i < _codes.Length;)
|
||||
{
|
||||
Debug.WriteLine(OpcodeDescription(i));
|
||||
i += OpcodeSize(_codes[i]);
|
||||
}
|
||||
|
||||
Debug.WriteLine("");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace System.Text.RegularExpressions
|
||||
{
|
||||
internal sealed class RegexCollectionDebuggerProxy<T>
|
||||
{
|
||||
private readonly ICollection<T> _collection;
|
||||
|
||||
public RegexCollectionDebuggerProxy(ICollection<T> collection)
|
||||
{
|
||||
if (collection == null)
|
||||
throw new ArgumentNullException(nameof(collection));
|
||||
|
||||
_collection = collection;
|
||||
}
|
||||
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
|
||||
public T[] Items
|
||||
{
|
||||
get
|
||||
{
|
||||
T[] items = new T[_collection.Count];
|
||||
_collection.CopyTo(items, 0);
|
||||
return items;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
645
external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexFCD.cs
vendored
Normal file
645
external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexFCD.cs
vendored
Normal file
File diff suppressed because it is too large
Load Diff
100
external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexGroup.cs
vendored
Normal file
100
external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexGroup.cs
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
// Group represents the substring or substrings that
|
||||
// are captured by a single capturing group after one
|
||||
// regular expression match.
|
||||
|
||||
namespace System.Text.RegularExpressions
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the results from a single capturing group. A capturing group can
|
||||
/// capture zero, one, or more strings in a single match because of quantifiers, so
|
||||
/// Group supplies a collection of Capture objects.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class Group : Capture
|
||||
{
|
||||
// the empty group object
|
||||
internal static readonly Group s_emptyGroup = new Group(string.Empty, Array.Empty<int>(), 0, string.Empty);
|
||||
|
||||
internal readonly int[] _caps;
|
||||
internal int _capcount;
|
||||
internal CaptureCollection _capcoll;
|
||||
internal readonly string _name;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the match is successful.
|
||||
/// </summary>
|
||||
public bool Success
|
||||
{
|
||||
get
|
||||
{
|
||||
return _capcount != 0;
|
||||
}
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The collection of all captures for this group
|
||||
*/
|
||||
/// <summary>
|
||||
/// Returns a collection of all the captures matched by the capturing
|
||||
/// group, in innermost-leftmost-first order (or innermost-rightmost-first order if
|
||||
/// compiled with the "r" option). The collection may have zero or more items.
|
||||
/// </summary>
|
||||
public CaptureCollection Captures
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_capcoll == null)
|
||||
_capcoll = new CaptureCollection(this);
|
||||
|
||||
return _capcoll;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Convert to a thread-safe object by precomputing cache contents
|
||||
*/
|
||||
/// <summary>
|
||||
/// Returns a Group object equivalent to the one supplied that is safe to share between
|
||||
/// multiple threads.
|
||||
/// </summary>
|
||||
public static Group Synchronized(Group inner)
|
||||
{
|
||||
if (inner == null)
|
||||
throw new ArgumentNullException(nameof(inner));
|
||||
|
||||
// force Captures to be computed.
|
||||
|
||||
CaptureCollection capcoll;
|
||||
Capture dummy;
|
||||
|
||||
capcoll = inner.Captures;
|
||||
|
||||
if (inner._capcount > 0)
|
||||
dummy = capcoll[0];
|
||||
|
||||
return inner;
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user