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

◆ ParseAttributesAsync()

async Task System.Xml.XmlTextReaderImpl.ParseAttributesAsync ( )
inlineprivate

Definition at line 10448 of file XmlTextReaderImpl.cs.

10449 {
10450 int pos = _ps.charPos;
10451 char[] chars = _ps.chars;
10452 while (true)
10453 {
10454 int num = 0;
10455 while (true)
10456 {
10457 char c;
10458 int num2;
10459 if (XmlCharType.IsWhiteSpace(c = chars[pos]))
10460 {
10461 switch (c)
10462 {
10463 case '\n':
10464 OnNewLine(pos + 1);
10465 num++;
10466 goto IL_00f2;
10467 case '\r':
10468 if (chars[pos + 1] == '\n')
10469 {
10470 OnNewLine(pos + 2);
10471 num++;
10472 pos++;
10473 goto IL_00f2;
10474 }
10475 if (pos + 1 != _ps.charsUsed)
10476 {
10477 OnNewLine(pos + 1);
10478 num++;
10479 goto IL_00f2;
10480 }
10481 break;
10482 default:
10483 goto IL_00f2;
10484 }
10485 _ps.charPos = pos;
10486 }
10487 else
10488 {
10489 num2 = 0;
10490 char c2;
10491 if (XmlCharType.IsStartNCNameSingleChar(c2 = chars[pos]))
10492 {
10493 num2 = 1;
10494 }
10495 if (num2 != 0)
10496 {
10497 goto IL_0234;
10498 }
10499 if (c2 == '>')
10500 {
10501 _ps.charPos = pos + 1;
10502 _parsingFunction = ParsingFunction.MoveToElementContent;
10503 goto IL_090f;
10504 }
10505 if (c2 == '/')
10506 {
10507 if (pos + 1 != _ps.charsUsed)
10508 {
10509 if (chars[pos + 1] == '>')
10510 {
10511 _ps.charPos = pos + 2;
10514 _parsingFunction = ParsingFunction.PopEmptyElementContext;
10515 goto IL_090f;
10516 }
10517 ThrowUnexpectedToken(pos + 1, ">");
10518 goto IL_0234;
10519 }
10520 }
10521 else if (pos != _ps.charsUsed)
10522 {
10523 if (c2 != ':' || _supportNamespaces)
10524 {
10525 Throw(pos, System.SR.Xml_BadStartNameChar, XmlException.BuildCharExceptionArgs(chars, _ps.charsUsed, pos));
10526 }
10527 goto IL_0234;
10528 }
10529 }
10530 _ps.lineNo -= num;
10531 if (await ReadDataAsync().ConfigureAwait(continueOnCapturedContext: false) != 0)
10532 {
10533 pos = _ps.charPos;
10534 chars = _ps.chars;
10535 }
10536 else
10537 {
10539 }
10540 break;
10541 IL_090f:
10543 {
10545 }
10548 {
10551 }
10552 if (_attrDuplWalkCount >= 250)
10553 {
10555 }
10556 return;
10557 IL_00f2:
10558 pos++;
10559 continue;
10560 IL_0234:
10561 if (pos == _ps.charPos)
10562 {
10564 }
10565 _ps.charPos = pos;
10567 int num3 = -1;
10568 pos += num2;
10569 while (true)
10570 {
10571 char c3;
10572 if (XmlCharType.IsNCNameSingleChar(c3 = chars[pos]))
10573 {
10574 pos++;
10575 continue;
10576 }
10577 if (c3 == ':')
10578 {
10579 if (num3 != -1)
10580 {
10582 {
10583 Throw(pos, System.SR.Xml_BadNameChar, XmlException.BuildCharExceptionArgs(':', '\0'));
10584 break;
10585 }
10586 pos++;
10587 continue;
10588 }
10589 num3 = pos;
10590 pos++;
10591 if (XmlCharType.IsStartNCNameSingleChar(chars[pos]))
10592 {
10593 pos++;
10594 continue;
10595 }
10597 num3 = tuple.Item1;
10598 pos = tuple.Item2;
10599 chars = _ps.chars;
10600 break;
10601 }
10602 if (pos + 1 >= _ps.charsUsed)
10603 {
10605 num3 = tuple2.Item1;
10606 pos = tuple2.Item2;
10607 chars = _ps.chars;
10608 }
10609 break;
10610 }
10611 NodeData attr = AddAttribute(pos, num3);
10612 attr.SetLineInfo(_ps.LineNo, attrNameLinePos);
10613 if (chars[pos] != '=')
10614 {
10615 _ps.charPos = pos;
10617 pos = _ps.charPos;
10618 if (chars[pos] != '=')
10619 {
10621 }
10622 }
10623 pos++;
10624 char c4 = chars[pos];
10625 if (c4 != '"' && c4 != '\'')
10626 {
10627 _ps.charPos = pos;
10629 pos = _ps.charPos;
10630 c4 = chars[pos];
10631 if (c4 != '"' && c4 != '\'')
10632 {
10633 ThrowUnexpectedToken("\"", "'");
10634 }
10635 }
10636 pos++;
10637 _ps.charPos = pos;
10639 attr.SetLineInfo2(_ps.LineNo, _ps.LinePos);
10640 char c5;
10641 while (XmlCharType.IsAttributeValueChar(c5 = chars[pos]))
10642 {
10643 pos++;
10644 }
10645 if (c5 == c4)
10646 {
10647 attr.SetValue(chars, _ps.charPos, pos - _ps.charPos);
10648 pos++;
10649 _ps.charPos = pos;
10650 }
10651 else
10652 {
10654 pos = _ps.charPos;
10655 chars = _ps.chars;
10656 }
10657 if (attr.prefix.Length == 0)
10658 {
10659 if (Ref.Equal(attr.localName, _xmlNs))
10660 {
10662 }
10663 }
10664 else if (Ref.Equal(attr.prefix, _xmlNs))
10665 {
10667 }
10668 else if (Ref.Equal(attr.prefix, _xml))
10669 {
10671 }
10672 break;
10673 }
10674 }
10675 }
static string Xml_BadStartNameChar
Definition SR.cs:42
static string Xml_BadNameChar
Definition SR.cs:44
Definition SR.cs:7
async Task ParseAttributeValueSlowAsync(int curPos, char quoteChar, NodeData attr)
void OnXmlReservedAttribute(NodeData attr)
void OnDefaultNamespaceDecl(NodeData attr)
void OnNamespaceDecl(NodeData attr)
NodeData AddAttribute(int endNamePos, int colonPos)
async Task< int > EatWhitespacesAsync(StringBuilder sb)
void Throw(int pos, string res, string arg)
void ThrowUnexpectedToken(int pos, string expectedToken)

References System.Xml.XmlTextReaderImpl._addDefaultAttributesAndNormalize, System.Xml.XmlTextReaderImpl._attrDuplWalkCount, System.Xml.XmlTextReaderImpl._attrNeedNamespaceLookup, System.Xml.XmlTextReaderImpl._nextParsingFunction, System.Xml.XmlTextReaderImpl._parsingFunction, System.Xml.XmlTextReaderImpl._ps, System.Xml.XmlTextReaderImpl._supportNamespaces, System.Xml.XmlTextReaderImpl._xml, System.Xml.XmlTextReaderImpl._xmlNs, System.Xml.XmlTextReaderImpl.AddAttribute(), System.Xml.XmlTextReaderImpl.AddDefaultAttributesAndNormalize(), System.Xml.XmlTextReaderImpl.AttributeDuplCheck(), System.Xml.XmlTextReaderImpl.AttributeNamespaceLookup(), System.Xml.XmlException.BuildCharExceptionArgs(), System.Xml.XmlTextReaderImpl.ParsingState.charPos, System.chars, System.Xml.XmlTextReaderImpl.ParsingState.chars, System.Xml.XmlTextReaderImpl.ParsingState.charsUsed, System.Xml.Dictionary, System.Xml.XmlTextReaderImpl.EatWhitespacesAsync(), System.Xml.XmlTextReaderImpl.ElementNamespaceLookup(), System.Xml.Ref.Equal(), System.Xml.XmlTextReaderImpl.int, System.Xml.XmlCharType.IsAttributeValueChar(), System.Xml.XmlCharType.IsNCNameSingleChar(), System.Xml.XmlCharType.IsStartNCNameSingleChar(), System.Xml.XmlCharType.IsWhiteSpace(), System.Xml.XmlTextReaderImpl.ParsingState.LineNo, System.Xml.XmlTextReaderImpl.ParsingState.LinePos, System.Xml.XmlTextReaderImpl.OnDefaultNamespaceDecl(), System.Xml.XmlTextReaderImpl.OnNamespaceDecl(), System.Xml.XmlTextReaderImpl.OnNewLine(), System.Xml.XmlTextReaderImpl.OnXmlReservedAttribute(), System.Xml.XmlTextReaderImpl.ParseAttributeValueSlowAsync(), System.Xml.XmlTextReaderImpl.ParseQNameAsync(), System.Xml.XmlTextReaderImpl.ReadDataAsync(), System.Xml.XmlTextReaderImpl.Throw(), System.Xml.XmlTextReaderImpl.ThrowExpectingWhitespace(), System.Xml.XmlTextReaderImpl.ThrowUnclosedElements(), System.Xml.XmlTextReaderImpl.ThrowUnexpectedToken(), System.SR.Xml_BadNameChar, and System.SR.Xml_BadStartNameChar.

Referenced by System.Xml.XmlTextReaderImpl.ParseElementAsync_SetElement().