Terraria v1.4.4.9
Terraria source code documentation
All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Events Macros

◆ RegexBoyerMoore()

System.Text.RegularExpressions.RegexBoyerMoore.RegexBoyerMoore ( string pattern,
bool caseInsensitive,
bool rightToLeft,
CultureInfo culture )
inline

Definition at line 25 of file RegexBoyerMoore.cs.

26 {
28 RightToLeft = rightToLeft;
29 CaseInsensitive = caseInsensitive;
31 int num;
32 int num2;
33 int num3;
34 if (!rightToLeft)
35 {
36 num = -1;
37 num2 = pattern.Length - 1;
38 num3 = 1;
39 }
40 else
41 {
42 num = pattern.Length;
43 num2 = 0;
44 num3 = -1;
45 }
46 Positive = new int[pattern.Length];
47 int num4 = num2;
48 char c = pattern[num4];
49 Positive[num4] = num3;
50 num4 -= num3;
51 while (num4 != num)
52 {
53 if (pattern[num4] != c)
54 {
55 num4 -= num3;
56 continue;
57 }
58 int num5 = num2;
59 int num6 = num4;
60 while (num6 != num && pattern[num5] == pattern[num6])
61 {
62 num6 -= num3;
63 num5 -= num3;
64 }
65 if (Positive[num5] == 0)
66 {
67 Positive[num5] = num5 - num6;
68 }
69 num4 -= num3;
70 }
71 for (int num5 = num2 - num3; num5 != num; num5 -= num3)
72 {
73 if (Positive[num5] == 0)
74 {
75 Positive[num5] = num3;
76 }
77 }
78 NegativeASCII = new int[128];
79 for (int i = 0; i < 128; i++)
80 {
81 NegativeASCII[i] = num2 - num;
82 }
83 LowASCII = 127;
84 HighASCII = 0;
85 for (num4 = num2; num4 != num; num4 -= num3)
86 {
87 c = pattern[num4];
88 if (c < '\u0080')
89 {
90 if (LowASCII > c)
91 {
92 LowASCII = c;
93 }
94 if (HighASCII < c)
95 {
96 HighASCII = c;
97 }
98 if (NegativeASCII[(uint)c] == num2 - num)
99 {
100 NegativeASCII[(uint)c] = num2 - num4;
101 }
102 }
103 else
104 {
105 int num7 = (int)c >> 8;
106 int num8 = c & 0xFF;
107 if (NegativeUnicode == null)
108 {
109 NegativeUnicode = new int[256][];
110 }
111 if (NegativeUnicode[num7] == null)
112 {
113 int[] array = new int[256];
114 for (int j = 0; j < array.Length; j++)
115 {
116 array[j] = num2 - num;
117 }
118 if (num7 == 0)
119 {
120 Array.Copy(NegativeASCII, array, 128);
122 }
123 NegativeUnicode[num7] = array;
124 }
125 if (NegativeUnicode[num7][num8] == num2 - num)
126 {
127 NegativeUnicode[num7][num8] = num2 - num4;
128 }
129 }
130 }
131 }

References System.Text.RegularExpressions.RegexBoyerMoore._culture, System.Text.RegularExpressions.array, System.Text.RegularExpressions.RegexBoyerMoore.CaseInsensitive, System.Array.Copy(), System.culture, System.Text.RegularExpressions.RegexBoyerMoore.HighASCII, System.Text.RegularExpressions.i, System.Text.RegularExpressions.RegexBoyerMoore.LowASCII, System.Text.RegularExpressions.RegexBoyerMoore.NegativeASCII, System.Text.RegularExpressions.RegexBoyerMoore.NegativeUnicode, System.Text.RegularExpressions.pattern, System.Text.RegularExpressions.RegexBoyerMoore.Pattern, System.Text.RegularExpressions.RegexBoyerMoore.Positive, and System.Text.RegularExpressions.RegexBoyerMoore.RightToLeft.