Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ScanDollar()

RegexNode System.Text.RegularExpressions.RegexParser.ScanDollar ( )
inlineprivate

Definition at line 1157 of file RegexParser.cs.

1158 {
1159 if (CharsRight() == 0)
1160 {
1161 return new RegexNode(9, _options, '$');
1162 }
1163 char c = RightChar();
1164 int num = Textpos();
1165 int pos = num;
1166 bool flag;
1167 if (c == '{' && CharsRight() > 1)
1168 {
1169 flag = true;
1170 MoveRight();
1171 c = RightChar();
1172 }
1173 else
1174 {
1175 flag = false;
1176 }
1177 if (c >= '0' && c <= '9')
1178 {
1179 if (!flag && UseOptionE())
1180 {
1181 int num2 = -1;
1182 int num3 = c - 48;
1183 MoveRight();
1184 if (IsCaptureSlot(num3))
1185 {
1186 num2 = num3;
1187 pos = Textpos();
1188 }
1189 while (CharsRight() > 0 && (c = RightChar()) >= '0' && c <= '9')
1190 {
1191 int num4 = c - 48;
1192 if (num3 > 214748364 || (num3 == 214748364 && num4 > 7))
1193 {
1194 throw MakeException(RegexParseError.QuantifierOrCaptureGroupOutOfRange, System.SR.QuantifierOrCaptureGroupOutOfRange);
1195 }
1196 num3 = num3 * 10 + num4;
1197 MoveRight();
1198 if (IsCaptureSlot(num3))
1199 {
1200 num2 = num3;
1201 pos = Textpos();
1202 }
1203 }
1204 Textto(pos);
1205 if (num2 >= 0)
1206 {
1207 return new RegexNode(13, _options, num2);
1208 }
1209 }
1210 else
1211 {
1212 int num5 = ScanDecimal();
1213 if ((!flag || (CharsRight() > 0 && RightCharMoveRight() == '}')) && IsCaptureSlot(num5))
1214 {
1215 return new RegexNode(13, _options, num5);
1216 }
1217 }
1218 }
1219 else if (flag && RegexCharClass.IsWordChar(c))
1220 {
1221 string capname = ScanCapname();
1222 if (CharsRight() > 0 && RightCharMoveRight() == '}' && IsCaptureName(capname))
1223 {
1224 return new RegexNode(13, _options, CaptureSlotFromName(capname));
1225 }
1226 }
1227 else if (!flag)
1228 {
1229 int num6 = 1;
1230 switch (c)
1231 {
1232 case '$':
1233 MoveRight();
1234 return new RegexNode(9, _options, '$');
1235 case '&':
1236 num6 = 0;
1237 break;
1238 case '`':
1239 num6 = -1;
1240 break;
1241 case '\'':
1242 num6 = -2;
1243 break;
1244 case '+':
1245 num6 = -3;
1246 break;
1247 case '_':
1248 num6 = -4;
1249 break;
1250 }
1251 if (num6 != 1)
1252 {
1253 MoveRight();
1254 return new RegexNode(13, _options, num6);
1255 }
1256 }
1257 Textto(num);
1258 return new RegexNode(9, _options, '$');
1259 }
static string QuantifierOrCaptureGroupOutOfRange
Definition SR.cs:24
Definition SR.cs:7
RegexParseException MakeException(RegexParseError error, string message)

References System.Text.RegularExpressions.RegexParser._options, System.Text.RegularExpressions.RegexParser.CaptureSlotFromName(), System.Text.RegularExpressions.RegexParser.CharsRight(), System.Text.RegularExpressions.RegexParser.IsCaptureName(), System.Text.RegularExpressions.RegexParser.IsCaptureSlot(), System.Text.RegularExpressions.RegexCharClass.IsWordChar(), System.Text.RegularExpressions.RegexParser.MakeException(), System.Text.RegularExpressions.RegexParser.MoveRight(), System.SR.QuantifierOrCaptureGroupOutOfRange, System.Text.RegularExpressions.RegexParser.RightChar(), System.Text.RegularExpressions.RegexParser.RightCharMoveRight(), System.Text.RegularExpressions.RegexParser.ScanCapname(), System.Text.RegularExpressions.RegexParser.ScanDecimal(), System.Text.RegularExpressions.RegexParser.Textpos(), System.Text.RegularExpressions.RegexParser.Textto(), and System.Text.RegularExpressions.RegexParser.UseOptionE().

Referenced by System.Text.RegularExpressions.RegexParser.ScanReplacement().