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

◆ ScanLiteral()

Token System.Xml.DtdParser.ScanLiteral ( LiteralType literalType)
inlineprivate

Definition at line 2145 of file DtdParser.cs.

2146 {
2147 char c = _chars[_curPos];
2148 char value = ((literalType == LiteralType.AttributeValue) ? ' ' : '\n');
2151 _curPos++;
2154 while (true)
2155 {
2156 if (XmlCharType.IsAttributeValueChar(_chars[_curPos]) && _chars[_curPos] != '%')
2157 {
2158 _curPos++;
2159 continue;
2160 }
2162 {
2163 break;
2164 }
2165 int num = _curPos - _tokenStartPos;
2166 if (num > 0)
2167 {
2170 }
2171 switch (_chars[_curPos])
2172 {
2173 case '"':
2174 case '\'':
2175 case '>':
2176 _curPos++;
2177 continue;
2178 case '\n':
2179 _curPos++;
2180 if (Normalize)
2181 {
2184 }
2186 continue;
2187 case '\r':
2188 if (_chars[_curPos + 1] == '\n')
2189 {
2190 if (Normalize)
2191 {
2192 if (literalType == LiteralType.AttributeValue)
2193 {
2195 }
2196 else
2197 {
2199 }
2200 _tokenStartPos = _curPos + 2;
2203 }
2204 _curPos += 2;
2205 }
2206 else
2207 {
2208 if (_curPos + 1 == _charsUsed)
2209 {
2210 break;
2211 }
2212 _curPos++;
2213 if (Normalize)
2214 {
2217 }
2218 }
2220 continue;
2221 case '\t':
2222 if (literalType == LiteralType.AttributeValue && Normalize)
2223 {
2226 }
2227 _curPos++;
2228 continue;
2229 case '<':
2230 if (literalType == LiteralType.AttributeValue)
2231 {
2232 Throw(_curPos, System.SR.Xml_BadAttributeChar, XmlException.BuildCharExceptionArgs('<', '\0'));
2233 }
2234 _curPos++;
2235 continue;
2236 case '%':
2237 if (literalType != LiteralType.EntityReplText)
2238 {
2239 _curPos++;
2240 continue;
2241 }
2244 continue;
2245 case '&':
2246 {
2247 if (literalType == LiteralType.SystemOrPublicID)
2248 {
2249 _curPos++;
2250 continue;
2251 }
2252 if (_curPos + 1 == _charsUsed)
2253 {
2254 break;
2255 }
2256 if (_chars[_curPos + 1] == '#')
2257 {
2264 _curPos = num2;
2265 continue;
2266 }
2268 if (literalType == LiteralType.AttributeValue)
2269 {
2272 if (num3 >= 0)
2273 {
2277 _curPos = num3;
2278 }
2279 else
2280 {
2283 }
2284 continue;
2285 }
2288 if (num4 >= 0)
2289 {
2291 _curPos = num4;
2292 continue;
2293 }
2295 _curPos++;
2297 XmlQualifiedName entityName = ScanEntityName();
2299 continue;
2300 }
2301 default:
2302 {
2303 if (_curPos == _charsUsed)
2304 {
2305 break;
2306 }
2307 char ch = _chars[_curPos];
2308 if (XmlCharType.IsHighSurrogate(ch))
2309 {
2310 if (_curPos + 1 == _charsUsed)
2311 {
2312 break;
2313 }
2314 _curPos++;
2315 if (XmlCharType.IsLowSurrogate(_chars[_curPos]))
2316 {
2317 _curPos++;
2318 continue;
2319 }
2320 }
2322 return Token.None;
2323 }
2324 }
2325 if ((_readerAdapter.IsEof || ReadData() == 0) && (literalType == LiteralType.SystemOrPublicID || !HandleEntityEnd(inLiteral: true)))
2326 {
2328 }
2330 }
2331 if (_stringBuilder.Length > 0)
2332 {
2334 }
2335 _curPos++;
2337 return Token.Literal;
2338 }
static string Xml_BadAttributeChar
Definition SR.cs:74
static string Xml_UnclosedQuote
Definition SR.cs:34
Definition SR.cs:7
StringBuilder Append(char value, int repeatCount)
void Throw(int curPos, string res)
XmlQualifiedName ScanEntityName()
bool HandleEntityEnd(bool inLiteral)
LineInfo _literalLineInfo
Definition DtdParser.cs:192
SchemaEntity VerifyEntityReference(XmlQualifiedName entityName, bool paramEntity, bool mustBeDeclared, bool inAttribute)
IDtdParserAdapter _readerAdapter
Definition DtdParser.cs:140
StringBuilder _internalSubsetValueSb
Definition DtdParser.cs:178
bool HandleEntityReference(bool paramEntity, bool inLiteral, bool inAttribute)
void ThrowInvalidChar(int pos, string data, int invCharPos)
StringBuilder _stringBuilder
Definition DtdParser.cs:188
int ParseNamedCharRef(bool expand, StringBuilder internalSubsetBuilder)
int ParseNumericCharRef(StringBuilder internalSubsetBuilder)
void Set(int lineNo, int linePos)
Definition LineInfo.cs:15

References System.Xml.DtdParser._chars, System.Xml.DtdParser._charsUsed, System.Xml.DtdParser._curPos, System.Xml.DtdParser._currentEntityId, System.Xml.DtdParser._internalSubsetValueSb, System.Xml.DtdParser._literalLineInfo, System.Xml.DtdParser._literalQuoteChar, System.Xml.DtdParser._readerAdapter, System.Xml.DtdParser._stringBuilder, System.Xml.DtdParser._tokenStartPos, System.Text.StringBuilder.Append(), System.Xml.XmlException.BuildCharExceptionArgs(), System.ch, System.Xml.IDtdParserAdapter.CurrentPosition, System.Xml.Dictionary, System.Xml.DtdParser.HandleEntityEnd(), System.Xml.DtdParser.HandleEntityReference(), System.Xml.XmlCharType.IsAttributeValueChar(), System.Xml.IDtdParserAdapter.IsEntityEolNormalized, System.Xml.IDtdParserAdapter.IsEof, System.Xml.XmlCharType.IsHighSurrogate(), System.Xml.XmlCharType.IsLowSurrogate(), System.Text.StringBuilder.Length, System.Xml.DtdParser.LineNo, System.Xml.DtdParser.LinePos, System.Xml.DtdParser.LoadParsingBuffer(), System.Xml.DtdParser.Normalize, System.Xml.IDtdParserAdapter.OnNewLine(), System.Xml.IDtdParserAdapter.ParseNamedCharRef(), System.Xml.IDtdParserAdapter.ParseNumericCharRef(), System.Xml.DtdParser.ReadData(), System.Xml.DtdParser.SaveInternalSubsetValue, System.Xml.DtdParser.SaveParsingBuffer(), System.Xml.DtdParser.ScanEntityName(), System.Xml.LineInfo.Set(), System.Xml.DtdParser.Throw(), System.Xml.DtdParser.ThrowInvalidChar(), System.value, System.Xml.DtdParser.VerifyEntityReference(), System.SR.Xml_BadAttributeChar, and System.SR.Xml_UnclosedQuote.

Referenced by System.Xml.DtdParser.ScanAttlist6(), System.Xml.DtdParser.ScanAttlist7(), System.Xml.DtdParser.ScanEntity2(), System.Xml.DtdParser.ScanPublicId1(), System.Xml.DtdParser.ScanPublicId2(), and System.Xml.DtdParser.ScanSystemId().