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

◆ ParseDocumentContentAsync()

Task< bool > System.Xml.XmlTextReaderImpl.ParseDocumentContentAsync ( )
inlineprivate

Definition at line 9786 of file XmlTextReaderImpl.cs.

9787 {
9788 char[] chars;
9789 bool needMoreChars;
9790 int charPos;
9791 while (true)
9792 {
9793 needMoreChars = false;
9794 charPos = _ps.charPos;
9795 chars = _ps.chars;
9796 if (chars[charPos] != '<')
9797 {
9798 break;
9799 }
9800 needMoreChars = true;
9801 if (_ps.charsUsed - charPos < 4)
9802 {
9804 }
9805 charPos++;
9806 switch (chars[charPos])
9807 {
9808 case '?':
9809 _ps.charPos = charPos + 1;
9810 return ParsePIAsync().ContinueBoolTaskFuncWhenFalseAsync((XmlTextReaderImpl thisRef) => thisRef.ParseDocumentContentAsync(), this);
9811 case '!':
9812 charPos++;
9813 if (_ps.charsUsed - charPos < 2)
9814 {
9816 }
9817 if (chars[charPos] == '-')
9818 {
9819 if (chars[charPos + 1] == '-')
9820 {
9821 _ps.charPos = charPos + 2;
9822 return ParseCommentAsync().ContinueBoolTaskFuncWhenFalseAsync((XmlTextReaderImpl thisRef) => thisRef.ParseDocumentContentAsync(), this);
9823 }
9824 ThrowUnexpectedToken(charPos + 1, "-");
9825 continue;
9826 }
9827 if (chars[charPos] == '[')
9828 {
9829 if (_fragmentType != XmlNodeType.Document)
9830 {
9831 charPos++;
9832 if (_ps.charsUsed - charPos < 6)
9833 {
9835 }
9836 if (XmlConvert.StrEqual(chars, charPos, 6, "CDATA["))
9837 {
9838 _ps.charPos = charPos + 6;
9839 return ParseCDataAsync().CallBoolTaskFuncWhenFinishAsync((XmlTextReaderImpl thisRef) => thisRef.ParseDocumentContentAsync_CData(), this);
9840 }
9841 ThrowUnexpectedToken(charPos, "CDATA[");
9842 }
9843 else
9844 {
9846 }
9847 continue;
9848 }
9849 if (_fragmentType == XmlNodeType.Document || _fragmentType == XmlNodeType.None)
9850 {
9851 _fragmentType = XmlNodeType.Document;
9852 _ps.charPos = charPos;
9853 return ParseDoctypeDeclAsync().ContinueBoolTaskFuncWhenFalseAsync((XmlTextReaderImpl thisRef) => thisRef.ParseDocumentContentAsync(), this);
9854 }
9855 if (ParseUnexpectedToken(charPos) == "DOCTYPE")
9856 {
9858 }
9859 else
9860 {
9861 ThrowUnexpectedToken(charPos, "<!--", "<[CDATA[");
9862 }
9863 continue;
9864 case '/':
9865 Throw(charPos + 1, System.SR.Xml_UnexpectedEndTag);
9866 continue;
9867 }
9869 {
9870 if (_fragmentType == XmlNodeType.Document)
9871 {
9872 Throw(charPos, System.SR.Xml_MultipleRoots);
9873 }
9874 if (_fragmentType == XmlNodeType.None)
9875 {
9876 _fragmentType = XmlNodeType.Element;
9877 }
9878 }
9879 _ps.charPos = charPos;
9880 _rootElementParsed = true;
9881 return ParseElementAsync().ReturnTrueTaskWhenFinishAsync();
9882 }
9883 if (chars[charPos] == '&')
9884 {
9886 }
9887 if (charPos == _ps.charsUsed || (_v1Compat && chars[charPos] == '\0'))
9888 {
9890 }
9891 if (_fragmentType == XmlNodeType.Document)
9892 {
9893 return ParseRootLevelWhitespaceAsync().ContinueBoolTaskFuncWhenFalseAsync((XmlTextReaderImpl thisRef) => thisRef.ParseDocumentContentAsync(), this);
9894 }
9896 }
static string Xml_BadDTDLocation
Definition SR.cs:98
static string Xml_MultipleRoots
Definition SR.cs:80
static string Xml_InvalidRootData
Definition SR.cs:82
static string Xml_UnexpectedEndTag
Definition SR.cs:70
Definition SR.cs:7
async Task< bool > ParseDoctypeDeclAsync()
Task< bool > ParseDocumentContentAsync_WhiteSpace()
async Task< bool > ParseDocumentContentAsync_ParseEntity()
async Task< bool > ParseCommentAsync()
async Task< bool > ParseDocumentContentAsync_ReadData(bool needMoreChars)
void Throw(int pos, string res, string arg)
void ThrowUnexpectedToken(int pos, string expectedToken)
async Task< bool > ParseRootLevelWhitespaceAsync()

References System.Xml.XmlTextReaderImpl._fragmentType, System.Xml.XmlTextReaderImpl._ps, System.Xml.XmlTextReaderImpl._rootElementParsed, System.Xml.XmlTextReaderImpl._v1Compat, System.Xml.XmlTextReaderImpl.ParsingState.charPos, System.chars, System.Xml.XmlTextReaderImpl.ParsingState.chars, System.Xml.XmlTextReaderImpl.ParsingState.charsUsed, System.Xml.Dictionary, System.Xml.XmlTextReaderImpl.ParseCDataAsync(), System.Xml.XmlTextReaderImpl.ParseCommentAsync(), System.Xml.XmlTextReaderImpl.ParseDoctypeDeclAsync(), System.Xml.XmlTextReaderImpl.ParseDocumentContentAsync_ParseEntity(), System.Xml.XmlTextReaderImpl.ParseDocumentContentAsync_ReadData(), System.Xml.XmlTextReaderImpl.ParseDocumentContentAsync_WhiteSpace(), System.Xml.XmlTextReaderImpl.ParseElementAsync(), System.Xml.XmlTextReaderImpl.ParsePIAsync(), System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespaceAsync(), System.Xml.XmlTextReaderImpl.ParseUnexpectedToken(), System.Xml.XmlConvert.StrEqual(), System.Xml.XmlTextReaderImpl.Throw(), System.Xml.XmlTextReaderImpl.ThrowUnexpectedToken(), System.SR.Xml_BadDTDLocation, System.SR.Xml_InvalidRootData, System.SR.Xml_MultipleRoots, and System.SR.Xml_UnexpectedEndTag.

Referenced by System.Xml.XmlTextReaderImpl._ParseDocumentContentAsync_WhiteSpace(), System.Xml.XmlTextReaderImpl.ParseDocumentContentAsync_ParseEntity(), System.Xml.XmlTextReaderImpl.ParseDocumentContentAsync_ReadData(), System.Xml.XmlTextReaderImpl.ParseDocumentContentAsync_WhiteSpace(), and System.Xml.XmlTextReaderImpl.ReadAsync().