Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
RegexCode.cs
Go to the documentation of this file.
2
4
5internal sealed class RegexCode
6{
8
9 public readonly int[] Codes;
10
11 public readonly string[] Strings;
12
14
15 public readonly int TrackCount;
16
18
19 public readonly int CapSize;
20
21 public readonly (string CharClass, bool CaseInsensitive)[] LeadingCharClasses;
22
24
26
28
29 public readonly bool RightToLeft;
30
31 public RegexCode(RegexTree tree, int[] codes, string[] strings, int trackcount, Hashtable caps, int capsize, RegexBoyerMoore boyerMoorePrefix, (string CharClass, bool CaseInsensitive)[] leadingCharClasses, int leadingAnchor, bool rightToLeft)
32 {
33 Tree = tree;
34 Codes = codes;
35 Strings = strings;
36 StringsAsciiLookup = new int[strings.Length][];
37 TrackCount = trackcount;
38 Caps = caps;
39 CapSize = capsize;
40 BoyerMoorePrefix = boyerMoorePrefix;
41 LeadingCharClasses = leadingCharClasses;
42 LeadingAnchor = leadingAnchor;
43 RightToLeft = rightToLeft;
44 }
45
46 public static bool OpcodeBacktracks(int Op)
47 {
48 Op &= 0x3F;
49 switch (Op)
50 {
51 case 3:
52 case 4:
53 case 5:
54 case 6:
55 case 7:
56 case 8:
57 case 23:
58 case 24:
59 case 25:
60 case 26:
61 case 27:
62 case 28:
63 case 29:
64 case 31:
65 case 32:
66 case 33:
67 case 34:
68 case 35:
69 case 36:
70 case 38:
71 return true;
72 default:
73 return false;
74 }
75 }
76
77 public static int OpcodeSize(int opcode)
78 {
79 opcode &= 0x3F;
80 switch (opcode)
81 {
82 case 14:
83 case 15:
84 case 16:
85 case 17:
86 case 18:
87 case 19:
88 case 20:
89 case 21:
90 case 22:
91 case 30:
92 case 31:
93 case 33:
94 case 34:
95 case 35:
96 case 36:
97 case 40:
98 case 41:
99 case 42:
100 case 46:
101 return 1;
102 case 9:
103 case 10:
104 case 11:
105 case 12:
106 case 13:
107 case 23:
108 case 24:
109 case 25:
110 case 26:
111 case 27:
112 case 37:
113 case 38:
114 return 2;
115 case 0:
116 case 1:
117 case 2:
118 case 3:
119 case 4:
120 case 5:
121 case 6:
122 case 7:
123 case 8:
124 case 28:
125 case 29:
126 case 32:
127 case 43:
128 case 44:
129 case 45:
130 return 3;
131 default:
132 throw new ArgumentException(System.SR.Format(System.SR.UnexpectedOpcode, opcode.ToString()));
133 }
134 }
135}
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string UnexpectedOpcode
Definition SR.cs:94
Definition SR.cs:7
static int OpcodeSize(int opcode)
Definition RegexCode.cs:77
readonly RegexBoyerMoore BoyerMoorePrefix
Definition RegexCode.cs:25
readonly(string CharClass, bool CaseInsensitive)[] LeadingCharClasses
RegexCode(RegexTree tree, int[] codes, string[] strings, int trackcount, Hashtable caps, int capsize, RegexBoyerMoore boyerMoorePrefix,(string CharClass, bool CaseInsensitive)[] leadingCharClasses, int leadingAnchor, bool rightToLeft)
Definition RegexCode.cs:31