152 lines
3.6 KiB
C#
152 lines
3.6 KiB
C#
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;
|
|
}
|
|
}
|