scripts
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text.RegularExpressions.Syntax
|
||||
{
|
||||
// Token: 0x020002E4 RID: 740
|
||||
internal class Alternation : CompositeExpression
|
||||
{
|
||||
// Token: 0x17000837 RID: 2103
|
||||
// (get) Token: 0x06001AE3 RID: 6883 RVA: 0x000630D8 File Offset: 0x000612D8
|
||||
public ExpressionCollection Alternatives
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Expressions;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001AE4 RID: 6884 RVA: 0x000630E0 File Offset: 0x000612E0
|
||||
public void AddAlternative(Expression e)
|
||||
{
|
||||
this.Alternatives.Add(e);
|
||||
}
|
||||
|
||||
// Token: 0x06001AE5 RID: 6885 RVA: 0x000630F0 File Offset: 0x000612F0
|
||||
public override void Compile(ICompiler cmp, bool reverse)
|
||||
{
|
||||
LinkRef linkRef = cmp.NewLink();
|
||||
foreach (object obj in this.Alternatives)
|
||||
{
|
||||
Expression expression = (Expression)obj;
|
||||
LinkRef linkRef2 = cmp.NewLink();
|
||||
cmp.EmitBranch(linkRef2);
|
||||
expression.Compile(cmp, reverse);
|
||||
cmp.EmitJump(linkRef);
|
||||
cmp.ResolveLink(linkRef2);
|
||||
cmp.EmitBranchEnd();
|
||||
}
|
||||
cmp.EmitFalse();
|
||||
cmp.ResolveLink(linkRef);
|
||||
cmp.EmitAlternationEnd();
|
||||
}
|
||||
|
||||
// Token: 0x06001AE6 RID: 6886 RVA: 0x000631A0 File Offset: 0x000613A0
|
||||
public override void GetWidth(out int min, out int max)
|
||||
{
|
||||
base.GetWidth(out min, out max, this.Alternatives.Count);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text.RegularExpressions.Syntax
|
||||
{
|
||||
// Token: 0x020002EA RID: 746
|
||||
internal class AnchorInfo
|
||||
{
|
||||
// Token: 0x06001B11 RID: 6929 RVA: 0x000639C8 File Offset: 0x00061BC8
|
||||
public AnchorInfo(Expression expr, int width)
|
||||
{
|
||||
this.expr = expr;
|
||||
this.offset = 0;
|
||||
this.width = width;
|
||||
this.str = null;
|
||||
this.ignore = false;
|
||||
this.pos = Position.Any;
|
||||
}
|
||||
|
||||
// Token: 0x06001B12 RID: 6930 RVA: 0x00063A08 File Offset: 0x00061C08
|
||||
public AnchorInfo(Expression expr, int offset, int width, string str, bool ignore)
|
||||
{
|
||||
this.expr = expr;
|
||||
this.offset = offset;
|
||||
this.width = width;
|
||||
this.str = ((!ignore) ? str : str.ToLower());
|
||||
this.ignore = ignore;
|
||||
this.pos = Position.Any;
|
||||
}
|
||||
|
||||
// Token: 0x06001B13 RID: 6931 RVA: 0x00063A5C File Offset: 0x00061C5C
|
||||
public AnchorInfo(Expression expr, int offset, int width, Position pos)
|
||||
{
|
||||
this.expr = expr;
|
||||
this.offset = offset;
|
||||
this.width = width;
|
||||
this.pos = pos;
|
||||
this.str = null;
|
||||
this.ignore = false;
|
||||
}
|
||||
|
||||
// Token: 0x1700083F RID: 2111
|
||||
// (get) Token: 0x06001B14 RID: 6932 RVA: 0x00063A90 File Offset: 0x00061C90
|
||||
public Expression Expression
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.expr;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000840 RID: 2112
|
||||
// (get) Token: 0x06001B15 RID: 6933 RVA: 0x00063A98 File Offset: 0x00061C98
|
||||
public int Offset
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.offset;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000841 RID: 2113
|
||||
// (get) Token: 0x06001B16 RID: 6934 RVA: 0x00063AA0 File Offset: 0x00061CA0
|
||||
public int Width
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.width;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000842 RID: 2114
|
||||
// (get) Token: 0x06001B17 RID: 6935 RVA: 0x00063AA8 File Offset: 0x00061CA8
|
||||
public int Length
|
||||
{
|
||||
get
|
||||
{
|
||||
return (this.str == null) ? 0 : this.str.Length;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000843 RID: 2115
|
||||
// (get) Token: 0x06001B18 RID: 6936 RVA: 0x00063AC8 File Offset: 0x00061CC8
|
||||
public bool IsUnknownWidth
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.width < 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000844 RID: 2116
|
||||
// (get) Token: 0x06001B19 RID: 6937 RVA: 0x00063AD4 File Offset: 0x00061CD4
|
||||
public bool IsComplete
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Length == this.Width;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000845 RID: 2117
|
||||
// (get) Token: 0x06001B1A RID: 6938 RVA: 0x00063AE4 File Offset: 0x00061CE4
|
||||
public string Substring
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.str;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000846 RID: 2118
|
||||
// (get) Token: 0x06001B1B RID: 6939 RVA: 0x00063AEC File Offset: 0x00061CEC
|
||||
public bool IgnoreCase
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ignore;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000847 RID: 2119
|
||||
// (get) Token: 0x06001B1C RID: 6940 RVA: 0x00063AF4 File Offset: 0x00061CF4
|
||||
public Position Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.pos;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000848 RID: 2120
|
||||
// (get) Token: 0x06001B1D RID: 6941 RVA: 0x00063AFC File Offset: 0x00061CFC
|
||||
public bool IsSubstring
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.str != null;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000849 RID: 2121
|
||||
// (get) Token: 0x06001B1E RID: 6942 RVA: 0x00063B0C File Offset: 0x00061D0C
|
||||
public bool IsPosition
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.pos != Position.Any;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001B1F RID: 6943 RVA: 0x00063B1C File Offset: 0x00061D1C
|
||||
public Interval GetInterval()
|
||||
{
|
||||
return this.GetInterval(0);
|
||||
}
|
||||
|
||||
// Token: 0x06001B20 RID: 6944 RVA: 0x00063B28 File Offset: 0x00061D28
|
||||
public Interval GetInterval(int start)
|
||||
{
|
||||
if (!this.IsSubstring)
|
||||
{
|
||||
return Interval.Empty;
|
||||
}
|
||||
return new Interval(start + this.Offset, start + this.Offset + this.Length - 1);
|
||||
}
|
||||
|
||||
// Token: 0x040015CB RID: 5579
|
||||
private Expression expr;
|
||||
|
||||
// Token: 0x040015CC RID: 5580
|
||||
private Position pos;
|
||||
|
||||
// Token: 0x040015CD RID: 5581
|
||||
private int offset;
|
||||
|
||||
// Token: 0x040015CE RID: 5582
|
||||
private string str;
|
||||
|
||||
// Token: 0x040015CF RID: 5583
|
||||
private int width;
|
||||
|
||||
// Token: 0x040015D0 RID: 5584
|
||||
private bool ignore;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text.RegularExpressions.Syntax
|
||||
{
|
||||
// Token: 0x020002E1 RID: 737
|
||||
internal abstract class Assertion : CompositeExpression
|
||||
{
|
||||
// Token: 0x06001ACD RID: 6861 RVA: 0x00062D80 File Offset: 0x00060F80
|
||||
public Assertion()
|
||||
{
|
||||
base.Expressions.Add(null);
|
||||
base.Expressions.Add(null);
|
||||
}
|
||||
|
||||
// Token: 0x17000830 RID: 2096
|
||||
// (get) Token: 0x06001ACE RID: 6862 RVA: 0x00062DAC File Offset: 0x00060FAC
|
||||
// (set) Token: 0x06001ACF RID: 6863 RVA: 0x00062DBC File Offset: 0x00060FBC
|
||||
public Expression TrueExpression
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Expressions[0];
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Expressions[0] = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000831 RID: 2097
|
||||
// (get) Token: 0x06001AD0 RID: 6864 RVA: 0x00062DCC File Offset: 0x00060FCC
|
||||
// (set) Token: 0x06001AD1 RID: 6865 RVA: 0x00062DDC File Offset: 0x00060FDC
|
||||
public Expression FalseExpression
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Expressions[1];
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Expressions[1] = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001AD2 RID: 6866 RVA: 0x00062DEC File Offset: 0x00060FEC
|
||||
public override void GetWidth(out int min, out int max)
|
||||
{
|
||||
base.GetWidth(out min, out max, 2);
|
||||
if (this.TrueExpression == null || this.FalseExpression == null)
|
||||
{
|
||||
min = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace System.Text.RegularExpressions.Syntax
|
||||
{
|
||||
// Token: 0x020002E8 RID: 744
|
||||
internal class BackslashNumber : Reference
|
||||
{
|
||||
// Token: 0x06001B00 RID: 6912 RVA: 0x00063398 File Offset: 0x00061598
|
||||
public BackslashNumber(bool ignore, bool ecma)
|
||||
: base(ignore)
|
||||
{
|
||||
this.ecma = ecma;
|
||||
}
|
||||
|
||||
// Token: 0x06001B01 RID: 6913 RVA: 0x000633A8 File Offset: 0x000615A8
|
||||
public bool ResolveReference(string num_str, Hashtable groups)
|
||||
{
|
||||
if (this.ecma)
|
||||
{
|
||||
int num = 0;
|
||||
for (int i = 1; i < num_str.Length; i++)
|
||||
{
|
||||
if (groups[num_str.Substring(0, i)] != null)
|
||||
{
|
||||
num = i;
|
||||
}
|
||||
}
|
||||
if (num != 0)
|
||||
{
|
||||
base.CapturingGroup = (CapturingGroup)groups[num_str.Substring(0, num)];
|
||||
this.literal = num_str.Substring(num);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (num_str.Length == 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int num2 = 0;
|
||||
int num3 = Parser.ParseOctal(num_str, ref num2);
|
||||
if (num3 == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (num3 > 255 && this.ecma)
|
||||
{
|
||||
num3 /= 8;
|
||||
num2--;
|
||||
}
|
||||
num3 &= 255;
|
||||
this.literal = (char)num3 + num_str.Substring(num2);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x06001B02 RID: 6914 RVA: 0x00063484 File Offset: 0x00061684
|
||||
public override void Compile(ICompiler cmp, bool reverse)
|
||||
{
|
||||
if (base.CapturingGroup != null)
|
||||
{
|
||||
base.Compile(cmp, reverse);
|
||||
}
|
||||
if (this.literal != null)
|
||||
{
|
||||
Literal.CompileLiteral(this.literal, cmp, base.IgnoreCase, reverse);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040015C2 RID: 5570
|
||||
private string literal;
|
||||
|
||||
// Token: 0x040015C3 RID: 5571
|
||||
private bool ecma;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text.RegularExpressions.Syntax
|
||||
{
|
||||
// Token: 0x020002DE RID: 734
|
||||
internal class BalancingGroup : CapturingGroup
|
||||
{
|
||||
// Token: 0x06001ABA RID: 6842 RVA: 0x00062A50 File Offset: 0x00060C50
|
||||
public BalancingGroup()
|
||||
{
|
||||
this.balance = null;
|
||||
}
|
||||
|
||||
// Token: 0x1700082B RID: 2091
|
||||
// (get) Token: 0x06001ABB RID: 6843 RVA: 0x00062A60 File Offset: 0x00060C60
|
||||
// (set) Token: 0x06001ABC RID: 6844 RVA: 0x00062A68 File Offset: 0x00060C68
|
||||
public CapturingGroup Balance
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.balance;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.balance = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001ABD RID: 6845 RVA: 0x00062A74 File Offset: 0x00060C74
|
||||
public override void Compile(ICompiler cmp, bool reverse)
|
||||
{
|
||||
LinkRef linkRef = cmp.NewLink();
|
||||
cmp.EmitBalanceStart(base.Index, this.balance.Index, base.IsNamed, linkRef);
|
||||
int count = base.Expressions.Count;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
Expression expression;
|
||||
if (reverse)
|
||||
{
|
||||
expression = base.Expressions[count - i - 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
expression = base.Expressions[i];
|
||||
}
|
||||
expression.Compile(cmp, reverse);
|
||||
}
|
||||
cmp.EmitBalance();
|
||||
cmp.ResolveLink(linkRef);
|
||||
}
|
||||
|
||||
// Token: 0x040015B4 RID: 5556
|
||||
private CapturingGroup balance;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text.RegularExpressions.Syntax
|
||||
{
|
||||
// Token: 0x020002E2 RID: 738
|
||||
internal class CaptureAssertion : Assertion
|
||||
{
|
||||
// Token: 0x06001AD3 RID: 6867 RVA: 0x00062E1C File Offset: 0x0006101C
|
||||
public CaptureAssertion(Literal l)
|
||||
{
|
||||
this.literal = l;
|
||||
}
|
||||
|
||||
// Token: 0x17000832 RID: 2098
|
||||
// (get) Token: 0x06001AD4 RID: 6868 RVA: 0x00062E2C File Offset: 0x0006102C
|
||||
// (set) Token: 0x06001AD5 RID: 6869 RVA: 0x00062E34 File Offset: 0x00061034
|
||||
public CapturingGroup CapturingGroup
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.group;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.group = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001AD6 RID: 6870 RVA: 0x00062E40 File Offset: 0x00061040
|
||||
public override void Compile(ICompiler cmp, bool reverse)
|
||||
{
|
||||
if (this.group == null)
|
||||
{
|
||||
this.Alternate.Compile(cmp, reverse);
|
||||
return;
|
||||
}
|
||||
int index = this.group.Index;
|
||||
LinkRef linkRef = cmp.NewLink();
|
||||
if (base.FalseExpression == null)
|
||||
{
|
||||
cmp.EmitIfDefined(index, linkRef);
|
||||
base.TrueExpression.Compile(cmp, reverse);
|
||||
}
|
||||
else
|
||||
{
|
||||
LinkRef linkRef2 = cmp.NewLink();
|
||||
cmp.EmitIfDefined(index, linkRef2);
|
||||
base.TrueExpression.Compile(cmp, reverse);
|
||||
cmp.EmitJump(linkRef);
|
||||
cmp.ResolveLink(linkRef2);
|
||||
base.FalseExpression.Compile(cmp, reverse);
|
||||
}
|
||||
cmp.ResolveLink(linkRef);
|
||||
}
|
||||
|
||||
// Token: 0x06001AD7 RID: 6871 RVA: 0x00062EDC File Offset: 0x000610DC
|
||||
public override bool IsComplex()
|
||||
{
|
||||
if (this.group == null)
|
||||
{
|
||||
return this.Alternate.IsComplex();
|
||||
}
|
||||
return (base.TrueExpression != null && base.TrueExpression.IsComplex()) || (base.FalseExpression != null && base.FalseExpression.IsComplex()) || base.GetFixedWidth() <= 0;
|
||||
}
|
||||
|
||||
// Token: 0x17000833 RID: 2099
|
||||
// (get) Token: 0x06001AD8 RID: 6872 RVA: 0x00062F48 File Offset: 0x00061148
|
||||
private ExpressionAssertion Alternate
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.alternate == null)
|
||||
{
|
||||
this.alternate = new ExpressionAssertion();
|
||||
this.alternate.TrueExpression = base.TrueExpression;
|
||||
this.alternate.FalseExpression = base.FalseExpression;
|
||||
this.alternate.TestExpression = this.literal;
|
||||
}
|
||||
return this.alternate;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040015B8 RID: 5560
|
||||
private ExpressionAssertion alternate;
|
||||
|
||||
// Token: 0x040015B9 RID: 5561
|
||||
private CapturingGroup group;
|
||||
|
||||
// Token: 0x040015BA RID: 5562
|
||||
private Literal literal;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text.RegularExpressions.Syntax
|
||||
{
|
||||
// Token: 0x020002DD RID: 733
|
||||
internal class CapturingGroup : Group, IComparable
|
||||
{
|
||||
// Token: 0x06001AB1 RID: 6833 RVA: 0x000629B8 File Offset: 0x00060BB8
|
||||
public CapturingGroup()
|
||||
{
|
||||
this.gid = 0;
|
||||
this.name = null;
|
||||
}
|
||||
|
||||
// Token: 0x17000828 RID: 2088
|
||||
// (get) Token: 0x06001AB2 RID: 6834 RVA: 0x000629D0 File Offset: 0x00060BD0
|
||||
// (set) Token: 0x06001AB3 RID: 6835 RVA: 0x000629D8 File Offset: 0x00060BD8
|
||||
public int Index
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.gid;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.gid = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000829 RID: 2089
|
||||
// (get) Token: 0x06001AB4 RID: 6836 RVA: 0x000629E4 File Offset: 0x00060BE4
|
||||
// (set) Token: 0x06001AB5 RID: 6837 RVA: 0x000629EC File Offset: 0x00060BEC
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.name = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700082A RID: 2090
|
||||
// (get) Token: 0x06001AB6 RID: 6838 RVA: 0x000629F8 File Offset: 0x00060BF8
|
||||
public bool IsNamed
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.name != null;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001AB7 RID: 6839 RVA: 0x00062A08 File Offset: 0x00060C08
|
||||
public override void Compile(ICompiler cmp, bool reverse)
|
||||
{
|
||||
cmp.EmitOpen(this.gid);
|
||||
base.Compile(cmp, reverse);
|
||||
cmp.EmitClose(this.gid);
|
||||
}
|
||||
|
||||
// Token: 0x06001AB8 RID: 6840 RVA: 0x00062A38 File Offset: 0x00060C38
|
||||
public override bool IsComplex()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x06001AB9 RID: 6841 RVA: 0x00062A3C File Offset: 0x00060C3C
|
||||
public int CompareTo(object other)
|
||||
{
|
||||
return this.gid - ((CapturingGroup)other).gid;
|
||||
}
|
||||
|
||||
// Token: 0x040015B2 RID: 5554
|
||||
private int gid;
|
||||
|
||||
// Token: 0x040015B3 RID: 5555
|
||||
private string name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,234 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace System.Text.RegularExpressions.Syntax
|
||||
{
|
||||
// Token: 0x020002E9 RID: 745
|
||||
internal class CharacterClass : Expression
|
||||
{
|
||||
// Token: 0x06001B03 RID: 6915 RVA: 0x000634C4 File Offset: 0x000616C4
|
||||
public CharacterClass(bool negate, bool ignore)
|
||||
{
|
||||
this.negate = negate;
|
||||
this.ignore = ignore;
|
||||
this.intervals = new IntervalCollection();
|
||||
int num = 144;
|
||||
this.pos_cats = new BitArray(num);
|
||||
this.neg_cats = new BitArray(num);
|
||||
}
|
||||
|
||||
// Token: 0x06001B04 RID: 6916 RVA: 0x00063510 File Offset: 0x00061710
|
||||
public CharacterClass(Category cat, bool negate)
|
||||
: this(false, false)
|
||||
{
|
||||
this.AddCategory(cat, negate);
|
||||
}
|
||||
|
||||
// Token: 0x1700083D RID: 2109
|
||||
// (get) Token: 0x06001B06 RID: 6918 RVA: 0x00063534 File Offset: 0x00061734
|
||||
// (set) Token: 0x06001B07 RID: 6919 RVA: 0x0006353C File Offset: 0x0006173C
|
||||
public bool Negate
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.negate;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.negate = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700083E RID: 2110
|
||||
// (get) Token: 0x06001B08 RID: 6920 RVA: 0x00063548 File Offset: 0x00061748
|
||||
// (set) Token: 0x06001B09 RID: 6921 RVA: 0x00063550 File Offset: 0x00061750
|
||||
public bool IgnoreCase
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ignore;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.ignore = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001B0A RID: 6922 RVA: 0x0006355C File Offset: 0x0006175C
|
||||
public void AddCategory(Category cat, bool negate)
|
||||
{
|
||||
if (negate)
|
||||
{
|
||||
this.neg_cats[(int)cat] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.pos_cats[(int)cat] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001B0B RID: 6923 RVA: 0x00063590 File Offset: 0x00061790
|
||||
public void AddCharacter(char c)
|
||||
{
|
||||
this.AddRange(c, c);
|
||||
}
|
||||
|
||||
// Token: 0x06001B0C RID: 6924 RVA: 0x0006359C File Offset: 0x0006179C
|
||||
public void AddRange(char lo, char hi)
|
||||
{
|
||||
Interval interval = new Interval((int)lo, (int)hi);
|
||||
if (this.ignore)
|
||||
{
|
||||
if (CharacterClass.upper_case_characters.Intersects(interval))
|
||||
{
|
||||
Interval interval2;
|
||||
if (interval.low < CharacterClass.upper_case_characters.low)
|
||||
{
|
||||
interval2 = new Interval(CharacterClass.upper_case_characters.low + 32, interval.high + 32);
|
||||
interval.high = CharacterClass.upper_case_characters.low - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
interval2 = new Interval(interval.low + 32, CharacterClass.upper_case_characters.high + 32);
|
||||
interval.low = CharacterClass.upper_case_characters.high + 1;
|
||||
}
|
||||
this.intervals.Add(interval2);
|
||||
}
|
||||
else if (CharacterClass.upper_case_characters.Contains(interval))
|
||||
{
|
||||
interval.high += 32;
|
||||
interval.low += 32;
|
||||
}
|
||||
}
|
||||
this.intervals.Add(interval);
|
||||
}
|
||||
|
||||
// Token: 0x06001B0D RID: 6925 RVA: 0x00063698 File Offset: 0x00061898
|
||||
public override void Compile(ICompiler cmp, bool reverse)
|
||||
{
|
||||
IntervalCollection metaCollection = this.intervals.GetMetaCollection(new IntervalCollection.CostDelegate(CharacterClass.GetIntervalCost));
|
||||
int num = metaCollection.Count;
|
||||
for (int i = 0; i < this.pos_cats.Length; i++)
|
||||
{
|
||||
if (this.pos_cats[i] || this.neg_cats[i])
|
||||
{
|
||||
num++;
|
||||
}
|
||||
}
|
||||
if (num == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
LinkRef linkRef = cmp.NewLink();
|
||||
if (num > 1)
|
||||
{
|
||||
cmp.EmitIn(linkRef);
|
||||
}
|
||||
foreach (object obj in metaCollection)
|
||||
{
|
||||
Interval interval = (Interval)obj;
|
||||
if (interval.IsDiscontiguous)
|
||||
{
|
||||
BitArray bitArray = new BitArray(interval.Size);
|
||||
foreach (object obj2 in this.intervals)
|
||||
{
|
||||
Interval interval2 = (Interval)obj2;
|
||||
if (interval.Contains(interval2))
|
||||
{
|
||||
for (int j = interval2.low; j <= interval2.high; j++)
|
||||
{
|
||||
bitArray[j - interval.low] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
cmp.EmitSet((char)interval.low, bitArray, this.negate, this.ignore, reverse);
|
||||
}
|
||||
else if (interval.IsSingleton)
|
||||
{
|
||||
cmp.EmitCharacter((char)interval.low, this.negate, this.ignore, reverse);
|
||||
}
|
||||
else
|
||||
{
|
||||
cmp.EmitRange((char)interval.low, (char)interval.high, this.negate, this.ignore, reverse);
|
||||
}
|
||||
}
|
||||
for (int k = 0; k < this.pos_cats.Length; k++)
|
||||
{
|
||||
if (this.pos_cats[k])
|
||||
{
|
||||
if (this.neg_cats[k])
|
||||
{
|
||||
cmp.EmitCategory(Category.AnySingleline, this.negate, reverse);
|
||||
}
|
||||
else
|
||||
{
|
||||
cmp.EmitCategory((Category)k, this.negate, reverse);
|
||||
}
|
||||
}
|
||||
else if (this.neg_cats[k])
|
||||
{
|
||||
cmp.EmitNotCategory((Category)k, this.negate, reverse);
|
||||
}
|
||||
}
|
||||
if (num > 1)
|
||||
{
|
||||
if (this.negate)
|
||||
{
|
||||
cmp.EmitTrue();
|
||||
}
|
||||
else
|
||||
{
|
||||
cmp.EmitFalse();
|
||||
}
|
||||
cmp.ResolveLink(linkRef);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001B0E RID: 6926 RVA: 0x00063964 File Offset: 0x00061B64
|
||||
public override void GetWidth(out int min, out int max)
|
||||
{
|
||||
min = (max = 1);
|
||||
}
|
||||
|
||||
// Token: 0x06001B0F RID: 6927 RVA: 0x0006397C File Offset: 0x00061B7C
|
||||
public override bool IsComplex()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x06001B10 RID: 6928 RVA: 0x00063980 File Offset: 0x00061B80
|
||||
private static double GetIntervalCost(Interval i)
|
||||
{
|
||||
if (i.IsDiscontiguous)
|
||||
{
|
||||
return (double)(3 + (i.Size + 15 >> 4));
|
||||
}
|
||||
if (i.IsSingleton)
|
||||
{
|
||||
return 2.0;
|
||||
}
|
||||
return 3.0;
|
||||
}
|
||||
|
||||
// Token: 0x040015C4 RID: 5572
|
||||
private const int distance_between_upper_and_lower_case = 32;
|
||||
|
||||
// Token: 0x040015C5 RID: 5573
|
||||
private static Interval upper_case_characters = new Interval(65, 90);
|
||||
|
||||
// Token: 0x040015C6 RID: 5574
|
||||
private bool negate;
|
||||
|
||||
// Token: 0x040015C7 RID: 5575
|
||||
private bool ignore;
|
||||
|
||||
// Token: 0x040015C8 RID: 5576
|
||||
private BitArray pos_cats;
|
||||
|
||||
// Token: 0x040015C9 RID: 5577
|
||||
private BitArray neg_cats;
|
||||
|
||||
// Token: 0x040015CA RID: 5578
|
||||
private IntervalCollection intervals;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text.RegularExpressions.Syntax
|
||||
{
|
||||
// Token: 0x020002DA RID: 730
|
||||
internal abstract class CompositeExpression : Expression
|
||||
{
|
||||
// Token: 0x06001AA2 RID: 6818 RVA: 0x000623E8 File Offset: 0x000605E8
|
||||
public CompositeExpression()
|
||||
{
|
||||
this.expressions = new ExpressionCollection();
|
||||
}
|
||||
|
||||
// Token: 0x17000825 RID: 2085
|
||||
// (get) Token: 0x06001AA3 RID: 6819 RVA: 0x000623FC File Offset: 0x000605FC
|
||||
protected ExpressionCollection Expressions
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.expressions;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001AA4 RID: 6820 RVA: 0x00062404 File Offset: 0x00060604
|
||||
protected void GetWidth(out int min, out int max, int count)
|
||||
{
|
||||
min = int.MaxValue;
|
||||
max = 0;
|
||||
bool flag = true;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
Expression expression = this.Expressions[i];
|
||||
if (expression != null)
|
||||
{
|
||||
flag = false;
|
||||
int num;
|
||||
int num2;
|
||||
expression.GetWidth(out num, out num2);
|
||||
if (num < min)
|
||||
{
|
||||
min = num;
|
||||
}
|
||||
if (num2 > max)
|
||||
{
|
||||
max = num2;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
min = (max = 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001AA5 RID: 6821 RVA: 0x0006247C File Offset: 0x0006067C
|
||||
public override bool IsComplex()
|
||||
{
|
||||
foreach (object obj in this.Expressions)
|
||||
{
|
||||
Expression expression = (Expression)obj;
|
||||
if (expression.IsComplex())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return base.GetFixedWidth() <= 0;
|
||||
}
|
||||
|
||||
// Token: 0x040015B0 RID: 5552
|
||||
private ExpressionCollection expressions;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text.RegularExpressions.Syntax
|
||||
{
|
||||
// Token: 0x020002D9 RID: 729
|
||||
internal abstract class Expression
|
||||
{
|
||||
// Token: 0x06001A9D RID: 6813
|
||||
public abstract void Compile(ICompiler cmp, bool reverse);
|
||||
|
||||
// Token: 0x06001A9E RID: 6814
|
||||
public abstract void GetWidth(out int min, out int max);
|
||||
|
||||
// Token: 0x06001A9F RID: 6815 RVA: 0x000623B4 File Offset: 0x000605B4
|
||||
public int GetFixedWidth()
|
||||
{
|
||||
int num;
|
||||
int num2;
|
||||
this.GetWidth(out num, out num2);
|
||||
if (num == num2)
|
||||
{
|
||||
return num;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Token: 0x06001AA0 RID: 6816 RVA: 0x000623D8 File Offset: 0x000605D8
|
||||
public virtual AnchorInfo GetAnchorInfo(bool reverse)
|
||||
{
|
||||
return new AnchorInfo(this, this.GetFixedWidth());
|
||||
}
|
||||
|
||||
// Token: 0x06001AA1 RID: 6817
|
||||
public abstract bool IsComplex();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text.RegularExpressions.Syntax
|
||||
{
|
||||
// Token: 0x020002E3 RID: 739
|
||||
internal class ExpressionAssertion : Assertion
|
||||
{
|
||||
// Token: 0x06001AD9 RID: 6873 RVA: 0x00062FA4 File Offset: 0x000611A4
|
||||
public ExpressionAssertion()
|
||||
{
|
||||
base.Expressions.Add(null);
|
||||
}
|
||||
|
||||
// Token: 0x17000834 RID: 2100
|
||||
// (get) Token: 0x06001ADA RID: 6874 RVA: 0x00062FB8 File Offset: 0x000611B8
|
||||
// (set) Token: 0x06001ADB RID: 6875 RVA: 0x00062FC0 File Offset: 0x000611C0
|
||||
public bool Reverse
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.reverse;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.reverse = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000835 RID: 2101
|
||||
// (get) Token: 0x06001ADC RID: 6876 RVA: 0x00062FCC File Offset: 0x000611CC
|
||||
// (set) Token: 0x06001ADD RID: 6877 RVA: 0x00062FD4 File Offset: 0x000611D4
|
||||
public bool Negate
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.negate;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.negate = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000836 RID: 2102
|
||||
// (get) Token: 0x06001ADE RID: 6878 RVA: 0x00062FE0 File Offset: 0x000611E0
|
||||
// (set) Token: 0x06001ADF RID: 6879 RVA: 0x00062FF0 File Offset: 0x000611F0
|
||||
public Expression TestExpression
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Expressions[2];
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Expressions[2] = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001AE0 RID: 6880 RVA: 0x00063000 File Offset: 0x00061200
|
||||
public override void Compile(ICompiler cmp, bool reverse)
|
||||
{
|
||||
LinkRef linkRef = cmp.NewLink();
|
||||
LinkRef linkRef2 = cmp.NewLink();
|
||||
if (!this.negate)
|
||||
{
|
||||
cmp.EmitTest(linkRef, linkRef2);
|
||||
}
|
||||
else
|
||||
{
|
||||
cmp.EmitTest(linkRef2, linkRef);
|
||||
}
|
||||
this.TestExpression.Compile(cmp, this.reverse);
|
||||
cmp.EmitTrue();
|
||||
if (base.TrueExpression == null)
|
||||
{
|
||||
cmp.ResolveLink(linkRef2);
|
||||
cmp.EmitFalse();
|
||||
cmp.ResolveLink(linkRef);
|
||||
}
|
||||
else
|
||||
{
|
||||
cmp.ResolveLink(linkRef);
|
||||
base.TrueExpression.Compile(cmp, reverse);
|
||||
if (base.FalseExpression == null)
|
||||
{
|
||||
cmp.ResolveLink(linkRef2);
|
||||
}
|
||||
else
|
||||
{
|
||||
LinkRef linkRef3 = cmp.NewLink();
|
||||
cmp.EmitJump(linkRef3);
|
||||
cmp.ResolveLink(linkRef2);
|
||||
base.FalseExpression.Compile(cmp, reverse);
|
||||
cmp.ResolveLink(linkRef3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001AE1 RID: 6881 RVA: 0x000630CC File Offset: 0x000612CC
|
||||
public override bool IsComplex()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x040015BB RID: 5563
|
||||
private bool reverse;
|
||||
|
||||
// Token: 0x040015BC RID: 5564
|
||||
private bool negate;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace System.Text.RegularExpressions.Syntax
|
||||
{
|
||||
// Token: 0x020002D8 RID: 728
|
||||
internal class ExpressionCollection : CollectionBase
|
||||
{
|
||||
// Token: 0x06001A98 RID: 6808 RVA: 0x00062374 File Offset: 0x00060574
|
||||
public void Add(Expression e)
|
||||
{
|
||||
base.List.Add(e);
|
||||
}
|
||||
|
||||
// Token: 0x17000824 RID: 2084
|
||||
public Expression this[int i]
|
||||
{
|
||||
get
|
||||
{
|
||||
return (Expression)base.List[i];
|
||||
}
|
||||
set
|
||||
{
|
||||
base.List[i] = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001A9B RID: 6811 RVA: 0x000623A8 File Offset: 0x000605A8
|
||||
protected override void OnValidate(object o)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace System.Text.RegularExpressions.Syntax
|
||||
{
|
||||
// Token: 0x020002DB RID: 731
|
||||
internal class Group : CompositeExpression
|
||||
{
|
||||
// Token: 0x17000826 RID: 2086
|
||||
// (get) Token: 0x06001AA7 RID: 6823 RVA: 0x0006250C File Offset: 0x0006070C
|
||||
// (set) Token: 0x06001AA8 RID: 6824 RVA: 0x0006251C File Offset: 0x0006071C
|
||||
public Expression Expression
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Expressions[0];
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Expressions[0] = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001AA9 RID: 6825 RVA: 0x0006252C File Offset: 0x0006072C
|
||||
public void AppendExpression(Expression e)
|
||||
{
|
||||
base.Expressions.Add(e);
|
||||
}
|
||||
|
||||
// Token: 0x06001AAA RID: 6826 RVA: 0x0006253C File Offset: 0x0006073C
|
||||
public override void Compile(ICompiler cmp, bool reverse)
|
||||
{
|
||||
int count = base.Expressions.Count;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
Expression expression;
|
||||
if (reverse)
|
||||
{
|
||||
expression = base.Expressions[count - i - 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
expression = base.Expressions[i];
|
||||
}
|
||||
expression.Compile(cmp, reverse);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001AAB RID: 6827 RVA: 0x00062598 File Offset: 0x00060798
|
||||
public override void GetWidth(out int min, out int max)
|
||||
{
|
||||
min = 0;
|
||||
max = 0;
|
||||
foreach (object obj in base.Expressions)
|
||||
{
|
||||
Expression expression = (Expression)obj;
|
||||
int num;
|
||||
int num2;
|
||||
expression.GetWidth(out num, out num2);
|
||||
min += num;
|
||||
if (max == 2147483647 || num2 == 2147483647)
|
||||
{
|
||||
max = int.MaxValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
max += num2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001AAC RID: 6828 RVA: 0x00062644 File Offset: 0x00060844
|
||||
public override AnchorInfo GetAnchorInfo(bool reverse)
|
||||
{
|
||||
int fixedWidth = base.GetFixedWidth();
|
||||
ArrayList arrayList = new ArrayList();
|
||||
IntervalCollection intervalCollection = new IntervalCollection();
|
||||
int num = 0;
|
||||
int count = base.Expressions.Count;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
Expression expression;
|
||||
if (reverse)
|
||||
{
|
||||
expression = base.Expressions[count - i - 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
expression = base.Expressions[i];
|
||||
}
|
||||
AnchorInfo anchorInfo = expression.GetAnchorInfo(reverse);
|
||||
arrayList.Add(anchorInfo);
|
||||
if (anchorInfo.IsPosition)
|
||||
{
|
||||
return new AnchorInfo(this, num + anchorInfo.Offset, fixedWidth, anchorInfo.Position);
|
||||
}
|
||||
if (anchorInfo.IsSubstring)
|
||||
{
|
||||
intervalCollection.Add(anchorInfo.GetInterval(num));
|
||||
}
|
||||
if (anchorInfo.IsUnknownWidth)
|
||||
{
|
||||
break;
|
||||
}
|
||||
num += anchorInfo.Width;
|
||||
}
|
||||
intervalCollection.Normalize();
|
||||
Interval interval = Interval.Empty;
|
||||
foreach (object obj in intervalCollection)
|
||||
{
|
||||
Interval interval2 = (Interval)obj;
|
||||
if (interval2.Size > interval.Size)
|
||||
{
|
||||
interval = interval2;
|
||||
}
|
||||
}
|
||||
if (interval.IsEmpty)
|
||||
{
|
||||
return new AnchorInfo(this, fixedWidth);
|
||||
}
|
||||
bool flag = false;
|
||||
int num2 = 0;
|
||||
num = 0;
|
||||
for (int j = 0; j < arrayList.Count; j++)
|
||||
{
|
||||
AnchorInfo anchorInfo2 = (AnchorInfo)arrayList[j];
|
||||
if (anchorInfo2.IsSubstring && interval.Contains(anchorInfo2.GetInterval(num)))
|
||||
{
|
||||
flag |= anchorInfo2.IgnoreCase;
|
||||
arrayList[num2++] = anchorInfo2;
|
||||
}
|
||||
if (anchorInfo2.IsUnknownWidth)
|
||||
{
|
||||
break;
|
||||
}
|
||||
num += anchorInfo2.Width;
|
||||
}
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (int k = 0; k < num2; k++)
|
||||
{
|
||||
AnchorInfo anchorInfo3;
|
||||
if (reverse)
|
||||
{
|
||||
anchorInfo3 = (AnchorInfo)arrayList[num2 - k - 1];
|
||||
}
|
||||
else
|
||||
{
|
||||
anchorInfo3 = (AnchorInfo)arrayList[k];
|
||||
}
|
||||
stringBuilder.Append(anchorInfo3.Substring);
|
||||
}
|
||||
if (stringBuilder.Length == interval.Size)
|
||||
{
|
||||
return new AnchorInfo(this, interval.low, fixedWidth, stringBuilder.ToString(), flag);
|
||||
}
|
||||
if (stringBuilder.Length > interval.Size)
|
||||
{
|
||||
Console.Error.WriteLine("overlapping?");
|
||||
return new AnchorInfo(this, fixedWidth);
|
||||
}
|
||||
throw new SystemException("Shouldn't happen");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text.RegularExpressions.Syntax
|
||||
{
|
||||
// Token: 0x020002E5 RID: 741
|
||||
internal class Literal : Expression
|
||||
{
|
||||
// Token: 0x06001AE7 RID: 6887 RVA: 0x000631C0 File Offset: 0x000613C0
|
||||
public Literal(string str, bool ignore)
|
||||
{
|
||||
this.str = str;
|
||||
this.ignore = ignore;
|
||||
}
|
||||
|
||||
// Token: 0x17000838 RID: 2104
|
||||
// (get) Token: 0x06001AE8 RID: 6888 RVA: 0x000631D8 File Offset: 0x000613D8
|
||||
// (set) Token: 0x06001AE9 RID: 6889 RVA: 0x000631E0 File Offset: 0x000613E0
|
||||
public string String
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.str;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.str = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000839 RID: 2105
|
||||
// (get) Token: 0x06001AEA RID: 6890 RVA: 0x000631EC File Offset: 0x000613EC
|
||||
// (set) Token: 0x06001AEB RID: 6891 RVA: 0x000631F4 File Offset: 0x000613F4
|
||||
public bool IgnoreCase
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ignore;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.ignore = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001AEC RID: 6892 RVA: 0x00063200 File Offset: 0x00061400
|
||||
public static void CompileLiteral(string str, ICompiler cmp, bool ignore, bool reverse)
|
||||
{
|
||||
if (str.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (str.Length == 1)
|
||||
{
|
||||
cmp.EmitCharacter(str[0], false, ignore, reverse);
|
||||
}
|
||||
else
|
||||
{
|
||||
cmp.EmitString(str, ignore, reverse);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001AED RID: 6893 RVA: 0x00063244 File Offset: 0x00061444
|
||||
public override void Compile(ICompiler cmp, bool reverse)
|
||||
{
|
||||
Literal.CompileLiteral(this.str, cmp, this.ignore, reverse);
|
||||
}
|
||||
|
||||
// Token: 0x06001AEE RID: 6894 RVA: 0x0006325C File Offset: 0x0006145C
|
||||
public override void GetWidth(out int min, out int max)
|
||||
{
|
||||
min = (max = this.str.Length);
|
||||
}
|
||||
|
||||
// Token: 0x06001AEF RID: 6895 RVA: 0x0006327C File Offset: 0x0006147C
|
||||
public override AnchorInfo GetAnchorInfo(bool reverse)
|
||||
{
|
||||
return new AnchorInfo(this, 0, this.str.Length, this.str, this.ignore);
|
||||
}
|
||||
|
||||
// Token: 0x06001AF0 RID: 6896 RVA: 0x0006329C File Offset: 0x0006149C
|
||||
public override bool IsComplex()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x040015BD RID: 5565
|
||||
private string str;
|
||||
|
||||
// Token: 0x040015BE RID: 5566
|
||||
private bool ignore;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text.RegularExpressions.Syntax
|
||||
{
|
||||
// Token: 0x020002DF RID: 735
|
||||
internal class NonBacktrackingGroup : Group
|
||||
{
|
||||
// Token: 0x06001ABF RID: 6847 RVA: 0x00062B0C File Offset: 0x00060D0C
|
||||
public override void Compile(ICompiler cmp, bool reverse)
|
||||
{
|
||||
LinkRef linkRef = cmp.NewLink();
|
||||
cmp.EmitSub(linkRef);
|
||||
base.Compile(cmp, reverse);
|
||||
cmp.EmitTrue();
|
||||
cmp.ResolveLink(linkRef);
|
||||
}
|
||||
|
||||
// Token: 0x06001AC0 RID: 6848 RVA: 0x00062B3C File Offset: 0x00060D3C
|
||||
public override bool IsComplex()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,1519 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
|
||||
namespace System.Text.RegularExpressions.Syntax
|
||||
{
|
||||
// Token: 0x020002D5 RID: 725
|
||||
internal class Parser
|
||||
{
|
||||
// Token: 0x06001A61 RID: 6753 RVA: 0x0005F7D0 File Offset: 0x0005D9D0
|
||||
public Parser()
|
||||
{
|
||||
this.caps = new ArrayList();
|
||||
this.refs = new Hashtable();
|
||||
}
|
||||
|
||||
// Token: 0x06001A62 RID: 6754 RVA: 0x0005F7F0 File Offset: 0x0005D9F0
|
||||
public static int ParseDecimal(string str, ref int ptr)
|
||||
{
|
||||
return Parser.ParseNumber(str, ref ptr, 10, 1, int.MaxValue);
|
||||
}
|
||||
|
||||
// Token: 0x06001A63 RID: 6755 RVA: 0x0005F804 File Offset: 0x0005DA04
|
||||
public static int ParseOctal(string str, ref int ptr)
|
||||
{
|
||||
return Parser.ParseNumber(str, ref ptr, 8, 1, 3);
|
||||
}
|
||||
|
||||
// Token: 0x06001A64 RID: 6756 RVA: 0x0005F810 File Offset: 0x0005DA10
|
||||
public static int ParseHex(string str, ref int ptr, int digits)
|
||||
{
|
||||
return Parser.ParseNumber(str, ref ptr, 16, digits, digits);
|
||||
}
|
||||
|
||||
// Token: 0x06001A65 RID: 6757 RVA: 0x0005F820 File Offset: 0x0005DA20
|
||||
public static int ParseNumber(string str, ref int ptr, int b, int min, int max)
|
||||
{
|
||||
int num = ptr;
|
||||
int num2 = 0;
|
||||
int num3 = 0;
|
||||
if (max < min)
|
||||
{
|
||||
max = int.MaxValue;
|
||||
}
|
||||
while (num3 < max && num < str.Length)
|
||||
{
|
||||
int num4 = Parser.ParseDigit(str[num++], b, num3);
|
||||
if (num4 < 0)
|
||||
{
|
||||
num--;
|
||||
break;
|
||||
}
|
||||
num2 = num2 * b + num4;
|
||||
num3++;
|
||||
}
|
||||
if (num3 < min)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
ptr = num;
|
||||
return num2;
|
||||
}
|
||||
|
||||
// Token: 0x06001A66 RID: 6758 RVA: 0x0005F898 File Offset: 0x0005DA98
|
||||
public static string ParseName(string str, ref int ptr)
|
||||
{
|
||||
if (char.IsDigit(str[ptr]))
|
||||
{
|
||||
int num = Parser.ParseNumber(str, ref ptr, 10, 1, 0);
|
||||
if (num > 0)
|
||||
{
|
||||
return num.ToString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
int num2 = ptr;
|
||||
while (Parser.IsNameChar(str[ptr]))
|
||||
{
|
||||
ptr++;
|
||||
}
|
||||
if (ptr - num2 > 0)
|
||||
{
|
||||
return str.Substring(num2, ptr - num2);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001A67 RID: 6759 RVA: 0x0005F918 File Offset: 0x0005DB18
|
||||
public static string Escape(string str)
|
||||
{
|
||||
string text = string.Empty;
|
||||
int i = 0;
|
||||
while (i < str.Length)
|
||||
{
|
||||
char c = str[i];
|
||||
char c2 = c;
|
||||
switch (c2)
|
||||
{
|
||||
case ' ':
|
||||
case '#':
|
||||
case '$':
|
||||
case '(':
|
||||
case ')':
|
||||
case '*':
|
||||
case '+':
|
||||
case '.':
|
||||
goto IL_AF;
|
||||
default:
|
||||
switch (c2)
|
||||
{
|
||||
case '\t':
|
||||
text += "\\t";
|
||||
break;
|
||||
case '\n':
|
||||
text += "\\n";
|
||||
break;
|
||||
default:
|
||||
switch (c2)
|
||||
{
|
||||
case '[':
|
||||
case '\\':
|
||||
case '^':
|
||||
goto IL_AF;
|
||||
default:
|
||||
if (c2 == '{' || c2 == '|' || c2 == '?')
|
||||
{
|
||||
goto IL_AF;
|
||||
}
|
||||
text += c;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case '\f':
|
||||
text += "\\f";
|
||||
break;
|
||||
case '\r':
|
||||
text += "\\r";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
IL_11C:
|
||||
i++;
|
||||
continue;
|
||||
IL_AF:
|
||||
text = text + "\\" + c;
|
||||
goto IL_11C;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
// Token: 0x06001A68 RID: 6760 RVA: 0x0005FA54 File Offset: 0x0005DC54
|
||||
public static string Unescape(string str)
|
||||
{
|
||||
if (str.IndexOf('\\') == -1)
|
||||
{
|
||||
return str;
|
||||
}
|
||||
return new Parser().ParseString(str);
|
||||
}
|
||||
|
||||
// Token: 0x06001A69 RID: 6761 RVA: 0x0005FA74 File Offset: 0x0005DC74
|
||||
public RegularExpression ParseRegularExpression(string pattern, RegexOptions options)
|
||||
{
|
||||
this.pattern = pattern;
|
||||
this.ptr = 0;
|
||||
this.caps.Clear();
|
||||
this.refs.Clear();
|
||||
this.num_groups = 0;
|
||||
RegularExpression regularExpression2;
|
||||
try
|
||||
{
|
||||
RegularExpression regularExpression = new RegularExpression();
|
||||
this.ParseGroup(regularExpression, options, null);
|
||||
this.ResolveReferences();
|
||||
regularExpression.GroupCount = this.num_groups;
|
||||
regularExpression2 = regularExpression;
|
||||
}
|
||||
catch (IndexOutOfRangeException)
|
||||
{
|
||||
throw this.NewParseException("Unexpected end of pattern.");
|
||||
}
|
||||
return regularExpression2;
|
||||
}
|
||||
|
||||
// Token: 0x06001A6A RID: 6762 RVA: 0x0005FB08 File Offset: 0x0005DD08
|
||||
public int GetMapping(Hashtable mapping)
|
||||
{
|
||||
int count = this.caps.Count;
|
||||
mapping.Add("0", 0);
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
CapturingGroup capturingGroup = (CapturingGroup)this.caps[i];
|
||||
string text = ((capturingGroup.Name == null) ? capturingGroup.Index.ToString() : capturingGroup.Name);
|
||||
if (mapping.Contains(text))
|
||||
{
|
||||
if ((int)mapping[text] != capturingGroup.Index)
|
||||
{
|
||||
throw new SystemException("invalid state");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
mapping.Add(text, capturingGroup.Index);
|
||||
}
|
||||
}
|
||||
return this.gap;
|
||||
}
|
||||
|
||||
// Token: 0x06001A6B RID: 6763 RVA: 0x0005FBC8 File Offset: 0x0005DDC8
|
||||
private void ParseGroup(Group group, RegexOptions options, Assertion assertion)
|
||||
{
|
||||
bool flag = group is RegularExpression;
|
||||
Alternation alternation = null;
|
||||
string text = null;
|
||||
Group group2 = new Group();
|
||||
Expression expression = null;
|
||||
bool flag2 = false;
|
||||
do
|
||||
{
|
||||
this.ConsumeWhitespace(Parser.IsIgnorePatternWhitespace(options));
|
||||
if (this.ptr >= this.pattern.Length)
|
||||
{
|
||||
break;
|
||||
}
|
||||
char c = this.pattern[this.ptr++];
|
||||
char c2 = c;
|
||||
switch (c2)
|
||||
{
|
||||
case '$':
|
||||
{
|
||||
Position position = ((!Parser.IsMultiline(options)) ? Position.End : Position.EndOfLine);
|
||||
expression = new PositionAssertion(position);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
switch (c2)
|
||||
{
|
||||
case '[':
|
||||
expression = this.ParseCharacterClass(options);
|
||||
break;
|
||||
case '\\':
|
||||
{
|
||||
int num = this.ParseEscape();
|
||||
if (num >= 0)
|
||||
{
|
||||
c = (char)num;
|
||||
}
|
||||
else
|
||||
{
|
||||
expression = this.ParseSpecial(options);
|
||||
if (expression == null)
|
||||
{
|
||||
c = this.pattern[this.ptr++];
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
if (c2 == '?')
|
||||
{
|
||||
goto IL_25F;
|
||||
}
|
||||
if (c2 == '|')
|
||||
{
|
||||
if (text != null)
|
||||
{
|
||||
group2.AppendExpression(new Literal(text, Parser.IsIgnoreCase(options)));
|
||||
text = null;
|
||||
}
|
||||
if (assertion != null)
|
||||
{
|
||||
if (assertion.TrueExpression == null)
|
||||
{
|
||||
assertion.TrueExpression = group2;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (assertion.FalseExpression != null)
|
||||
{
|
||||
goto IL_230;
|
||||
}
|
||||
assertion.FalseExpression = group2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (alternation == null)
|
||||
{
|
||||
alternation = new Alternation();
|
||||
}
|
||||
alternation.AddAlternative(group2);
|
||||
}
|
||||
group2 = new Group();
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case '^':
|
||||
{
|
||||
Position position2 = ((!Parser.IsMultiline(options)) ? Position.Start : Position.StartOfLine);
|
||||
expression = new PositionAssertion(position2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case '(':
|
||||
{
|
||||
bool flag3 = Parser.IsIgnoreCase(options);
|
||||
expression = this.ParseGroupingConstruct(ref options);
|
||||
if (expression == null)
|
||||
{
|
||||
if (text != null && Parser.IsIgnoreCase(options) != flag3)
|
||||
{
|
||||
group2.AppendExpression(new Literal(text, Parser.IsIgnoreCase(options)));
|
||||
text = null;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ')':
|
||||
goto IL_1DA;
|
||||
case '*':
|
||||
case '+':
|
||||
goto IL_25F;
|
||||
case '.':
|
||||
{
|
||||
Category category = ((!Parser.IsSingleline(options)) ? Category.Any : Category.AnySingleline);
|
||||
expression = new CharacterClass(category, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.ConsumeWhitespace(Parser.IsIgnorePatternWhitespace(options));
|
||||
if (this.ptr < this.pattern.Length)
|
||||
{
|
||||
char c3 = this.pattern[this.ptr];
|
||||
int num2 = 0;
|
||||
int num3 = 0;
|
||||
bool flag4 = false;
|
||||
bool flag5 = false;
|
||||
if (c3 == '?' || c3 == '*' || c3 == '+')
|
||||
{
|
||||
this.ptr++;
|
||||
flag5 = true;
|
||||
c2 = c3;
|
||||
if (c2 != '*')
|
||||
{
|
||||
if (c2 != '+')
|
||||
{
|
||||
if (c2 == '?')
|
||||
{
|
||||
num2 = 0;
|
||||
num3 = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
num2 = 1;
|
||||
num3 = int.MaxValue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
num2 = 0;
|
||||
num3 = int.MaxValue;
|
||||
}
|
||||
}
|
||||
else if (c3 == '{' && this.ptr + 1 < this.pattern.Length)
|
||||
{
|
||||
int num4 = this.ptr;
|
||||
this.ptr++;
|
||||
flag5 = this.ParseRepetitionBounds(out num2, out num3, options);
|
||||
if (!flag5)
|
||||
{
|
||||
this.ptr = num4;
|
||||
}
|
||||
}
|
||||
if (flag5)
|
||||
{
|
||||
this.ConsumeWhitespace(Parser.IsIgnorePatternWhitespace(options));
|
||||
if (this.ptr < this.pattern.Length && this.pattern[this.ptr] == '?')
|
||||
{
|
||||
this.ptr++;
|
||||
flag4 = true;
|
||||
}
|
||||
Repetition repetition = new Repetition(num2, num3, flag4);
|
||||
if (expression == null)
|
||||
{
|
||||
repetition.Expression = new Literal(c.ToString(), Parser.IsIgnoreCase(options));
|
||||
}
|
||||
else
|
||||
{
|
||||
repetition.Expression = expression;
|
||||
}
|
||||
expression = repetition;
|
||||
}
|
||||
}
|
||||
if (expression == null)
|
||||
{
|
||||
if (text == null)
|
||||
{
|
||||
text = string.Empty;
|
||||
}
|
||||
text += c;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (text != null)
|
||||
{
|
||||
group2.AppendExpression(new Literal(text, Parser.IsIgnoreCase(options)));
|
||||
text = null;
|
||||
}
|
||||
group2.AppendExpression(expression);
|
||||
expression = null;
|
||||
}
|
||||
}
|
||||
while (!flag || this.ptr < this.pattern.Length);
|
||||
goto IL_484;
|
||||
IL_1DA:
|
||||
flag2 = true;
|
||||
goto IL_484;
|
||||
IL_230:
|
||||
throw this.NewParseException("Too many | in (?()|).");
|
||||
IL_25F:
|
||||
throw this.NewParseException("Bad quantifier.");
|
||||
IL_484:
|
||||
if (flag && flag2)
|
||||
{
|
||||
throw this.NewParseException("Too many )'s.");
|
||||
}
|
||||
if (!flag && !flag2)
|
||||
{
|
||||
throw this.NewParseException("Not enough )'s.");
|
||||
}
|
||||
if (text != null)
|
||||
{
|
||||
group2.AppendExpression(new Literal(text, Parser.IsIgnoreCase(options)));
|
||||
}
|
||||
if (assertion != null)
|
||||
{
|
||||
if (assertion.TrueExpression == null)
|
||||
{
|
||||
assertion.TrueExpression = group2;
|
||||
}
|
||||
else
|
||||
{
|
||||
assertion.FalseExpression = group2;
|
||||
}
|
||||
group.AppendExpression(assertion);
|
||||
}
|
||||
else if (alternation != null)
|
||||
{
|
||||
alternation.AddAlternative(group2);
|
||||
group.AppendExpression(alternation);
|
||||
}
|
||||
else
|
||||
{
|
||||
group.AppendExpression(group2);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001A6C RID: 6764 RVA: 0x000600F4 File Offset: 0x0005E2F4
|
||||
private Expression ParseGroupingConstruct(ref RegexOptions options)
|
||||
{
|
||||
if (this.pattern[this.ptr] != '?')
|
||||
{
|
||||
Group group;
|
||||
if (Parser.IsExplicitCapture(options))
|
||||
{
|
||||
group = new Group();
|
||||
}
|
||||
else
|
||||
{
|
||||
group = new CapturingGroup();
|
||||
this.caps.Add(group);
|
||||
}
|
||||
this.ParseGroup(group, options, null);
|
||||
return group;
|
||||
}
|
||||
this.ptr++;
|
||||
char c = this.pattern[this.ptr];
|
||||
switch (c)
|
||||
{
|
||||
case '!':
|
||||
break;
|
||||
default:
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case 'i':
|
||||
case 'm':
|
||||
case 'n':
|
||||
break;
|
||||
default:
|
||||
switch (c)
|
||||
{
|
||||
case ':':
|
||||
{
|
||||
this.ptr++;
|
||||
Group group2 = new Group();
|
||||
this.ParseGroup(group2, options, null);
|
||||
return group2;
|
||||
}
|
||||
default:
|
||||
if (c != '-' && c != 's' && c != 'x')
|
||||
{
|
||||
throw this.NewParseException("Bad grouping construct.");
|
||||
}
|
||||
break;
|
||||
case '<':
|
||||
case '=':
|
||||
goto IL_1E5;
|
||||
case '>':
|
||||
{
|
||||
this.ptr++;
|
||||
Group group3 = new NonBacktrackingGroup();
|
||||
this.ParseGroup(group3, options, null);
|
||||
return group3;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
RegexOptions regexOptions = options;
|
||||
this.ParseOptions(ref regexOptions, false);
|
||||
if (this.pattern[this.ptr] == '-')
|
||||
{
|
||||
this.ptr++;
|
||||
this.ParseOptions(ref regexOptions, true);
|
||||
}
|
||||
if (this.pattern[this.ptr] == ':')
|
||||
{
|
||||
this.ptr++;
|
||||
Group group4 = new Group();
|
||||
this.ParseGroup(group4, regexOptions, null);
|
||||
return group4;
|
||||
}
|
||||
if (this.pattern[this.ptr] == ')')
|
||||
{
|
||||
this.ptr++;
|
||||
options = regexOptions;
|
||||
return null;
|
||||
}
|
||||
throw this.NewParseException("Bad options");
|
||||
}
|
||||
case '#':
|
||||
this.ptr++;
|
||||
while (this.pattern[this.ptr++] != ')')
|
||||
{
|
||||
if (this.ptr >= this.pattern.Length)
|
||||
{
|
||||
throw this.NewParseException("Unterminated (?#...) comment.");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
case '\'':
|
||||
goto IL_21C;
|
||||
case '(':
|
||||
{
|
||||
this.ptr++;
|
||||
int num = this.ptr;
|
||||
string text = this.ParseName();
|
||||
Assertion assertion;
|
||||
if (text == null || this.pattern[this.ptr] != ')')
|
||||
{
|
||||
this.ptr = num;
|
||||
ExpressionAssertion expressionAssertion = new ExpressionAssertion();
|
||||
if (this.pattern[this.ptr] == '?')
|
||||
{
|
||||
this.ptr++;
|
||||
if (!this.ParseAssertionType(expressionAssertion))
|
||||
{
|
||||
throw this.NewParseException("Bad conditional.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
expressionAssertion.Negate = false;
|
||||
expressionAssertion.Reverse = false;
|
||||
}
|
||||
Group group5 = new Group();
|
||||
this.ParseGroup(group5, options, null);
|
||||
expressionAssertion.TestExpression = group5;
|
||||
assertion = expressionAssertion;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ptr++;
|
||||
assertion = new CaptureAssertion(new Literal(text, Parser.IsIgnoreCase(options)));
|
||||
this.refs.Add(assertion, text);
|
||||
}
|
||||
Group group6 = new Group();
|
||||
this.ParseGroup(group6, options, assertion);
|
||||
return group6;
|
||||
}
|
||||
}
|
||||
IL_1E5:
|
||||
ExpressionAssertion expressionAssertion2 = new ExpressionAssertion();
|
||||
if (this.ParseAssertionType(expressionAssertion2))
|
||||
{
|
||||
Group group7 = new Group();
|
||||
this.ParseGroup(group7, options, null);
|
||||
expressionAssertion2.TestExpression = group7;
|
||||
return expressionAssertion2;
|
||||
}
|
||||
IL_21C:
|
||||
char c2;
|
||||
if (this.pattern[this.ptr] == '<')
|
||||
{
|
||||
c2 = '>';
|
||||
}
|
||||
else
|
||||
{
|
||||
c2 = '\'';
|
||||
}
|
||||
this.ptr++;
|
||||
string text2 = this.ParseName();
|
||||
if (this.pattern[this.ptr] == c2)
|
||||
{
|
||||
if (text2 == null)
|
||||
{
|
||||
throw this.NewParseException("Bad group name.");
|
||||
}
|
||||
this.ptr++;
|
||||
CapturingGroup capturingGroup = new CapturingGroup();
|
||||
capturingGroup.Name = text2;
|
||||
this.caps.Add(capturingGroup);
|
||||
this.ParseGroup(capturingGroup, options, null);
|
||||
return capturingGroup;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.pattern[this.ptr] != '-')
|
||||
{
|
||||
throw this.NewParseException("Bad group name.");
|
||||
}
|
||||
this.ptr++;
|
||||
string text3 = this.ParseName();
|
||||
if (text3 == null || this.pattern[this.ptr] != c2)
|
||||
{
|
||||
throw this.NewParseException("Bad balancing group name.");
|
||||
}
|
||||
this.ptr++;
|
||||
BalancingGroup balancingGroup = new BalancingGroup();
|
||||
balancingGroup.Name = text2;
|
||||
if (balancingGroup.IsNamed)
|
||||
{
|
||||
this.caps.Add(balancingGroup);
|
||||
}
|
||||
this.refs.Add(balancingGroup, text3);
|
||||
this.ParseGroup(balancingGroup, options, null);
|
||||
return balancingGroup;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001A6D RID: 6765 RVA: 0x000605EC File Offset: 0x0005E7EC
|
||||
private bool ParseAssertionType(ExpressionAssertion assertion)
|
||||
{
|
||||
if (this.pattern[this.ptr] == '<')
|
||||
{
|
||||
char c = this.pattern[this.ptr + 1];
|
||||
if (c != '!')
|
||||
{
|
||||
if (c != '=')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
assertion.Negate = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
assertion.Negate = true;
|
||||
}
|
||||
assertion.Reverse = true;
|
||||
this.ptr += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
char c = this.pattern[this.ptr];
|
||||
if (c != '!')
|
||||
{
|
||||
if (c != '=')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
assertion.Negate = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
assertion.Negate = true;
|
||||
}
|
||||
assertion.Reverse = false;
|
||||
this.ptr++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x06001A6E RID: 6766 RVA: 0x000606C8 File Offset: 0x0005E8C8
|
||||
private void ParseOptions(ref RegexOptions options, bool negate)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
char c = this.pattern[this.ptr];
|
||||
switch (c)
|
||||
{
|
||||
case 'i':
|
||||
if (negate)
|
||||
{
|
||||
options &= ~RegexOptions.IgnoreCase;
|
||||
}
|
||||
else
|
||||
{
|
||||
options |= RegexOptions.IgnoreCase;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if (c != 's')
|
||||
{
|
||||
if (c != 'x')
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (negate)
|
||||
{
|
||||
options &= ~RegexOptions.IgnorePatternWhitespace;
|
||||
}
|
||||
else
|
||||
{
|
||||
options |= RegexOptions.IgnorePatternWhitespace;
|
||||
}
|
||||
}
|
||||
else if (negate)
|
||||
{
|
||||
options &= ~RegexOptions.Singleline;
|
||||
}
|
||||
else
|
||||
{
|
||||
options |= RegexOptions.Singleline;
|
||||
}
|
||||
break;
|
||||
case 'm':
|
||||
if (negate)
|
||||
{
|
||||
options &= ~RegexOptions.Multiline;
|
||||
}
|
||||
else
|
||||
{
|
||||
options |= RegexOptions.Multiline;
|
||||
}
|
||||
break;
|
||||
case 'n':
|
||||
if (negate)
|
||||
{
|
||||
options &= ~RegexOptions.ExplicitCapture;
|
||||
}
|
||||
else
|
||||
{
|
||||
options |= RegexOptions.ExplicitCapture;
|
||||
}
|
||||
break;
|
||||
}
|
||||
this.ptr++;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001A6F RID: 6767 RVA: 0x000607C8 File Offset: 0x0005E9C8
|
||||
private Expression ParseCharacterClass(RegexOptions options)
|
||||
{
|
||||
bool flag = false;
|
||||
if (this.pattern[this.ptr] == '^')
|
||||
{
|
||||
flag = true;
|
||||
this.ptr++;
|
||||
}
|
||||
bool flag2 = Parser.IsECMAScript(options);
|
||||
CharacterClass characterClass = new CharacterClass(flag, Parser.IsIgnoreCase(options));
|
||||
if (this.pattern[this.ptr] == ']')
|
||||
{
|
||||
characterClass.AddCharacter(']');
|
||||
this.ptr++;
|
||||
}
|
||||
int num = -1;
|
||||
bool flag3 = false;
|
||||
bool flag4 = false;
|
||||
while (this.ptr < this.pattern.Length)
|
||||
{
|
||||
int num2 = (int)this.pattern[this.ptr++];
|
||||
if (num2 == 93)
|
||||
{
|
||||
flag4 = true;
|
||||
break;
|
||||
}
|
||||
if (num2 == 45 && num >= 0 && !flag3)
|
||||
{
|
||||
flag3 = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (num2 == 92)
|
||||
{
|
||||
num2 = this.ParseEscape();
|
||||
if (num2 < 0)
|
||||
{
|
||||
num2 = (int)this.pattern[this.ptr++];
|
||||
int num3 = num2;
|
||||
switch (num3)
|
||||
{
|
||||
case 80:
|
||||
goto IL_1D1;
|
||||
default:
|
||||
switch (num3)
|
||||
{
|
||||
case 112:
|
||||
goto IL_1D1;
|
||||
default:
|
||||
switch (num3)
|
||||
{
|
||||
case 98:
|
||||
num2 = 8;
|
||||
goto IL_212;
|
||||
default:
|
||||
if (num3 != 68)
|
||||
{
|
||||
if (num3 != 87 && num3 != 119)
|
||||
{
|
||||
goto IL_212;
|
||||
}
|
||||
characterClass.AddCategory((!flag2) ? Category.Word : Category.EcmaWord, num2 == 87);
|
||||
goto IL_1EC;
|
||||
}
|
||||
break;
|
||||
case 100:
|
||||
break;
|
||||
}
|
||||
characterClass.AddCategory((!flag2) ? Category.Digit : Category.EcmaDigit, num2 == 68);
|
||||
break;
|
||||
case 115:
|
||||
goto IL_1B3;
|
||||
}
|
||||
break;
|
||||
case 83:
|
||||
goto IL_1B3;
|
||||
}
|
||||
IL_1EC:
|
||||
if (flag3)
|
||||
{
|
||||
throw this.NewParseException("character range cannot have category \\" + num2);
|
||||
}
|
||||
num = -1;
|
||||
continue;
|
||||
IL_1B3:
|
||||
characterClass.AddCategory((!flag2) ? Category.WhiteSpace : Category.EcmaWhiteSpace, num2 == 83);
|
||||
goto IL_1EC;
|
||||
IL_1D1:
|
||||
characterClass.AddCategory(this.ParseUnicodeCategory(), num2 == 80);
|
||||
goto IL_1EC;
|
||||
}
|
||||
}
|
||||
IL_212:
|
||||
if (flag3)
|
||||
{
|
||||
if (num2 < num)
|
||||
{
|
||||
throw this.NewParseException(string.Concat(new object[] { "[", num, "-", num2, "] range in reverse order." }));
|
||||
}
|
||||
characterClass.AddRange((char)num, (char)num2);
|
||||
num = -1;
|
||||
flag3 = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
characterClass.AddCharacter((char)num2);
|
||||
num = num2;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!flag4)
|
||||
{
|
||||
throw this.NewParseException("Unterminated [] set.");
|
||||
}
|
||||
if (flag3)
|
||||
{
|
||||
characterClass.AddCharacter('-');
|
||||
}
|
||||
return characterClass;
|
||||
}
|
||||
|
||||
// Token: 0x06001A70 RID: 6768 RVA: 0x00060A90 File Offset: 0x0005EC90
|
||||
private bool ParseRepetitionBounds(out int min, out int max, RegexOptions options)
|
||||
{
|
||||
min = (max = 0);
|
||||
this.ConsumeWhitespace(Parser.IsIgnorePatternWhitespace(options));
|
||||
int num;
|
||||
if (this.pattern[this.ptr] == ',')
|
||||
{
|
||||
num = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
num = this.ParseNumber(10, 1, 0);
|
||||
this.ConsumeWhitespace(Parser.IsIgnorePatternWhitespace(options));
|
||||
}
|
||||
char c = this.pattern[this.ptr++];
|
||||
int num2;
|
||||
if (c != ',')
|
||||
{
|
||||
if (c != '}')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
num2 = num;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ConsumeWhitespace(Parser.IsIgnorePatternWhitespace(options));
|
||||
num2 = this.ParseNumber(10, 1, 0);
|
||||
this.ConsumeWhitespace(Parser.IsIgnorePatternWhitespace(options));
|
||||
if (this.pattern[this.ptr++] != '}')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (num > 2147483647 || num2 > 2147483647)
|
||||
{
|
||||
throw this.NewParseException("Illegal {x, y} - maximum of 2147483647.");
|
||||
}
|
||||
if (num2 >= 0 && num2 < num)
|
||||
{
|
||||
throw this.NewParseException("Illegal {x, y} with x > y.");
|
||||
}
|
||||
min = num;
|
||||
if (num2 > 0)
|
||||
{
|
||||
max = num2;
|
||||
}
|
||||
else
|
||||
{
|
||||
max = int.MaxValue;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x06001A71 RID: 6769 RVA: 0x00060BC8 File Offset: 0x0005EDC8
|
||||
private Category ParseUnicodeCategory()
|
||||
{
|
||||
if (this.pattern[this.ptr++] != '{')
|
||||
{
|
||||
throw this.NewParseException("Incomplete \\p{X} character escape.");
|
||||
}
|
||||
string text = Parser.ParseName(this.pattern, ref this.ptr);
|
||||
if (text == null)
|
||||
{
|
||||
throw this.NewParseException("Incomplete \\p{X} character escape.");
|
||||
}
|
||||
Category category = CategoryUtils.CategoryFromName(text);
|
||||
if (category == Category.None)
|
||||
{
|
||||
throw this.NewParseException("Unknown property '" + text + "'.");
|
||||
}
|
||||
if (this.pattern[this.ptr++] != '}')
|
||||
{
|
||||
throw this.NewParseException("Incomplete \\p{X} character escape.");
|
||||
}
|
||||
return category;
|
||||
}
|
||||
|
||||
// Token: 0x06001A72 RID: 6770 RVA: 0x00060C7C File Offset: 0x0005EE7C
|
||||
private Expression ParseSpecial(RegexOptions options)
|
||||
{
|
||||
int num = this.ptr;
|
||||
bool flag = Parser.IsECMAScript(options);
|
||||
char c = this.pattern[this.ptr++];
|
||||
Expression expression;
|
||||
switch (c)
|
||||
{
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
{
|
||||
this.ptr--;
|
||||
int num2 = this.ParseNumber(10, 1, 0);
|
||||
if (num2 < 0)
|
||||
{
|
||||
this.ptr = num;
|
||||
return null;
|
||||
}
|
||||
Reference reference = new BackslashNumber(Parser.IsIgnoreCase(options), flag);
|
||||
this.refs.Add(reference, num2.ToString());
|
||||
expression = reference;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
switch (c)
|
||||
{
|
||||
case 'P':
|
||||
expression = new CharacterClass(this.ParseUnicodeCategory(), true);
|
||||
break;
|
||||
default:
|
||||
switch (c)
|
||||
{
|
||||
case 'W':
|
||||
expression = new CharacterClass((!flag) ? Category.Word : Category.EcmaWord, true);
|
||||
break;
|
||||
default:
|
||||
switch (c)
|
||||
{
|
||||
case 'p':
|
||||
expression = new CharacterClass(this.ParseUnicodeCategory(), false);
|
||||
break;
|
||||
default:
|
||||
switch (c)
|
||||
{
|
||||
case 'w':
|
||||
expression = new CharacterClass((!flag) ? Category.Word : Category.EcmaWord, false);
|
||||
break;
|
||||
default:
|
||||
switch (c)
|
||||
{
|
||||
case 'b':
|
||||
expression = new PositionAssertion(Position.Boundary);
|
||||
break;
|
||||
default:
|
||||
if (c != 'k')
|
||||
{
|
||||
expression = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
char c2 = this.pattern[this.ptr++];
|
||||
if (c2 == '<')
|
||||
{
|
||||
c2 = '>';
|
||||
}
|
||||
else if (c2 != '\'')
|
||||
{
|
||||
throw this.NewParseException("Malformed \\k<...> named backreference.");
|
||||
}
|
||||
string text = this.ParseName();
|
||||
if (text == null || this.pattern[this.ptr] != c2)
|
||||
{
|
||||
throw this.NewParseException("Malformed \\k<...> named backreference.");
|
||||
}
|
||||
this.ptr++;
|
||||
Reference reference2 = new Reference(Parser.IsIgnoreCase(options));
|
||||
this.refs.Add(reference2, text);
|
||||
expression = reference2;
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
expression = new CharacterClass((!flag) ? Category.Digit : Category.EcmaDigit, false);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'z':
|
||||
expression = new PositionAssertion(Position.EndOfString);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
expression = new CharacterClass((!flag) ? Category.WhiteSpace : Category.EcmaWhiteSpace, false);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'Z':
|
||||
expression = new PositionAssertion(Position.End);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'S':
|
||||
expression = new CharacterClass((!flag) ? Category.WhiteSpace : Category.EcmaWhiteSpace, true);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'A':
|
||||
expression = new PositionAssertion(Position.StartOfString);
|
||||
break;
|
||||
case 'B':
|
||||
expression = new PositionAssertion(Position.NonBoundary);
|
||||
break;
|
||||
case 'D':
|
||||
expression = new CharacterClass((!flag) ? Category.Digit : Category.EcmaDigit, true);
|
||||
break;
|
||||
case 'G':
|
||||
expression = new PositionAssertion(Position.StartOfScan);
|
||||
break;
|
||||
}
|
||||
if (expression == null)
|
||||
{
|
||||
this.ptr = num;
|
||||
}
|
||||
return expression;
|
||||
}
|
||||
|
||||
// Token: 0x06001A73 RID: 6771 RVA: 0x00060FC8 File Offset: 0x0005F1C8
|
||||
private int ParseEscape()
|
||||
{
|
||||
int num = this.ptr;
|
||||
if (num >= this.pattern.Length)
|
||||
{
|
||||
throw new ArgumentException(string.Format("Parsing \"{0}\" - Illegal \\ at end of pattern.", this.pattern), this.pattern);
|
||||
}
|
||||
char c = this.pattern[this.ptr++];
|
||||
switch (c)
|
||||
{
|
||||
case 'n':
|
||||
return 10;
|
||||
default:
|
||||
switch (c)
|
||||
{
|
||||
case 'a':
|
||||
return 7;
|
||||
default:
|
||||
if (c != '0')
|
||||
{
|
||||
if (c != '\\')
|
||||
{
|
||||
this.ptr = num;
|
||||
return -1;
|
||||
}
|
||||
return 92;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.ptr--;
|
||||
int num2 = this.ptr;
|
||||
int num3 = Parser.ParseOctal(this.pattern, ref this.ptr);
|
||||
if (num3 == -1 && num2 == this.ptr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return num3;
|
||||
}
|
||||
break;
|
||||
case 'c':
|
||||
{
|
||||
int num4 = (int)this.pattern[this.ptr++];
|
||||
if (num4 >= 64 && num4 <= 95)
|
||||
{
|
||||
return num4 - 64;
|
||||
}
|
||||
throw this.NewParseException("Unrecognized control character.");
|
||||
}
|
||||
case 'e':
|
||||
return 27;
|
||||
case 'f':
|
||||
return 12;
|
||||
}
|
||||
break;
|
||||
case 'r':
|
||||
return 13;
|
||||
case 't':
|
||||
return 9;
|
||||
case 'u':
|
||||
{
|
||||
int num4 = Parser.ParseHex(this.pattern, ref this.ptr, 4);
|
||||
if (num4 < 0)
|
||||
{
|
||||
throw this.NewParseException("Insufficient hex digits");
|
||||
}
|
||||
return num4;
|
||||
}
|
||||
case 'v':
|
||||
return 11;
|
||||
case 'x':
|
||||
{
|
||||
int num4 = Parser.ParseHex(this.pattern, ref this.ptr, 2);
|
||||
if (num4 < 0)
|
||||
{
|
||||
throw this.NewParseException("Insufficient hex digits");
|
||||
}
|
||||
return num4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001A74 RID: 6772 RVA: 0x00061188 File Offset: 0x0005F388
|
||||
private string ParseName()
|
||||
{
|
||||
return Parser.ParseName(this.pattern, ref this.ptr);
|
||||
}
|
||||
|
||||
// Token: 0x06001A75 RID: 6773 RVA: 0x0006119C File Offset: 0x0005F39C
|
||||
private static bool IsNameChar(char c)
|
||||
{
|
||||
UnicodeCategory unicodeCategory = char.GetUnicodeCategory(c);
|
||||
return unicodeCategory != UnicodeCategory.ModifierLetter && (unicodeCategory == UnicodeCategory.ConnectorPunctuation || char.IsLetterOrDigit(c));
|
||||
}
|
||||
|
||||
// Token: 0x06001A76 RID: 6774 RVA: 0x000611CC File Offset: 0x0005F3CC
|
||||
private int ParseNumber(int b, int min, int max)
|
||||
{
|
||||
return Parser.ParseNumber(this.pattern, ref this.ptr, b, min, max);
|
||||
}
|
||||
|
||||
// Token: 0x06001A77 RID: 6775 RVA: 0x000611E4 File Offset: 0x0005F3E4
|
||||
private static int ParseDigit(char c, int b, int n)
|
||||
{
|
||||
switch (b)
|
||||
{
|
||||
case 8:
|
||||
if (c >= '0' && c <= '7')
|
||||
{
|
||||
return (int)(c - '0');
|
||||
}
|
||||
return -1;
|
||||
default:
|
||||
if (b != 16)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if (c >= '0' && c <= '9')
|
||||
{
|
||||
return (int)(c - '0');
|
||||
}
|
||||
if (c >= 'a' && c <= 'f')
|
||||
{
|
||||
return (int)('\n' + c - 'a');
|
||||
}
|
||||
if (c >= 'A' && c <= 'F')
|
||||
{
|
||||
return (int)('\n' + c - 'A');
|
||||
}
|
||||
return -1;
|
||||
case 10:
|
||||
if (c >= '0' && c <= '9')
|
||||
{
|
||||
return (int)(c - '0');
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001A78 RID: 6776 RVA: 0x0006128C File Offset: 0x0005F48C
|
||||
private void ConsumeWhitespace(bool ignore)
|
||||
{
|
||||
while (this.ptr < this.pattern.Length)
|
||||
{
|
||||
if (this.pattern[this.ptr] == '(')
|
||||
{
|
||||
if (this.ptr + 3 >= this.pattern.Length)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (this.pattern[this.ptr + 1] != '?' || this.pattern[this.ptr + 2] != '#')
|
||||
{
|
||||
return;
|
||||
}
|
||||
this.ptr += 3;
|
||||
while (this.ptr < this.pattern.Length && this.pattern[this.ptr++] != ')')
|
||||
{
|
||||
}
|
||||
}
|
||||
else if (ignore && this.pattern[this.ptr] == '#')
|
||||
{
|
||||
while (this.ptr < this.pattern.Length && this.pattern[this.ptr++] != '\n')
|
||||
{
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ignore || !char.IsWhiteSpace(this.pattern[this.ptr]))
|
||||
{
|
||||
return;
|
||||
}
|
||||
while (this.ptr < this.pattern.Length && char.IsWhiteSpace(this.pattern[this.ptr]))
|
||||
{
|
||||
this.ptr++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001A79 RID: 6777 RVA: 0x00061438 File Offset: 0x0005F638
|
||||
private string ParseString(string pattern)
|
||||
{
|
||||
this.pattern = pattern;
|
||||
this.ptr = 0;
|
||||
StringBuilder stringBuilder = new StringBuilder(pattern.Length);
|
||||
while (this.ptr < pattern.Length)
|
||||
{
|
||||
int num = (int)pattern[this.ptr++];
|
||||
if (num == 92)
|
||||
{
|
||||
num = this.ParseEscape();
|
||||
if (num < 0)
|
||||
{
|
||||
num = (int)pattern[this.ptr++];
|
||||
if (num == 98)
|
||||
{
|
||||
num = 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
stringBuilder.Append((char)num);
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x06001A7A RID: 6778 RVA: 0x000614D4 File Offset: 0x0005F6D4
|
||||
private void ResolveReferences()
|
||||
{
|
||||
int num = 1;
|
||||
Hashtable hashtable = new Hashtable();
|
||||
ArrayList arrayList = null;
|
||||
foreach (object obj in this.caps)
|
||||
{
|
||||
CapturingGroup capturingGroup = (CapturingGroup)obj;
|
||||
if (capturingGroup.Name == null)
|
||||
{
|
||||
hashtable.Add(num.ToString(), capturingGroup);
|
||||
capturingGroup.Index = num++;
|
||||
this.num_groups++;
|
||||
}
|
||||
}
|
||||
foreach (object obj2 in this.caps)
|
||||
{
|
||||
CapturingGroup capturingGroup2 = (CapturingGroup)obj2;
|
||||
if (capturingGroup2.Name != null)
|
||||
{
|
||||
if (hashtable.Contains(capturingGroup2.Name))
|
||||
{
|
||||
CapturingGroup capturingGroup3 = (CapturingGroup)hashtable[capturingGroup2.Name];
|
||||
capturingGroup2.Index = capturingGroup3.Index;
|
||||
if (capturingGroup2.Index == num)
|
||||
{
|
||||
num++;
|
||||
}
|
||||
else if (capturingGroup2.Index > num)
|
||||
{
|
||||
arrayList.Add(capturingGroup2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (char.IsDigit(capturingGroup2.Name[0]))
|
||||
{
|
||||
int num2 = 0;
|
||||
int num3 = Parser.ParseDecimal(capturingGroup2.Name, ref num2);
|
||||
if (num2 == capturingGroup2.Name.Length)
|
||||
{
|
||||
capturingGroup2.Index = num3;
|
||||
hashtable.Add(capturingGroup2.Name, capturingGroup2);
|
||||
this.num_groups++;
|
||||
if (num3 == num)
|
||||
{
|
||||
num++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (arrayList == null)
|
||||
{
|
||||
arrayList = new ArrayList(4);
|
||||
}
|
||||
arrayList.Add(capturingGroup2);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
string text = num.ToString();
|
||||
while (hashtable.Contains(text))
|
||||
{
|
||||
int num4;
|
||||
num = (num4 = num + 1);
|
||||
text = num4.ToString();
|
||||
}
|
||||
hashtable.Add(text, capturingGroup2);
|
||||
hashtable.Add(capturingGroup2.Name, capturingGroup2);
|
||||
capturingGroup2.Index = num++;
|
||||
this.num_groups++;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.gap = num;
|
||||
if (arrayList != null)
|
||||
{
|
||||
this.HandleExplicitNumericGroups(arrayList);
|
||||
}
|
||||
foreach (object obj3 in this.refs.Keys)
|
||||
{
|
||||
Expression expression = (Expression)obj3;
|
||||
string text2 = (string)this.refs[expression];
|
||||
if (!hashtable.Contains(text2))
|
||||
{
|
||||
if (!(expression is CaptureAssertion) || char.IsDigit(text2[0]))
|
||||
{
|
||||
BackslashNumber backslashNumber = expression as BackslashNumber;
|
||||
if (backslashNumber == null || !backslashNumber.ResolveReference(text2, hashtable))
|
||||
{
|
||||
throw this.NewParseException("Reference to undefined group " + ((!char.IsDigit(text2[0])) ? "name " : "number ") + text2);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CapturingGroup capturingGroup4 = (CapturingGroup)hashtable[text2];
|
||||
if (expression is Reference)
|
||||
{
|
||||
((Reference)expression).CapturingGroup = capturingGroup4;
|
||||
}
|
||||
else if (expression is CaptureAssertion)
|
||||
{
|
||||
((CaptureAssertion)expression).CapturingGroup = capturingGroup4;
|
||||
}
|
||||
else if (expression is BalancingGroup)
|
||||
{
|
||||
((BalancingGroup)expression).Balance = capturingGroup4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001A7B RID: 6779 RVA: 0x000618C4 File Offset: 0x0005FAC4
|
||||
private void HandleExplicitNumericGroups(ArrayList explicit_numeric_groups)
|
||||
{
|
||||
int num = this.gap;
|
||||
int i = 0;
|
||||
int count = explicit_numeric_groups.Count;
|
||||
explicit_numeric_groups.Sort();
|
||||
while (i < count)
|
||||
{
|
||||
CapturingGroup capturingGroup = (CapturingGroup)explicit_numeric_groups[i];
|
||||
if (capturingGroup.Index > num)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (capturingGroup.Index == num)
|
||||
{
|
||||
num++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
this.gap = num;
|
||||
int num2 = num;
|
||||
while (i < count)
|
||||
{
|
||||
CapturingGroup capturingGroup2 = (CapturingGroup)explicit_numeric_groups[i];
|
||||
if (capturingGroup2.Index == num2)
|
||||
{
|
||||
capturingGroup2.Index = num - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
num2 = capturingGroup2.Index;
|
||||
capturingGroup2.Index = num++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001A7C RID: 6780 RVA: 0x00061980 File Offset: 0x0005FB80
|
||||
private static bool IsIgnoreCase(RegexOptions options)
|
||||
{
|
||||
return (options & RegexOptions.IgnoreCase) != RegexOptions.None;
|
||||
}
|
||||
|
||||
// Token: 0x06001A7D RID: 6781 RVA: 0x0006198C File Offset: 0x0005FB8C
|
||||
private static bool IsMultiline(RegexOptions options)
|
||||
{
|
||||
return (options & RegexOptions.Multiline) != RegexOptions.None;
|
||||
}
|
||||
|
||||
// Token: 0x06001A7E RID: 6782 RVA: 0x00061998 File Offset: 0x0005FB98
|
||||
private static bool IsExplicitCapture(RegexOptions options)
|
||||
{
|
||||
return (options & RegexOptions.ExplicitCapture) != RegexOptions.None;
|
||||
}
|
||||
|
||||
// Token: 0x06001A7F RID: 6783 RVA: 0x000619A4 File Offset: 0x0005FBA4
|
||||
private static bool IsSingleline(RegexOptions options)
|
||||
{
|
||||
return (options & RegexOptions.Singleline) != RegexOptions.None;
|
||||
}
|
||||
|
||||
// Token: 0x06001A80 RID: 6784 RVA: 0x000619B0 File Offset: 0x0005FBB0
|
||||
private static bool IsIgnorePatternWhitespace(RegexOptions options)
|
||||
{
|
||||
return (options & RegexOptions.IgnorePatternWhitespace) != RegexOptions.None;
|
||||
}
|
||||
|
||||
// Token: 0x06001A81 RID: 6785 RVA: 0x000619BC File Offset: 0x0005FBBC
|
||||
private static bool IsECMAScript(RegexOptions options)
|
||||
{
|
||||
return (options & RegexOptions.ECMAScript) != RegexOptions.None;
|
||||
}
|
||||
|
||||
// Token: 0x06001A82 RID: 6786 RVA: 0x000619CC File Offset: 0x0005FBCC
|
||||
private ArgumentException NewParseException(string msg)
|
||||
{
|
||||
msg = "parsing \"" + this.pattern + "\" - " + msg;
|
||||
return new ArgumentException(msg, this.pattern);
|
||||
}
|
||||
|
||||
// Token: 0x0400159F RID: 5535
|
||||
private string pattern;
|
||||
|
||||
// Token: 0x040015A0 RID: 5536
|
||||
private int ptr;
|
||||
|
||||
// Token: 0x040015A1 RID: 5537
|
||||
private ArrayList caps;
|
||||
|
||||
// Token: 0x040015A2 RID: 5538
|
||||
private Hashtable refs;
|
||||
|
||||
// Token: 0x040015A3 RID: 5539
|
||||
private int num_groups;
|
||||
|
||||
// Token: 0x040015A4 RID: 5540
|
||||
private int gap;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text.RegularExpressions.Syntax
|
||||
{
|
||||
// Token: 0x020002E6 RID: 742
|
||||
internal class PositionAssertion : Expression
|
||||
{
|
||||
// Token: 0x06001AF1 RID: 6897 RVA: 0x000632A0 File Offset: 0x000614A0
|
||||
public PositionAssertion(Position pos)
|
||||
{
|
||||
this.pos = pos;
|
||||
}
|
||||
|
||||
// Token: 0x1700083A RID: 2106
|
||||
// (get) Token: 0x06001AF2 RID: 6898 RVA: 0x000632B0 File Offset: 0x000614B0
|
||||
// (set) Token: 0x06001AF3 RID: 6899 RVA: 0x000632B8 File Offset: 0x000614B8
|
||||
public Position Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.pos;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.pos = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001AF4 RID: 6900 RVA: 0x000632C4 File Offset: 0x000614C4
|
||||
public override void Compile(ICompiler cmp, bool reverse)
|
||||
{
|
||||
cmp.EmitPosition(this.pos);
|
||||
}
|
||||
|
||||
// Token: 0x06001AF5 RID: 6901 RVA: 0x000632D4 File Offset: 0x000614D4
|
||||
public override void GetWidth(out int min, out int max)
|
||||
{
|
||||
min = (max = 0);
|
||||
}
|
||||
|
||||
// Token: 0x06001AF6 RID: 6902 RVA: 0x000632EC File Offset: 0x000614EC
|
||||
public override bool IsComplex()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Token: 0x06001AF7 RID: 6903 RVA: 0x000632F0 File Offset: 0x000614F0
|
||||
public override AnchorInfo GetAnchorInfo(bool revers)
|
||||
{
|
||||
switch (this.pos)
|
||||
{
|
||||
case Position.StartOfString:
|
||||
case Position.StartOfLine:
|
||||
case Position.StartOfScan:
|
||||
return new AnchorInfo(this, 0, 0, this.pos);
|
||||
default:
|
||||
return new AnchorInfo(this, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040015BF RID: 5567
|
||||
private Position pos;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text.RegularExpressions.Syntax
|
||||
{
|
||||
// Token: 0x020002E7 RID: 743
|
||||
internal class Reference : Expression
|
||||
{
|
||||
// Token: 0x06001AF8 RID: 6904 RVA: 0x00063334 File Offset: 0x00061534
|
||||
public Reference(bool ignore)
|
||||
{
|
||||
this.ignore = ignore;
|
||||
}
|
||||
|
||||
// Token: 0x1700083B RID: 2107
|
||||
// (get) Token: 0x06001AF9 RID: 6905 RVA: 0x00063344 File Offset: 0x00061544
|
||||
// (set) Token: 0x06001AFA RID: 6906 RVA: 0x0006334C File Offset: 0x0006154C
|
||||
public CapturingGroup CapturingGroup
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.group;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.group = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700083C RID: 2108
|
||||
// (get) Token: 0x06001AFB RID: 6907 RVA: 0x00063358 File Offset: 0x00061558
|
||||
// (set) Token: 0x06001AFC RID: 6908 RVA: 0x00063360 File Offset: 0x00061560
|
||||
public bool IgnoreCase
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.ignore;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.ignore = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001AFD RID: 6909 RVA: 0x0006336C File Offset: 0x0006156C
|
||||
public override void Compile(ICompiler cmp, bool reverse)
|
||||
{
|
||||
cmp.EmitReference(this.group.Index, this.ignore, reverse);
|
||||
}
|
||||
|
||||
// Token: 0x06001AFE RID: 6910 RVA: 0x00063388 File Offset: 0x00061588
|
||||
public override void GetWidth(out int min, out int max)
|
||||
{
|
||||
min = 0;
|
||||
max = int.MaxValue;
|
||||
}
|
||||
|
||||
// Token: 0x06001AFF RID: 6911 RVA: 0x00063394 File Offset: 0x00061594
|
||||
public override bool IsComplex()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x040015C0 RID: 5568
|
||||
private CapturingGroup group;
|
||||
|
||||
// Token: 0x040015C1 RID: 5569
|
||||
private bool ignore;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text.RegularExpressions.Syntax
|
||||
{
|
||||
// Token: 0x020002DC RID: 732
|
||||
internal class RegularExpression : Group
|
||||
{
|
||||
// Token: 0x06001AAD RID: 6829 RVA: 0x000628FC File Offset: 0x00060AFC
|
||||
public RegularExpression()
|
||||
{
|
||||
this.group_count = 0;
|
||||
}
|
||||
|
||||
// Token: 0x17000827 RID: 2087
|
||||
// (get) Token: 0x06001AAE RID: 6830 RVA: 0x0006290C File Offset: 0x00060B0C
|
||||
// (set) Token: 0x06001AAF RID: 6831 RVA: 0x00062914 File Offset: 0x00060B14
|
||||
public int GroupCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.group_count;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.group_count = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001AB0 RID: 6832 RVA: 0x00062920 File Offset: 0x00060B20
|
||||
public override void Compile(ICompiler cmp, bool reverse)
|
||||
{
|
||||
int num;
|
||||
int num2;
|
||||
this.GetWidth(out num, out num2);
|
||||
cmp.EmitInfo(this.group_count, num, num2);
|
||||
AnchorInfo anchorInfo = this.GetAnchorInfo(reverse);
|
||||
LinkRef linkRef = cmp.NewLink();
|
||||
cmp.EmitAnchor(reverse, anchorInfo.Offset, linkRef);
|
||||
if (anchorInfo.IsPosition)
|
||||
{
|
||||
cmp.EmitPosition(anchorInfo.Position);
|
||||
}
|
||||
else if (anchorInfo.IsSubstring)
|
||||
{
|
||||
cmp.EmitString(anchorInfo.Substring, anchorInfo.IgnoreCase, reverse);
|
||||
}
|
||||
cmp.EmitTrue();
|
||||
cmp.ResolveLink(linkRef);
|
||||
base.Compile(cmp, reverse);
|
||||
cmp.EmitTrue();
|
||||
}
|
||||
|
||||
// Token: 0x040015B1 RID: 5553
|
||||
private int group_count;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
using System;
|
||||
|
||||
namespace System.Text.RegularExpressions.Syntax
|
||||
{
|
||||
// Token: 0x020002E0 RID: 736
|
||||
internal class Repetition : CompositeExpression
|
||||
{
|
||||
// Token: 0x06001AC1 RID: 6849 RVA: 0x00062B40 File Offset: 0x00060D40
|
||||
public Repetition(int min, int max, bool lazy)
|
||||
{
|
||||
base.Expressions.Add(null);
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.lazy = lazy;
|
||||
}
|
||||
|
||||
// Token: 0x1700082C RID: 2092
|
||||
// (get) Token: 0x06001AC2 RID: 6850 RVA: 0x00062B6C File Offset: 0x00060D6C
|
||||
// (set) Token: 0x06001AC3 RID: 6851 RVA: 0x00062B7C File Offset: 0x00060D7C
|
||||
public Expression Expression
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Expressions[0];
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Expressions[0] = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700082D RID: 2093
|
||||
// (get) Token: 0x06001AC4 RID: 6852 RVA: 0x00062B8C File Offset: 0x00060D8C
|
||||
// (set) Token: 0x06001AC5 RID: 6853 RVA: 0x00062B94 File Offset: 0x00060D94
|
||||
public int Minimum
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.min;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.min = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700082E RID: 2094
|
||||
// (get) Token: 0x06001AC6 RID: 6854 RVA: 0x00062BA0 File Offset: 0x00060DA0
|
||||
// (set) Token: 0x06001AC7 RID: 6855 RVA: 0x00062BA8 File Offset: 0x00060DA8
|
||||
public int Maximum
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.max;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.max = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700082F RID: 2095
|
||||
// (get) Token: 0x06001AC8 RID: 6856 RVA: 0x00062BB4 File Offset: 0x00060DB4
|
||||
// (set) Token: 0x06001AC9 RID: 6857 RVA: 0x00062BBC File Offset: 0x00060DBC
|
||||
public bool Lazy
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.lazy;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.lazy = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001ACA RID: 6858 RVA: 0x00062BC8 File Offset: 0x00060DC8
|
||||
public override void Compile(ICompiler cmp, bool reverse)
|
||||
{
|
||||
if (this.Expression.IsComplex())
|
||||
{
|
||||
LinkRef linkRef = cmp.NewLink();
|
||||
cmp.EmitRepeat(this.min, this.max, this.lazy, linkRef);
|
||||
this.Expression.Compile(cmp, reverse);
|
||||
cmp.EmitUntil(linkRef);
|
||||
}
|
||||
else
|
||||
{
|
||||
LinkRef linkRef2 = cmp.NewLink();
|
||||
cmp.EmitFastRepeat(this.min, this.max, this.lazy, linkRef2);
|
||||
this.Expression.Compile(cmp, reverse);
|
||||
cmp.EmitTrue();
|
||||
cmp.ResolveLink(linkRef2);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001ACB RID: 6859 RVA: 0x00062C58 File Offset: 0x00060E58
|
||||
public override void GetWidth(out int min, out int max)
|
||||
{
|
||||
this.Expression.GetWidth(out min, out max);
|
||||
min *= this.min;
|
||||
if (max == 2147483647 || this.max == 65535)
|
||||
{
|
||||
max = int.MaxValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
max *= this.max;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001ACC RID: 6860 RVA: 0x00062CB0 File Offset: 0x00060EB0
|
||||
public override AnchorInfo GetAnchorInfo(bool reverse)
|
||||
{
|
||||
int fixedWidth = base.GetFixedWidth();
|
||||
if (this.Minimum == 0)
|
||||
{
|
||||
return new AnchorInfo(this, fixedWidth);
|
||||
}
|
||||
AnchorInfo anchorInfo = this.Expression.GetAnchorInfo(reverse);
|
||||
if (anchorInfo.IsPosition)
|
||||
{
|
||||
return new AnchorInfo(this, anchorInfo.Offset, fixedWidth, anchorInfo.Position);
|
||||
}
|
||||
if (!anchorInfo.IsSubstring)
|
||||
{
|
||||
return new AnchorInfo(this, fixedWidth);
|
||||
}
|
||||
if (anchorInfo.IsComplete)
|
||||
{
|
||||
string substring = anchorInfo.Substring;
|
||||
StringBuilder stringBuilder = new StringBuilder(substring);
|
||||
for (int i = 1; i < this.Minimum; i++)
|
||||
{
|
||||
stringBuilder.Append(substring);
|
||||
}
|
||||
return new AnchorInfo(this, 0, fixedWidth, stringBuilder.ToString(), anchorInfo.IgnoreCase);
|
||||
}
|
||||
return new AnchorInfo(this, anchorInfo.Offset, fixedWidth, anchorInfo.Substring, anchorInfo.IgnoreCase);
|
||||
}
|
||||
|
||||
// Token: 0x040015B5 RID: 5557
|
||||
private int min;
|
||||
|
||||
// Token: 0x040015B6 RID: 5558
|
||||
private int max;
|
||||
|
||||
// Token: 0x040015B7 RID: 5559
|
||||
private bool lazy;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user