Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
RegexCharClass.cs
Go to the documentation of this file.
4
6
7internal sealed class RegexCharClass
8{
9 internal readonly struct LowerCaseMapping
10 {
11 public readonly char ChMin;
12
13 public readonly char ChMax;
14
15 public readonly int LcOp;
16
17 public readonly int Data;
18
19 internal LowerCaseMapping(char chMin, char chMax, int lcOp, int data)
20 {
21 ChMin = chMin;
22 ChMax = chMax;
23 LcOp = lcOp;
24 Data = data;
25 }
26 }
27
29 {
30 public bool ContainsOnlyAscii;
31
32 public bool ContainsNoAscii;
33
34 public bool AllAsciiContained;
35
37 }
38
39 private readonly struct SingleRange
40 {
41 public readonly char First;
42
43 public readonly char Last;
44
45 internal SingleRange(char first, char last)
46 {
47 First = first;
48 Last = last;
49 }
50 }
51
52 internal static readonly LowerCaseMapping[] s_lcTable = new LowerCaseMapping[96]
53 {
54 new LowerCaseMapping('A', 'Z', 1, 32),
55 new LowerCaseMapping('À', 'Ö', 1, 32),
56 new LowerCaseMapping('Ø', 'Þ', 1, 32),
57 new LowerCaseMapping('Ā', 'Į', 2, 0),
58 new LowerCaseMapping('IJ', 'Ķ', 2, 0),
59 new LowerCaseMapping('Ĺ', 'Ň', 3, 0),
60 new LowerCaseMapping('Ŋ', 'Ŷ', 2, 0),
61 new LowerCaseMapping('Ÿ', 'Ÿ', 0, 255),
62 new LowerCaseMapping('Ź', 'Ž', 3, 0),
63 new LowerCaseMapping('Ɓ', 'Ɓ', 0, 595),
64 new LowerCaseMapping('Ƃ', 'Ƅ', 2, 0),
65 new LowerCaseMapping('Ɔ', 'Ɔ', 0, 596),
66 new LowerCaseMapping('Ƈ', 'Ƈ', 0, 392),
67 new LowerCaseMapping('Ɖ', 'Ɗ', 1, 205),
68 new LowerCaseMapping('Ƌ', 'Ƌ', 0, 396),
69 new LowerCaseMapping('Ǝ', 'Ǝ', 0, 477),
70 new LowerCaseMapping('Ə', 'Ə', 0, 601),
71 new LowerCaseMapping('Ɛ', 'Ɛ', 0, 603),
72 new LowerCaseMapping('Ƒ', 'Ƒ', 0, 402),
73 new LowerCaseMapping('Ɠ', 'Ɠ', 0, 608),
74 new LowerCaseMapping('Ɣ', 'Ɣ', 0, 611),
75 new LowerCaseMapping('Ɩ', 'Ɩ', 0, 617),
76 new LowerCaseMapping('Ɨ', 'Ɨ', 0, 616),
77 new LowerCaseMapping('Ƙ', 'Ƙ', 0, 409),
78 new LowerCaseMapping('Ɯ', 'Ɯ', 0, 623),
79 new LowerCaseMapping('Ɲ', 'Ɲ', 0, 626),
80 new LowerCaseMapping('Ɵ', 'Ɵ', 0, 629),
81 new LowerCaseMapping('Ơ', 'Ƥ', 2, 0),
82 new LowerCaseMapping('Ƨ', 'Ƨ', 0, 424),
83 new LowerCaseMapping('Ʃ', 'Ʃ', 0, 643),
84 new LowerCaseMapping('Ƭ', 'Ƭ', 0, 429),
85 new LowerCaseMapping('Ʈ', 'Ʈ', 0, 648),
86 new LowerCaseMapping('Ư', 'Ư', 0, 432),
87 new LowerCaseMapping('Ʊ', 'Ʋ', 1, 217),
88 new LowerCaseMapping('Ƴ', 'Ƶ', 3, 0),
89 new LowerCaseMapping('Ʒ', 'Ʒ', 0, 658),
90 new LowerCaseMapping('Ƹ', 'Ƹ', 0, 441),
91 new LowerCaseMapping('Ƽ', 'Ƽ', 0, 445),
92 new LowerCaseMapping('DŽ', 'Dž', 0, 454),
93 new LowerCaseMapping('LJ', 'Lj', 0, 457),
94 new LowerCaseMapping('NJ', 'Nj', 0, 460),
95 new LowerCaseMapping('Ǎ', 'Ǜ', 3, 0),
96 new LowerCaseMapping('Ǟ', 'Ǯ', 2, 0),
97 new LowerCaseMapping('DZ', 'Dz', 0, 499),
98 new LowerCaseMapping('Ǵ', 'Ǵ', 0, 501),
99 new LowerCaseMapping('Ǻ', 'Ȗ', 2, 0),
100 new LowerCaseMapping('Ά', 'Ά', 0, 940),
101 new LowerCaseMapping('Έ', 'Ί', 1, 37),
102 new LowerCaseMapping('Ό', 'Ό', 0, 972),
103 new LowerCaseMapping('Ύ', 'Ώ', 1, 63),
104 new LowerCaseMapping('Α', 'Ρ', 1, 32),
105 new LowerCaseMapping('Σ', 'Ϋ', 1, 32),
106 new LowerCaseMapping('Ϣ', 'Ϯ', 2, 0),
107 new LowerCaseMapping('Ё', 'Џ', 1, 80),
108 new LowerCaseMapping('А', 'Я', 1, 32),
109 new LowerCaseMapping('Ѡ', 'Ҁ', 2, 0),
110 new LowerCaseMapping('Ґ', 'Ҿ', 2, 0),
111 new LowerCaseMapping('Ӂ', 'Ӄ', 3, 0),
112 new LowerCaseMapping('Ӈ', 'Ӈ', 0, 1224),
113 new LowerCaseMapping('Ӌ', 'Ӌ', 0, 1228),
114 new LowerCaseMapping('Ӑ', 'Ӫ', 2, 0),
115 new LowerCaseMapping('Ӯ', 'Ӵ', 2, 0),
116 new LowerCaseMapping('Ӹ', 'Ӹ', 0, 1273),
117 new LowerCaseMapping('Ա', 'Ֆ', 1, 48),
118 new LowerCaseMapping('Ⴀ', 'Ⴥ', 1, 7264),
119 new LowerCaseMapping('Ḁ', 'ẕ', 2, 0),
120 new LowerCaseMapping('Ạ', 'Ỹ', 2, 0),
121 new LowerCaseMapping('Ἀ', 'Ἇ', 1, -8),
122 new LowerCaseMapping('Ἐ', 'Ἕ', 1, -8),
123 new LowerCaseMapping('Ἠ', 'Ἧ', 1, -8),
124 new LowerCaseMapping('Ἰ', 'Ἷ', 1, -8),
125 new LowerCaseMapping('Ὀ', 'Ὅ', 1, -8),
126 new LowerCaseMapping('Ὑ', 'Ὑ', 0, 8017),
127 new LowerCaseMapping('Ὓ', 'Ὓ', 0, 8019),
128 new LowerCaseMapping('Ὕ', 'Ὕ', 0, 8021),
129 new LowerCaseMapping('Ὗ', 'Ὗ', 0, 8023),
130 new LowerCaseMapping('Ὠ', 'Ὧ', 1, -8),
131 new LowerCaseMapping('ᾈ', 'ᾏ', 1, -8),
132 new LowerCaseMapping('ᾘ', 'ᾟ', 1, -8),
133 new LowerCaseMapping('ᾨ', 'ᾯ', 1, -8),
134 new LowerCaseMapping('Ᾰ', 'Ᾱ', 1, -8),
135 new LowerCaseMapping('Ὰ', 'Ά', 1, -74),
136 new LowerCaseMapping('ᾼ', 'ᾼ', 0, 8115),
137 new LowerCaseMapping('Ὲ', 'Ή', 1, -86),
138 new LowerCaseMapping('ῌ', 'ῌ', 0, 8131),
139 new LowerCaseMapping('Ῐ', 'Ῑ', 1, -8),
140 new LowerCaseMapping('Ὶ', 'Ί', 1, -100),
141 new LowerCaseMapping('Ῠ', 'Ῡ', 1, -8),
142 new LowerCaseMapping('Ὺ', 'Ύ', 1, -112),
143 new LowerCaseMapping('Ῥ', 'Ῥ', 0, 8165),
144 new LowerCaseMapping('Ὸ', 'Ό', 1, -128),
145 new LowerCaseMapping('Ὼ', 'Ώ', 1, -126),
146 new LowerCaseMapping('ῼ', 'ῼ', 0, 8179),
147 new LowerCaseMapping('Ⅰ', 'Ⅿ', 1, 16),
148 new LowerCaseMapping('Ⓐ', 'Ⓩ', 1, 26),
149 new LowerCaseMapping('A', 'Z', 1, 32)
150 };
151
153 {
154 { "Cc", "\u000f" },
155 { "Cf", "\u0010" },
156 { "Cn", "\u001e" },
157 { "Co", "\u0012" },
158 { "Cs", "\u0011" },
159 { "C", "\0\u000f\u0010\u001e\u0012\u0011\0" },
160 { "Ll", "\u0002" },
161 { "Lm", "\u0004" },
162 { "Lo", "\u0005" },
163 { "Lt", "\u0003" },
164 { "Lu", "\u0001" },
165 { "L", "\0\u0002\u0004\u0005\u0003\u0001\0" },
166 { "__InternalRegexIgnoreCase__", "\0\u0002\u0003\u0001\0" },
167 { "Mc", "\a" },
168 { "Me", "\b" },
169 { "Mn", "\u0006" },
170 { "M", "\0\a\b\u0006\0" },
171 { "Nd", "\t" },
172 { "Nl", "\n" },
173 { "No", "\v" },
174 { "N", "\0\t\n\v\0" },
175 { "Pc", "\u0013" },
176 { "Pd", "\u0014" },
177 { "Pe", "\u0016" },
178 { "Po", "\u0019" },
179 { "Ps", "\u0015" },
180 { "Pf", "\u0018" },
181 { "Pi", "\u0017" },
182 { "P", "\0\u0013\u0014\u0016\u0019\u0015\u0018\u0017\0" },
183 { "Sc", "\u001b" },
184 { "Sk", "\u001c" },
185 { "Sm", "\u001a" },
186 { "So", "\u001d" },
187 { "S", "\0\u001b\u001c\u001a\u001d\0" },
188 { "Zl", "\r" },
189 { "Zp", "\u000e" },
190 { "Zs", "\f" },
191 { "Z", "\0\r\u000e\f\0" }
192 };
193
194 private static readonly string[][] s_propTable = new string[112][]
195 {
196 new string[2] { "IsAlphabeticPresentationForms", "ffﭐ" },
197 new string[2] { "IsArabic", "\u0600܀" },
198 new string[2] { "IsArabicPresentationForms-A", "ﭐ\ufe00" },
199 new string[2] { "IsArabicPresentationForms-B", "ﹰ\uff00" },
200 new string[2] { "IsArmenian", "\u0530\u0590" },
201 new string[2] { "IsArrows", "←∀" },
202 new string[2] { "IsBasicLatin", "\0\u0080" },
203 new string[2] { "IsBengali", "ঀ\u0a00" },
204 new string[2] { "IsBlockElements", "▀■" },
205 new string[2] { "IsBopomofo", "\u3100\u3130" },
206 new string[2] { "IsBopomofoExtended", "ㆠ㇀" },
207 new string[2] { "IsBoxDrawing", "─▀" },
208 new string[2] { "IsBraillePatterns", "⠀⤀" },
209 new string[2] { "IsBuhid", "ᝀᝠ" },
210 new string[2] { "IsCJKCompatibility", "㌀㐀" },
211 new string[2] { "IsCJKCompatibilityForms", "︰﹐" },
212 new string[2] { "IsCJKCompatibilityIdeographs", "豈ff" },
213 new string[2] { "IsCJKRadicalsSupplement", "⺀⼀" },
214 new string[2] { "IsCJKSymbolsandPunctuation", "\u3000\u3040" },
215 new string[2] { "IsCJKUnifiedIdeographs", "一ꀀ" },
216 new string[2] { "IsCJKUnifiedIdeographsExtensionA", "㐀䷀" },
217 new string[2] { "IsCherokee", "Ꭰ᐀" },
218 new string[2] { "IsCombiningDiacriticalMarks", "\u0300Ͱ" },
219 new string[2] { "IsCombiningDiacriticalMarksforSymbols", "\u20d0℀" },
220 new string[2] { "IsCombiningHalfMarks", "\ufe20︰" },
221 new string[2] { "IsCombiningMarksforSymbols", "\u20d0℀" },
222 new string[2] { "IsControlPictures", "␀⑀" },
223 new string[2] { "IsCurrencySymbols", "₠\u20d0" },
224 new string[2] { "IsCyrillic", "ЀԀ" },
225 new string[2] { "IsCyrillicSupplement", "Ԁ\u0530" },
226 new string[2] { "IsDevanagari", "\u0900ঀ" },
227 new string[2] { "IsDingbats", "✀⟀" },
228 new string[2] { "IsEnclosedAlphanumerics", "①─" },
229 new string[2] { "IsEnclosedCJKLettersandMonths", "㈀㌀" },
230 new string[2] { "IsEthiopic", "ሀᎀ" },
231 new string[2] { "IsGeneralPunctuation", "\u2000⁰" },
232 new string[2] { "IsGeometricShapes", "■☀" },
233 new string[2] { "IsGeorgian", "Ⴀᄀ" },
234 new string[2] { "IsGreek", "ͰЀ" },
235 new string[2] { "IsGreekExtended", "ἀ\u2000" },
236 new string[2] { "IsGreekandCoptic", "ͰЀ" },
237 new string[2] { "IsGujarati", "\u0a80\u0b00" },
238 new string[2] { "IsGurmukhi", "\u0a00\u0a80" },
239 new string[2] { "IsHalfwidthandFullwidthForms", "\uff00\ufff0" },
240 new string[2] { "IsHangulCompatibilityJamo", "\u3130㆐" },
241 new string[2] { "IsHangulJamo", "ᄀሀ" },
242 new string[2] { "IsHangulSyllables", "가ힰ" },
243 new string[2] { "IsHanunoo", "ᜠᝀ" },
244 new string[2] { "IsHebrew", "\u0590\u0600" },
245 new string[2] { "IsHighPrivateUseSurrogates", "\udb80\udc00" },
246 new string[2] { "IsHighSurrogates", "\ud800\udb80" },
247 new string[2] { "IsHiragana", "\u3040゠" },
248 new string[2] { "IsIPAExtensions", "ɐʰ" },
249 new string[2] { "IsIdeographicDescriptionCharacters", "⿰\u3000" },
250 new string[2] { "IsKanbun", "㆐ㆠ" },
251 new string[2] { "IsKangxiRadicals", "⼀\u2fe0" },
252 new string[2] { "IsKannada", "ಀ\u0d00" },
253 new string[2] { "IsKatakana", "゠\u3100" },
254 new string[2] { "IsKatakanaPhoneticExtensions", "ㇰ㈀" },
255 new string[2] { "IsKhmer", "ក᠀" },
256 new string[2] { "IsKhmerSymbols", "᧠ᨀ" },
257 new string[2] { "IsLao", "\u0e80ༀ" },
258 new string[2] { "IsLatin-1Supplement", "\u0080Ā" },
259 new string[2] { "IsLatinExtended-A", "Āƀ" },
260 new string[2] { "IsLatinExtended-B", "ƀɐ" },
261 new string[2] { "IsLatinExtendedAdditional", "Ḁἀ" },
262 new string[2] { "IsLetterlikeSymbols", "℀⅐" },
263 new string[2] { "IsLimbu", "ᤀᥐ" },
264 new string[2] { "IsLowSurrogates", "\udc00\ue000" },
265 new string[2] { "IsMalayalam", "\u0d00\u0d80" },
266 new string[2] { "IsMathematicalOperators", "∀⌀" },
267 new string[2] { "IsMiscellaneousMathematicalSymbols-A", "⟀⟰" },
268 new string[2] { "IsMiscellaneousMathematicalSymbols-B", "⦀⨀" },
269 new string[2] { "IsMiscellaneousSymbols", "☀✀" },
270 new string[2] { "IsMiscellaneousSymbolsandArrows", "⬀Ⰰ" },
271 new string[2] { "IsMiscellaneousTechnical", "⌀␀" },
272 new string[2] { "IsMongolian", "᠀ᢰ" },
273 new string[2] { "IsMyanmar", "ကႠ" },
274 new string[2] { "IsNumberForms", "⅐←" },
275 new string[2] { "IsOgham", "\u1680ᚠ" },
276 new string[2] { "IsOpticalCharacterRecognition", "⑀①" },
277 new string[2] { "IsOriya", "\u0b00\u0b80" },
278 new string[2] { "IsPhoneticExtensions", "ᴀᶀ" },
279 new string[2] { "IsPrivateUse", "\ue000豈" },
280 new string[2] { "IsPrivateUseArea", "\ue000豈" },
281 new string[2] { "IsRunic", "ᚠᜀ" },
282 new string[2] { "IsSinhala", "\u0d80\u0e00" },
283 new string[2] { "IsSmallFormVariants", "﹐ﹰ" },
284 new string[2] { "IsSpacingModifierLetters", "ʰ\u0300" },
285 new string[2] { "IsSpecials", "\ufff0" },
286 new string[2] { "IsSuperscriptsandSubscripts", "⁰₠" },
287 new string[2] { "IsSupplementalArrows-A", "⟰⠀" },
288 new string[2] { "IsSupplementalArrows-B", "⤀⦀" },
289 new string[2] { "IsSupplementalMathematicalOperators", "⨀⬀" },
290 new string[2] { "IsSyriac", "܀ݐ" },
291 new string[2] { "IsTagalog", "ᜀᜠ" },
292 new string[2] { "IsTagbanwa", "ᝠក" },
293 new string[2] { "IsTaiLe", "ᥐᦀ" },
294 new string[2] { "IsTamil", "\u0b80\u0c00" },
295 new string[2] { "IsTelugu", "\u0c00ಀ" },
296 new string[2] { "IsThaana", "ހ߀" },
297 new string[2] { "IsThai", "\u0e00\u0e80" },
298 new string[2] { "IsTibetan", "ༀက" },
299 new string[2] { "IsUnifiedCanadianAboriginalSyllabics", "᐀\u1680" },
300 new string[2] { "IsVariationSelectors", "\ufe00︐" },
301 new string[2] { "IsYiRadicals", "꒐ꓐ" },
302 new string[2] { "IsYiSyllables", "ꀀ꒐" },
303 new string[2] { "IsYijingHexagramSymbols", "䷀一" },
304 new string[2] { "_xmlC", "-/0;A[_`a{·\u00b8À×Ø÷øIJĴĿŁʼnŊſƀDŽǍDZǴǶǺȘɐʩʻ\u02c2ː\u02d2\u0300\u0346\u0360\u0362Ά\u038bΌ\u038dΎ\u03a2ΣϏϐϗϚϛϜϝϞϟϠϡϢϴЁЍЎѐёѝў҂\u0483\u0487ҐӅӇӉӋӍӐӬӮӶӸӺԱ\u0557ՙ՚աև\u0591\u05a2\u05a3\u05ba\u05bb־\u05bf׀\u05c1׃\u05c4\u05c5א\u05ebװ׳ءػـ\u0653٠٪\u0670ڸںڿۀۏې۔ە۩\u06eaۮ۰ۺ\u0901ऄअ\u093a\u093c\u094e\u0951\u0955क़।०॰\u0981\u0984অ\u098dএ\u0991ও\u09a9প\u09b1ল\u09b3শ\u09ba\u09bcঽ\u09be\u09c5\u09c7\u09c9\u09cbৎ\u09d7\u09d8ড়\u09deয়\u09e4০৲\u0a02\u0a03ਅ\u0a0bਏ\u0a11ਓ\u0a29ਪ\u0a31ਲ\u0a34ਵ\u0a37ਸ\u0a3a\u0a3c\u0a3d\u0a3e\u0a43\u0a47\u0a49\u0a4b\u0a4eਖ਼\u0a5dਫ਼\u0a5f੦\u0a75\u0a81\u0a84અઌઍ\u0a8eએ\u0a92ઓ\u0aa9પ\u0ab1લ\u0ab4વ\u0aba\u0abc\u0ac6\u0ac7\u0aca\u0acb\u0aceૠૡ૦૰\u0b01\u0b04ଅ\u0b0dଏ\u0b11ଓ\u0b29ପ\u0b31ଲ\u0b34ଶ\u0b3a\u0b3c\u0b44\u0b47\u0b49\u0b4b\u0b4e\u0b56\u0b58ଡ଼\u0b5eୟ\u0b62୦୰\u0b82\u0b84அ\u0b8bஎ\u0b91ஒ\u0b96ங\u0b9bஜ\u0b9dஞ\u0ba0ண\u0ba5ந\u0babமஶஷ\u0bba\u0bbe\u0bc3\u0bc6\u0bc9\u0bca\u0bce\u0bd7\u0bd8௧௰\u0c01\u0c04అ\u0c0dఎ\u0c11ఒ\u0c29పఴవ\u0c3a\u0c3e\u0c45\u0c46\u0c49\u0c4a\u0c4e\u0c55\u0c57ౠ\u0c62౦\u0c70\u0c82಄ಅ\u0c8dಎ\u0c91ಒ\u0ca9ಪ\u0cb4ವ\u0cba\u0cbe\u0cc5\u0cc6\u0cc9\u0cca\u0cce\u0cd5\u0cd7ೞ\u0cdfೠ\u0ce2೦\u0cf0\u0d02ഄഅ\u0d0dഎ\u0d11ഒഩപഺ\u0d3e\u0d44\u0d46\u0d49\u0d4aൎ\u0d57൘ൠ\u0d62൦൰กฯะ\u0e3bเ๏๐๚ກ\u0e83ຄ\u0e85ງຉຊ\u0e8bຍຎດຘນຠມ\u0ea4ລ\u0ea6ວຨສຬອຯະ\u0eba\u0ebb\u0ebeເ\u0ec5ໆ\u0ec7\u0ec8\u0ece໐\u0eda\u0f18༚༠༪\u0f35༶\u0f37༸\u0f39༺\u0f3e\u0f48ཉཪ\u0f71྅\u0f86ྌ\u0f90\u0f96\u0f97\u0f98\u0f99\u0fae\u0fb1\u0fb8\u0fb9\u0fbaႠ\u10c6აჷᄀᄁᄂᄄᄅᄈᄉᄊᄋᄍᄎᄓᄼᄽᄾᄿᅀᅁᅌᅍᅎᅏᅐᅑᅔᅖᅙᅚᅟᅢᅣᅤᅥᅦᅧᅨᅩᅪᅭᅯᅲᅴᅵᅶᆞᆟᆨᆩᆫᆬᆮᆰᆷᆹᆺᆻᆼᇃᇫᇬᇰᇱᇹᇺḀẜẠỺἀ\u1f16Ἐ\u1f1eἠ\u1f46Ὀ\u1f4eὐ\u1f58Ὑ\u1f5aὛ\u1f5cὝ\u1f5eὟ\u1f7eᾀ\u1fb5ᾶ\u1fbdι\u1fbfῂ\u1fc5ῆ\u1fcdῐ\u1fd4ῖ\u1fdcῠ\u1fedῲ\u1ff5ῶ\u1ffd\u20d0\u20dd\u20e1\u20e2Ω℧Kℬ℮ℯↀↃ々〆〇〈〡〰〱〶ぁゕ\u3099\u309bゝゟァ・ーヿㄅㄭ一龦가\ud7a4" },
305 new string[2] { "_xmlD", "0:٠٪۰ۺ०॰০ৰ੦\u0a70૦૰୦୰௧௰౦\u0c70೦\u0cf0൦൰๐๚໐\u0eda༠༪၀၊፩፲០\u17ea᠐\u181a0:" },
306 new string[2] { "_xmlI", ":;A[_`a{À×Ø÷øIJĴĿŁʼnŊſƀDŽǍDZǴǶǺȘɐʩʻ\u02c2Ά·Έ\u038bΌ\u038dΎ\u03a2ΣϏϐϗϚϛϜϝϞϟϠϡϢϴЁЍЎѐёѝў҂ҐӅӇӉӋӍӐӬӮӶӸӺԱ\u0557ՙ՚աևא\u05ebװ׳ءػف\u064bٱڸںڿۀۏې۔ە\u06d6ۥ\u06e7अ\u093aऽ\u093eक़\u0962অ\u098dএ\u0991ও\u09a9প\u09b1ল\u09b3শ\u09baড়\u09deয়\u09e2ৰ৲ਅ\u0a0bਏ\u0a11ਓ\u0a29ਪ\u0a31ਲ\u0a34ਵ\u0a37ਸ\u0a3aਖ਼\u0a5dਫ਼\u0a5fੲ\u0a75અઌઍ\u0a8eએ\u0a92ઓ\u0aa9પ\u0ab1લ\u0ab4વ\u0abaઽ\u0abeૠૡଅ\u0b0dଏ\u0b11ଓ\u0b29ପ\u0b31ଲ\u0b34ଶ\u0b3aଽ\u0b3eଡ଼\u0b5eୟ\u0b62அ\u0b8bஎ\u0b91ஒ\u0b96ங\u0b9bஜ\u0b9dஞ\u0ba0ண\u0ba5ந\u0babமஶஷ\u0bbaఅ\u0c0dఎ\u0c11ఒ\u0c29పఴవ\u0c3aౠ\u0c62ಅ\u0c8dಎ\u0c91ಒ\u0ca9ಪ\u0cb4ವ\u0cbaೞ\u0cdfೠ\u0ce2അ\u0d0dഎ\u0d11ഒഩപഺൠ\u0d62กฯะ\u0e31า\u0e34เๆກ\u0e83ຄ\u0e85ງຉຊ\u0e8bຍຎດຘນຠມ\u0ea4ລ\u0ea6ວຨສຬອຯະ\u0eb1າ\u0eb4ຽ\u0ebeເ\u0ec5ཀ\u0f48ཉཪႠ\u10c6აჷᄀᄁᄂᄄᄅᄈᄉᄊᄋᄍᄎᄓᄼᄽᄾᄿᅀᅁᅌᅍᅎᅏᅐᅑᅔᅖᅙᅚᅟᅢᅣᅤᅥᅦᅧᅨᅩᅪᅭᅯᅲᅴᅵᅶᆞᆟᆨᆩᆫᆬᆮᆰᆷᆹᆺᆻᆼᇃᇫᇬᇰᇱᇹᇺḀẜẠỺἀ\u1f16Ἐ\u1f1eἠ\u1f46Ὀ\u1f4eὐ\u1f58Ὑ\u1f5aὛ\u1f5cὝ\u1f5eὟ\u1f7eᾀ\u1fb5ᾶ\u1fbdι\u1fbfῂ\u1fc5ῆ\u1fcdῐ\u1fd4ῖ\u1fdcῠ\u1fedῲ\u1ff5ῶ\u1ffdΩ℧Kℬ℮ℯↀↃ〇〈〡\u302aぁゕァ・ㄅㄭ一龦가\ud7a4" },
307 new string[2] { "_xmlW", "$%+,0:<?A[^_`{|}~\u007f¢«¬\u00ad®·\u00b8»¼¿ÀȡȢȴɐʮʰ\u02ef\u0300\u0350\u0360ͰʹͶͺͻ\u0384·Έ\u038bΌ\u038dΎ\u03a2ΣϏϐϷЀ\u0487\u0488ӏӐӶӸӺԀԐԱ\u0557ՙ՚աֈ\u0591\u05a2\u05a3\u05ba\u05bb־\u05bf׀\u05c1׃\u05c4\u05c5א\u05ebװ׳ءػـ\u0656٠٪ٮ۔ە\u06dd۞ۮ۰ۿܐܭ\u0730\u074bހ\u07b2\u0901ऄअ\u093a\u093c\u094eॐ\u0955क़।०॰\u0981\u0984অ\u098dএ\u0991ও\u09a9প\u09b1ল\u09b3শ\u09ba\u09bcঽ\u09be\u09c5\u09c7\u09c9\u09cbৎ\u09d7\u09d8ড়\u09deয়\u09e4০৻\u0a02\u0a03ਅ\u0a0bਏ\u0a11ਓ\u0a29ਪ\u0a31ਲ\u0a34ਵ\u0a37ਸ\u0a3a\u0a3c\u0a3d\u0a3e\u0a43\u0a47\u0a49\u0a4b\u0a4eਖ਼\u0a5dਫ਼\u0a5f੦\u0a75\u0a81\u0a84અઌઍ\u0a8eએ\u0a92ઓ\u0aa9પ\u0ab1લ\u0ab4વ\u0aba\u0abc\u0ac6\u0ac7\u0aca\u0acb\u0aceૐ\u0ad1ૠૡ૦૰\u0b01\u0b04ଅ\u0b0dଏ\u0b11ଓ\u0b29ପ\u0b31ଲ\u0b34ଶ\u0b3a\u0b3c\u0b44\u0b47\u0b49\u0b4b\u0b4e\u0b56\u0b58ଡ଼\u0b5eୟ\u0b62୦ୱ\u0b82\u0b84அ\u0b8bஎ\u0b91ஒ\u0b96ங\u0b9bஜ\u0b9dஞ\u0ba0ண\u0ba5ந\u0babமஶஷ\u0bba\u0bbe\u0bc3\u0bc6\u0bc9\u0bca\u0bce\u0bd7\u0bd8௧௳\u0c01\u0c04అ\u0c0dఎ\u0c11ఒ\u0c29పఴవ\u0c3a\u0c3e\u0c45\u0c46\u0c49\u0c4a\u0c4e\u0c55\u0c57ౠ\u0c62౦\u0c70\u0c82಄ಅ\u0c8dಎ\u0c91ಒ\u0ca9ಪ\u0cb4ವ\u0cba\u0cbe\u0cc5\u0cc6\u0cc9\u0cca\u0cce\u0cd5\u0cd7ೞ\u0cdfೠ\u0ce2೦\u0cf0\u0d02ഄഅ\u0d0dഎ\u0d11ഒഩപഺ\u0d3e\u0d44\u0d46\u0d49\u0d4aൎ\u0d57൘ൠ\u0d62൦൰\u0d82\u0d84අ\u0d97ක\u0db2ඳ\u0dbcල\u0dbeව\u0dc7\u0dca\u0dcb\u0dcf\u0dd5\u0dd6\u0dd7\u0dd8\u0de0\u0df2෴ก\u0e3b฿๏๐๚ກ\u0e83ຄ\u0e85ງຉຊ\u0e8bຍຎດຘນຠມ\u0ea4ລ\u0ea6ວຨສຬອ\u0eba\u0ebb\u0ebeເ\u0ec5ໆ\u0ec7\u0ec8\u0ece໐\u0edaໜໞༀ༄༓༺\u0f3e\u0f48ཉཫ\u0f71྅\u0f86ྌ\u0f90\u0f98\u0f99\u0fbd྾\u0fcd࿏࿐ကဢဣဨဩ\u102b\u102c\u1033\u1036\u103a၀၊ၐၚႠ\u10c6აჹᄀᅚᅟᆣᆨᇺሀሇለቇቈ\u1249ቊ\u124eቐ\u1257ቘ\u1259ቚ\u125eበኇኈ\u1289ኊ\u128eነኯኰ\u12b1ኲ\u12b6ኸ\u12bfዀ\u12c1ዂ\u12c6ወዏዐ\u12d7ዘዯደጏጐ\u1311ጒ\u1316ጘጟጠፇፈ\u135b፩\u137dᎠᏵᐁ᙭ᙯᙷᚁ᚛ᚠ᛫ᛮᛱᜀ\u170dᜎ\u1715ᜠ᜵ᝀ\u1754ᝠ\u176dᝮ\u1771\u1772\u1774ក។ៗ៘៛\u17dd០\u17ea\u180b\u180e᠐\u181aᠠᡸᢀᢪḀẜẠỺἀ\u1f16Ἐ\u1f1eἠ\u1f46Ὀ\u1f4eὐ\u1f58Ὑ\u1f5aὛ\u1f5cὝ\u1f5eὟ\u1f7eᾀ\u1fb5ᾶ\u1fc5ῆ\u1fd4ῖ\u1fdc\u1fdd\u1ff0ῲ\u1ff5ῶ\u1fff⁄⁅⁒⁓⁰\u2072⁴⁽ⁿ₍₠₲\u20d0\u20eb℀℻ℽ⅌⅓ↄ←〈⌫⎴⎷⏏␀\u2427⑀\u244b①⓿─☔☖☘☙♾⚀⚊✁✅✆✊✌✨✩❌❍❎❏❓❖❗❘❟❡❨❶➕➘➰➱➿⟐⟦⟰⦃⦙⧘⧜⧼⧾⬀⺀\u2e9a⺛\u2ef4⼀\u2fd6⿰\u2ffc〄〈〒〔〠〰〱〽〾\u3040ぁ\u3097\u3099゠ァ・ー\u3100ㄅㄭㄱ\u318f㆐ㆸㇰ㈝㈠㉄㉑㉼㉿㋌㋐㋿㌀㍷㍻㏞㏠㏿㐀䶶一龦ꀀ\ua48d꒐\ua4c7가\ud7a4豈郞侮恵ff\ufb07ﬓ\ufb18יִ\ufb37טּ\ufb3dמּ\ufb3fנּ\ufb42ףּ\ufb45צּ\ufbb2ﯓ﴾ﵐ\ufd90ﶒ\ufdc8ﷰ﷽\ufe00︐\ufe20\ufe24﹢﹣﹤\ufe67﹩﹪ﹰ\ufe75ﹶ\ufefd$%+,0:<?A[\uff3e\uff3f\uff40{|}~⦅ヲ\uffbfᅡ\uffc8ᅧ\uffd0ᅭ\uffd8ᅳ\uffdd¢\uffe7│\uffef\ufffe" }
308 };
309
311
313
315
316 private bool _negate;
317
318 public bool CanMerge
319 {
320 get
321 {
322 if (!_negate)
323 {
324 return _subtractor == null;
325 }
326 return false;
327 }
328 }
329
330 public bool Negate
331 {
332 set
333 {
334 _negate = value;
335 }
336 }
337
339 {
340 }
341
349
350 public void AddChar(char c)
351 {
352 AddRange(c, c);
353 }
354
356 {
357 List<SingleRange> rangelist = cc._rangelist;
358 if (rangelist != null && rangelist.Count != 0)
359 {
360 EnsureRangeList().AddRange(cc._rangelist);
361 }
362 if (cc._categories != null)
363 {
364 EnsureCategories().Append(cc._categories);
365 }
366 }
367
369 {
370 if (cc.CanMerge && CanMerge)
371 {
373 return true;
374 }
375 return false;
376 }
377
379 {
380 return _categories ?? (_categories = new StringBuilder());
381 }
382
384 {
385 return _rangelist ?? (_rangelist = new List<SingleRange>(6));
386 }
387
388 private void AddSet(ReadOnlySpan<char> set)
389 {
390 if (set.Length != 0)
391 {
393 int i;
394 for (i = 0; i < set.Length - 1; i += 2)
395 {
396 list.Add(new SingleRange(set[i], (char)(set[i + 1] - 1)));
397 }
398 if (i < set.Length)
399 {
400 list.Add(new SingleRange(set[i], '\uffff'));
401 }
402 }
403 }
404
406 {
408 }
409
410 public void AddRange(char first, char last)
411 {
412 EnsureRangeList().Add(new SingleRange(first, last));
413 }
414
415 public void AddCategoryFromName(string categoryName, bool invert, bool caseInsensitive, string pattern, int currentPos)
416 {
417 if (s_definedCategories.TryGetValue(categoryName, out var value) && !categoryName.Equals("__InternalRegexIgnoreCase__"))
418 {
419 if (caseInsensitive && (categoryName.Equals("Ll") || categoryName.Equals("Lu") || categoryName.Equals("Lt")))
420 {
421 value = s_definedCategories["__InternalRegexIgnoreCase__"];
422 }
424 if (invert)
425 {
426 for (int i = 0; i < value.Length; i++)
427 {
428 short num = (short)value[i];
429 stringBuilder.Append((char)(-num));
430 }
431 }
432 else
433 {
434 stringBuilder.Append(value);
435 }
436 }
437 else
438 {
440 }
441 }
442
443 private void AddCategory(string category)
444 {
445 EnsureCategories().Append(category);
446 }
447
449 {
451 if (rangelist == null)
452 {
453 return;
454 }
455 int count = rangelist.Count;
456 for (int i = 0; i < count; i++)
457 {
459 if (singleRange.First == singleRange.Last)
460 {
461 char c = culture.TextInfo.ToLower(singleRange.First);
462 rangelist[i] = new SingleRange(c, c);
463 }
464 else
465 {
467 }
468 }
469 }
470
471 private void AddLowercaseRange(char chMin, char chMax)
472 {
473 int i = 0;
474 int num = s_lcTable.Length;
475 while (i < num)
476 {
477 int num2 = i + num >> 1;
478 if (s_lcTable[num2].ChMax < chMin)
479 {
480 i = num2 + 1;
481 }
482 else
483 {
484 num = num2;
485 }
486 }
487 if (i >= s_lcTable.Length)
488 {
489 return;
490 }
491 for (; i < s_lcTable.Length; i++)
492 {
495 if (lowerCaseMapping2.ChMin <= chMax)
496 {
497 char c;
498 if ((c = lowerCaseMapping.ChMin) < chMin)
499 {
500 c = chMin;
501 }
502 char c2;
503 if ((c2 = lowerCaseMapping.ChMax) > chMax)
504 {
505 c2 = chMax;
506 }
507 switch (lowerCaseMapping.LcOp)
508 {
509 case 0:
510 c = (char)lowerCaseMapping.Data;
511 c2 = (char)lowerCaseMapping.Data;
512 break;
513 case 1:
514 c = (char)(c + (ushort)lowerCaseMapping.Data);
515 c2 = (char)(c2 + (ushort)lowerCaseMapping.Data);
516 break;
517 case 2:
518 c = (char)(c | 1u);
519 c2 = (char)(c2 | 1u);
520 break;
521 case 3:
522 c = (char)(c + (ushort)(c & 1));
523 c2 = (char)(c2 + (ushort)(c2 & 1));
524 break;
525 }
527 {
528 AddRange(c, c2);
529 }
530 continue;
531 }
532 break;
533 }
534 }
535
536 public void AddWord(bool ecma, bool negate)
537 {
538 if (ecma)
539 {
540 AddSet(negate ? "\00:A[_`a{İı" : "0:A[_`a{İı");
541 }
542 else
543 {
544 AddCategory(negate ? "\0\ufffe\ufffb\ufffd\uffff\ufffa\ufff7■\0" : "\0\u0002\u0004\u0005\u0003\u0001\u0006\t\u0013\0");
545 }
546 }
547
548 public void AddSpace(bool ecma, bool negate)
549 {
550 if (ecma)
551 {
552 AddSet(negate ? "\0\t\u000e !" : "\t\u000e !");
553 }
554 else
555 {
556 AddCategory(negate ? "ワ" : "d");
557 }
558 }
559
560 public void AddDigit(bool ecma, bool negate, string pattern, int currentPos)
561 {
562 if (ecma)
563 {
564 AddSet(negate ? "\00:" : "0:");
565 }
566 else
567 {
568 AddCategoryFromName("Nd", negate, caseInsensitive: false, pattern, currentPos);
569 }
570 }
571
572 public static string ConvertOldStringsToClass(string set, string category)
573 {
574 bool flag = set.Length >= 2 && set[0] == '\0' && set[1] == '\0';
575 int num = 3 + set.Length + category.Length;
576 if (flag)
577 {
578 num -= 2;
579 }
580 return string.Create(num, (set, category, flag), delegate(Span<char> span, (string set, string category, bool startsWithNulls) state)
581 {
582 int start;
583 if (state.startsWithNulls)
584 {
585 span[0] = '\u0001';
586 span[1] = (char)(state.set.Length - 2);
587 span[2] = (char)state.category.Length;
588 state.set.AsSpan(2).CopyTo(span.Slice(3));
589 start = 3 + state.set.Length - 2;
590 }
591 else
592 {
593 span[0] = '\0';
594 span[1] = (char)state.set.Length;
595 span[2] = (char)state.category.Length;
596 state.set.CopyTo(span.Slice(3));
597 start = 3 + state.set.Length;
598 }
599 state.category.CopyTo(span.Slice(start));
600 });
601 }
602
603 public static char SingletonChar(string set)
604 {
605 return set[3];
606 }
607
608 public static bool IsMergeable(string charClass)
609 {
610 if (charClass != null && !IsNegated(charClass))
611 {
612 return !IsSubtraction(charClass);
613 }
614 return false;
615 }
616
617 public static bool IsEmpty(string charClass)
618 {
619 if (charClass[2] == '\0' && charClass[1] == '\0' && !IsNegated(charClass))
620 {
621 return !IsSubtraction(charClass);
622 }
623 return false;
624 }
625
626 public static bool IsSingleton(string set)
627 {
628 if (set[2] == '\0' && set[1] == '\u0002' && !IsNegated(set) && !IsSubtraction(set))
629 {
630 if (set[3] != '\uffff')
631 {
632 return set[3] + 1 == set[4];
633 }
634 return true;
635 }
636 return false;
637 }
638
639 public static bool IsSingletonInverse(string set)
640 {
641 if (set[2] == '\0' && set[1] == '\u0002' && IsNegated(set) && !IsSubtraction(set))
642 {
643 if (set[3] != '\uffff')
644 {
645 return set[3] + 1 == set[4];
646 }
647 return true;
648 }
649 return false;
650 }
651
652 public static bool TryGetSingleUnicodeCategory(string set, out UnicodeCategory category, out bool negated)
653 {
654 if (set[2] == '\u0001' && set[1] == '\0' && !IsSubtraction(set))
655 {
656 short num = (short)set[3];
657 if (num > 0)
658 {
659 if (num != 100)
660 {
661 category = (UnicodeCategory)(num - 1);
662 negated = IsNegated(set);
663 return true;
664 }
665 }
666 else if (num < 0 && num != -100)
667 {
668 category = (UnicodeCategory)(-1 - num);
669 negated = !IsNegated(set);
670 return true;
671 }
672 }
673 category = UnicodeCategory.UppercaseLetter;
674 negated = false;
675 return false;
676 }
677
678 public static bool TryGetSingleRange(string set, out char lowInclusive, out char highInclusive)
679 {
680 if (set[2] == '\0' && set.Length == 3 + set[1])
681 {
682 switch (set[1])
683 {
684 case '\u0001':
685 lowInclusive = set[3];
686 highInclusive = '\uffff';
687 return true;
688 case '\u0002':
689 lowInclusive = set[3];
690 highInclusive = (char)(set[4] - 1);
691 return true;
692 }
693 }
694 lowInclusive = (highInclusive = '\0');
695 return false;
696 }
697
698 public static int GetSetChars(string set, Span<char> chars)
699 {
701 {
702 return 0;
703 }
704 int num = set[1];
705 int num2 = 0;
706 for (int i = 3; i < 3 + num; i += 2)
707 {
708 int num3 = set[i + 1];
709 for (int j = set[i]; j < num3; j++)
710 {
711 if (num2 >= chars.Length)
712 {
713 return 0;
714 }
715 chars[num2++] = (char)j;
716 }
717 }
718 return num2;
719 }
720
721 public static bool MayOverlap(string set1, string set2)
722 {
723 if (set1 == set2)
724 {
725 return true;
726 }
727 if (set1 == "\0\u0001\0\0" || set2 == "\0\u0001\0\0")
728 {
729 return true;
730 }
731 bool flag = IsNegated(set1);
732 bool flag2 = IsNegated(set2);
733 if (flag != flag2)
734 {
735 return !set1.AsSpan(1).SequenceEqual(set2.AsSpan(1));
736 }
737 if (flag)
738 {
739 return true;
740 }
742 {
743 return false;
744 }
746 {
748 }
750 {
752 }
753 return true;
754 static bool KnownDistinctSets(string set1, string set2)
755 {
756 if (set1 == "\0\0\u0001d" || set1 == "\0\u0004\0\t\u000e !")
757 {
758 switch (set2)
759 {
760 default:
761 return set2 == "\0\n\00:A[_`a{İı";
762 case "\0\0\u0001\t":
763 case "\0\0\n\0\u0002\u0004\u0005\u0003\u0001\u0006\t\u0013\0":
764 case "\0\u0002\00:":
765 return true;
766 }
767 }
768 return false;
769 }
770 static bool MayOverlapByEnumeration(string set1, string set2)
771 {
772 for (int i = 3; i < 3 + set2[1]; i += 2)
773 {
774 int num = set2[i + 1];
775 for (int j = set2[i]; j < num; j++)
776 {
777 if (CharInClass((char)j, set1))
778 {
779 return true;
780 }
781 }
782 }
783 return false;
784 }
785 }
786
787 private static bool CanEasilyEnumerateSetContents(string set)
788 {
789 if (set.Length > 3 && set[1] > '\0' && set[1] % 2 == 0 && set[2] == '\0')
790 {
791 return !IsSubtraction(set);
792 }
793 return false;
794 }
795
796 internal static CharClassAnalysisResults Analyze(string set)
797 {
799 {
800 return default(CharClassAnalysisResults);
801 }
803 if (IsNegated(set))
804 {
805 result = default(CharClassAnalysisResults);
806 result.AllNonAsciiContained = set[^1] < '\u0080';
807 result.AllAsciiContained = set[3] >= '\u0080';
808 result.ContainsNoAscii = false;
809 result.ContainsOnlyAscii = false;
810 return result;
811 }
812 result = default(CharClassAnalysisResults);
813 result.AllNonAsciiContained = false;
814 result.AllAsciiContained = false;
815 result.ContainsOnlyAscii = set[^1] <= '\u0080';
816 result.ContainsNoAscii = set[3] >= '\u0080';
817 return result;
818 }
819
820 internal static bool IsSubtraction(string charClass)
821 {
822 return charClass.Length > 3 + charClass[2] + charClass[1];
823 }
824
825 internal static bool IsNegated(string set)
826 {
827 return set[0] == '\u0001';
828 }
829
830 internal static bool IsNegated(string set, int setOffset)
831 {
832 return set[setOffset] == '\u0001';
833 }
834
835 public static bool IsECMAWordChar(char ch)
836 {
837 if (((uint)(ch - 65) & -33) >= 26 && (uint)(ch - 48) >= 10u && ch != '_')
838 {
839 return ch == 'İ';
840 }
841 return true;
842 }
843
844 public static bool IsWordChar(char ch)
845 {
847 int num = (int)ch >> 3;
848 if ((uint)num < readOnlySpan.Length)
849 {
850 return (readOnlySpan[num] & (1 << (ch & 7))) != 0;
851 }
853 if ((uint)unicodeCategory <= 5u || unicodeCategory == UnicodeCategory.DecimalDigitNumber || unicodeCategory == UnicodeCategory.ConnectorPunctuation)
854 {
855 return true;
856 }
857 if (ch != '\u200d')
858 {
859 return ch == '\u200c';
860 }
861 return true;
863 {
864 return new byte[16]
865 {
866 0, 0, 0, 0, 0, 0, 255, 3, 254, 255,
867 255, 135, 254, 255, 255, 7
868 };
869 }
870 }
871
872 public static bool CharInClass(char ch, string set, ref int[] asciiResultCache)
873 {
874 if (ch < '\u0080')
875 {
876 if (asciiResultCache == null)
877 {
879 }
880 ref int reference = ref asciiResultCache[(int)ch >> 4];
881 int num = 1 << ((ch & 0xF) << 1);
882 int num2 = num << 1;
883 int num3 = reference;
884 if ((num3 & num) != 0)
885 {
886 return (num3 & num2) != 0;
887 }
888 bool flag = CharInClass(ch, set);
889 int num4 = num;
890 if (flag)
891 {
892 num4 |= num2;
893 }
895 return flag;
896 }
897 return CharInClassRecursive(ch, set, 0);
898 }
899
900 public static bool CharInClass(char ch, string set)
901 {
902 return CharInClassRecursive(ch, set, 0);
903 }
904
905 private static bool CharInClassRecursive(char ch, string set, int start)
906 {
907 int num = set[start + 1];
908 int num2 = set[start + 2];
909 int num3 = start + 3 + num + num2;
910 bool flag = CharInClassInternal(ch, set, start, num, num2);
911 if (IsNegated(set, start))
912 {
913 flag = !flag;
914 }
915 if (flag && set.Length > num3)
916 {
917 flag = !CharInClassRecursive(ch, set, num3);
918 }
919 return flag;
920 }
921
922 private static bool CharInClassInternal(char ch, string set, int start, int setLength, int categoryLength)
923 {
924 int num = start + 3;
925 int num2 = num + setLength;
926 while (num != num2)
927 {
928 int num3 = num + num2 >> 1;
929 if (ch < set[num3])
930 {
931 num2 = num3;
932 }
933 else
934 {
935 num = num3 + 1;
936 }
937 }
938 if ((num & 1) == (start & 1))
939 {
940 return true;
941 }
942 if (categoryLength == 0)
943 {
944 return false;
945 }
947 }
948
949 private static bool CharInCategory(char ch, string set, int start, int setLength, int categoryLength)
950 {
951 UnicodeCategory unicodeCategory = char.GetUnicodeCategory(ch);
952 int i = start + 3 + setLength;
953 for (int num = i + categoryLength; i < num; i++)
954 {
955 int num2 = (short)set[i];
956 if (num2 == 0)
957 {
959 {
960 return true;
961 }
962 }
963 else if (num2 > 0)
964 {
965 if (num2 == 100)
966 {
967 if (char.IsWhiteSpace(ch))
968 {
969 return true;
970 }
971 }
972 else if (unicodeCategory == (UnicodeCategory)(num2 - 1))
973 {
974 return true;
975 }
976 }
977 else if (num2 == -100)
978 {
979 if (!char.IsWhiteSpace(ch))
980 {
981 return true;
982 }
983 }
984 else if (unicodeCategory != (UnicodeCategory)(-1 - num2))
985 {
986 return true;
987 }
988 }
989 return false;
990 }
991
992 private static bool CharInCategoryGroup(UnicodeCategory chcategory, string category, ref int i)
993 {
994 int num = i + 1;
995 int num2 = (short)category[num];
996 bool flag;
997 if (num2 > 0)
998 {
999 flag = false;
1000 while (num2 != 0)
1001 {
1002 num++;
1003 if (!flag && chcategory == (UnicodeCategory)(num2 - 1))
1004 {
1005 flag = true;
1006 }
1007 num2 = (short)category[num];
1008 }
1009 }
1010 else
1011 {
1012 flag = true;
1013 while (num2 != 0)
1014 {
1015 num++;
1016 if (flag && chcategory == (UnicodeCategory)(-1 - num2))
1017 {
1018 flag = false;
1019 }
1020 num2 = (short)category[num];
1021 }
1022 }
1023 i = num;
1024 return flag;
1025 }
1026
1027 public static RegexCharClass Parse(string charClass)
1028 {
1029 return ParseRecursive(charClass, 0);
1030 }
1031
1032 private static RegexCharClass ParseRecursive(string charClass, int start)
1033 {
1034 int num = charClass[start + 1];
1035 int num2 = charClass[start + 2];
1036 int num3 = start + 3 + num + num2;
1037 int num4 = start + 3;
1038 int num5 = num4 + num;
1039 List<SingleRange> list = null;
1040 if (num > 0)
1041 {
1042 list = new List<SingleRange>(num);
1043 while (num4 < num5)
1044 {
1045 char first = charClass[num4];
1046 num4++;
1047 char last = ((num4 < num5) ? ((char)(charClass[num4] - 1)) : '\uffff');
1048 num4++;
1049 list.Add(new SingleRange(first, last));
1050 }
1051 }
1053 if (charClass.Length > num3)
1054 {
1056 }
1058 if (num2 > 0)
1059 {
1061 }
1063 }
1064
1065 public string ToStringClass()
1066 {
1070 return vsb.ToString();
1071 }
1072
1074 {
1075 Canonicalize();
1076 int length = vsb.Length;
1077 int num = _categories?.Length ?? 0;
1078 Span<char> span = vsb.AppendSpan(3);
1079 span[0] = (char)(_negate ? 1u : 0u);
1080 span[1] = '\0';
1081 span[2] = (char)num;
1083 if (rangelist != null)
1084 {
1085 for (int i = 0; i < rangelist.Count; i++)
1086 {
1088 vsb.Append(singleRange.First);
1089 if (singleRange.Last != '\uffff')
1090 {
1091 vsb.Append((char)(singleRange.Last + 1));
1092 }
1093 }
1094 }
1095 vsb[length + 1] = (char)(vsb.Length - length - 3);
1096 if (num != 0)
1097 {
1099 while (enumerator.MoveNext())
1100 {
1101 vsb.Append(enumerator.Current.Span);
1102 }
1103 }
1105 }
1106
1107 private void Canonicalize()
1108 {
1110 if (rangelist == null)
1111 {
1112 return;
1113 }
1114 if (rangelist.Count > 1)
1115 {
1116 rangelist.Sort((SingleRange x, SingleRange y) => x.First.CompareTo(y.First));
1117 bool flag = false;
1118 int num = 0;
1119 int num2 = 1;
1120 while (true)
1121 {
1122 char last = rangelist[num].Last;
1123 while (true)
1124 {
1125 if (num2 == rangelist.Count || last == '\uffff')
1126 {
1127 flag = true;
1128 break;
1129 }
1132 if (singleRange2.First > last + 1)
1133 {
1134 break;
1135 }
1136 if (last < singleRange.Last)
1137 {
1138 last = singleRange.Last;
1139 }
1140 num2++;
1141 }
1142 rangelist[num] = new SingleRange(rangelist[num].First, last);
1143 num++;
1144 if (flag)
1145 {
1146 break;
1147 }
1148 if (num < num2)
1149 {
1150 rangelist[num] = rangelist[num2];
1151 }
1152 num2++;
1153 }
1154 rangelist.RemoveRange(num, rangelist.Count - num);
1155 }
1156 if (_negate || _subtractor != null || (_categories != null && _categories.Length != 0))
1157 {
1158 return;
1159 }
1160 if (rangelist.Count == 2)
1161 {
1162 if (rangelist[0].First == '\0' && rangelist[0].Last == (ushort)(rangelist[1].First - 2) && rangelist[1].Last == '\uffff')
1163 {
1164 char c = (char)(rangelist[0].Last + 1);
1165 rangelist.RemoveAt(1);
1166 rangelist[0] = new SingleRange(c, c);
1167 _negate = true;
1168 }
1169 }
1170 else
1171 {
1172 if (rangelist.Count != 1)
1173 {
1174 return;
1175 }
1176 if (rangelist[0].First == '\0')
1177 {
1178 if (rangelist[0].Last == '\ufffe')
1179 {
1180 rangelist[0] = new SingleRange('\uffff', '\uffff');
1181 _negate = true;
1182 }
1183 }
1184 else if (rangelist[0].First == '\u0001' && rangelist[0].Last == '\uffff')
1185 {
1186 rangelist[0] = new SingleRange('\0', '\0');
1187 _negate = true;
1188 }
1189 }
1190 }
1191
1192 private static ReadOnlySpan<char> SetFromProperty(string capname, bool invert, string pattern, int currentPos)
1193 {
1194 int num = 0;
1195 int num2 = s_propTable.Length;
1196 while (num != num2)
1197 {
1198 int num3 = (num + num2) / 2;
1199 int num4 = string.Compare(capname, s_propTable[num3][0], StringComparison.Ordinal);
1200 if (num4 < 0)
1201 {
1202 num2 = num3;
1203 continue;
1204 }
1205 if (num4 > 0)
1206 {
1207 num = num3 + 1;
1208 continue;
1209 }
1210 string text = s_propTable[num3][1];
1211 if (invert)
1212 {
1213 if (text[0] != 0)
1214 {
1215 return "\0" + text;
1216 }
1217 return text.AsSpan(1);
1218 }
1219 return text;
1220 }
1222 }
1223}
void CopyTo(KeyValuePair< TKey, TValue >[] array, int index)
void AddRange(IEnumerable< KeyValuePair< TKey, TValue > > collection)
void Add(TKey key, TValue value)
static UnicodeCategory GetUnicodeCategory(char ch)
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string UnrecognizedUnicodeProperty
Definition SR.cs:96
static string MakeException
Definition SR.cs:56
Definition SR.cs:7
static readonly Dictionary< string, string > s_definedCategories
static string ConvertOldStringsToClass(string set, string category)
static bool CharInClassInternal(char ch, string set, int start, int setLength, int categoryLength)
void ToStringClass(ref System.Text.ValueStringBuilder vsb)
static int GetSetChars(string set, Span< char > chars)
static RegexCharClass ParseRecursive(string charClass, int start)
static bool CharInClass(char ch, string set)
void AddLowercaseRange(char chMin, char chMax)
static bool IsNegated(string set, int setOffset)
static bool TryGetSingleRange(string set, out char lowInclusive, out char highInclusive)
static bool CharInClassRecursive(char ch, string set, int start)
static readonly LowerCaseMapping[] s_lcTable
void AddDigit(bool ecma, bool negate, string pattern, int currentPos)
static bool IsSubtraction(string charClass)
static bool CharInCategory(char ch, string set, int start, int setLength, int categoryLength)
static bool CharInClass(char ch, string set, ref int[] asciiResultCache)
static bool TryGetSingleUnicodeCategory(string set, out UnicodeCategory category, out bool negated)
static bool CanEasilyEnumerateSetContents(string set)
void AddCategoryFromName(string categoryName, bool invert, bool caseInsensitive, string pattern, int currentPos)
static bool MayOverlap(string set1, string set2)
static bool CharInCategoryGroup(UnicodeCategory chcategory, string category, ref int i)
RegexCharClass(bool negate, List< SingleRange > ranges, StringBuilder categories, RegexCharClass subtraction)
static CharClassAnalysisResults Analyze(string set)
static RegexCharClass Parse(string charClass)
static ReadOnlySpan< char > SetFromProperty(string capname, bool invert, string pattern, int currentPos)
static bool IsMergeable(string charClass)
ChunkEnumerator GetChunks()
StringBuilder Append(char value, int repeatCount)
static int CompareExchange(ref int location1, int value, int comparand)
static int Or(ref int location1, int value)
LowerCaseMapping(char chMin, char chMax, int lcOp, int data)