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

◆ SkipUntilAsync()

async Task System.Xml.XmlTextReaderImpl.SkipUntilAsync ( char stopChar,
bool recognizeLiterals )
inlineprivate

Definition at line 12281 of file XmlTextReaderImpl.cs.

12282 {
12283 bool inLiteral = false;
12284 bool inComment = false;
12285 bool inPI = false;
12286 char literalQuote = '"';
12287 char[] chars = _ps.chars;
12288 int num = _ps.charPos;
12289 while (true)
12290 {
12291 char c;
12292 if (XmlCharType.IsAttributeValueChar(c = chars[num]) && c != stopChar && c != '-' && c != '?')
12293 {
12294 num++;
12295 continue;
12296 }
12297 if (c == stopChar && !inLiteral)
12298 {
12299 break;
12300 }
12301 _ps.charPos = num;
12302 switch (c)
12303 {
12304 case '\n':
12305 num++;
12306 OnNewLine(num);
12307 continue;
12308 case '\r':
12309 if (chars[num + 1] == '\n')
12310 {
12311 num += 2;
12312 }
12313 else
12314 {
12315 if (num + 1 >= _ps.charsUsed && !_ps.isEof)
12316 {
12317 break;
12318 }
12319 num++;
12320 }
12321 OnNewLine(num);
12322 continue;
12323 case '<':
12324 if (chars[num + 1] == '?')
12325 {
12327 {
12328 inPI = true;
12329 num += 2;
12330 continue;
12331 }
12332 }
12333 else if (chars[num + 1] == '!')
12334 {
12335 if (num + 3 >= _ps.charsUsed && !_ps.isEof)
12336 {
12337 break;
12338 }
12339 if (chars[num + 2] == '-' && chars[num + 3] == '-' && recognizeLiterals && !inLiteral && !inPI)
12340 {
12341 inComment = true;
12342 num += 4;
12343 continue;
12344 }
12345 }
12346 else if (num + 1 >= _ps.charsUsed && !_ps.isEof)
12347 {
12348 break;
12349 }
12350 num++;
12351 continue;
12352 case '-':
12353 if (inComment)
12354 {
12355 if (num + 2 >= _ps.charsUsed && !_ps.isEof)
12356 {
12357 break;
12358 }
12359 if (chars[num + 1] == '-' && chars[num + 2] == '>')
12360 {
12361 inComment = false;
12362 num += 2;
12363 continue;
12364 }
12365 }
12366 num++;
12367 continue;
12368 case '?':
12369 if (inPI)
12370 {
12371 if (num + 1 >= _ps.charsUsed && !_ps.isEof)
12372 {
12373 break;
12374 }
12375 if (chars[num + 1] == '>')
12376 {
12377 inPI = false;
12378 num++;
12379 continue;
12380 }
12381 }
12382 num++;
12383 continue;
12384 case '\t':
12385 case '&':
12386 case '>':
12387 case ']':
12388 num++;
12389 continue;
12390 case '"':
12391 case '\'':
12392 if (inLiteral)
12393 {
12394 if (literalQuote == c)
12395 {
12396 inLiteral = false;
12397 }
12398 }
12399 else if (recognizeLiterals && !inComment && !inPI)
12400 {
12401 inLiteral = true;
12402 literalQuote = c;
12403 }
12404 num++;
12405 continue;
12406 default:
12407 {
12408 if (num == _ps.charsUsed)
12409 {
12410 break;
12411 }
12412 char ch = chars[num];
12413 if (XmlCharType.IsHighSurrogate(ch))
12414 {
12415 if (num + 1 == _ps.charsUsed)
12416 {
12417 break;
12418 }
12419 num++;
12420 if (XmlCharType.IsLowSurrogate(chars[num]))
12421 {
12422 num++;
12423 continue;
12424 }
12425 }
12427 break;
12428 }
12429 }
12430 if (await ReadDataAsync().ConfigureAwait(continueOnCapturedContext: false) == 0)
12431 {
12432 if (_ps.charsUsed - _ps.charPos > 0)
12433 {
12434 if (_ps.chars[_ps.charPos] != '\r')
12435 {
12437 }
12438 }
12439 else
12440 {
12442 }
12443 }
12444 chars = _ps.chars;
12445 num = _ps.charPos;
12446 }
12447 _ps.charPos = num + 1;
12448 }
static string Xml_UnexpectedEOF1
Definition SR.cs:38
Definition SR.cs:7
void ThrowInvalidChar(char[] data, int length, int invCharPos)
void Throw(int pos, string res, string arg)

References System.Xml.XmlTextReaderImpl._ps, System.ch, System.Xml.XmlTextReaderImpl.ParsingState.charPos, System.chars, System.Xml.XmlTextReaderImpl.ParsingState.chars, System.Xml.XmlTextReaderImpl.ParsingState.charsUsed, System.Xml.Dictionary, System.Xml.XmlCharType.IsAttributeValueChar(), System.Xml.XmlTextReaderImpl.ParsingState.isEof, System.Xml.XmlCharType.IsHighSurrogate(), System.Xml.XmlCharType.IsLowSurrogate(), System.Xml.XmlTextReaderImpl.OnNewLine(), System.Xml.XmlTextReaderImpl.ReadDataAsync(), System.Xml.XmlTextReaderImpl.Throw(), System.Xml.XmlTextReaderImpl.ThrowInvalidChar(), and System.SR.Xml_UnexpectedEOF1.

Referenced by System.Xml.XmlTextReaderImpl.SkipDtdAsync(), and System.Xml.XmlTextReaderImpl.SkipPublicOrSystemIdLiteralAsync().