Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
DtdParser.cs
Go to the documentation of this file.
3using System.Text;
6
7namespace System.Xml;
8
9internal sealed class DtdParser : IDtdParser
10{
11 private enum Token
12 {
13 CDATA,
14 ID,
15 IDREF,
16 IDREFS,
17 ENTITY,
19 NMTOKEN,
22 None,
23 PERef,
28 Comment,
29 PI,
32 Eof,
34 IMPLIED,
35 FIXED,
36 QName,
37 Name,
38 Nmtoken,
39 Quote,
43 Or,
46 PUBLIC,
47 SYSTEM,
48 Literal,
49 DOCTYPE,
50 NData,
51 Percent,
52 Star,
53 QMark,
54 Plus,
55 PCDATA,
56 Comma,
57 ANY,
58 EMPTY,
59 IGNORE,
61 }
62
100
101 private enum LiteralType
102 {
106 }
107
108 private sealed class UndeclaredNotation
109 {
110 internal string name;
111
112 internal int lineNo;
113
114 internal int linePos;
115
117
118 internal UndeclaredNotation(string name, int lineNo, int linePos)
119 {
120 this.name = name;
123 next = null;
124 }
125 }
126
139
141
143
145
147
148 private string _systemId = string.Empty;
149
150 private string _publicId = string.Empty;
151
152 private bool _normalize = true;
153
154 private bool _validate;
155
156 private bool _supportNamespaces = true;
157
158 private bool _v1Compat;
159
160 private char[] _chars;
161
162 private int _charsUsed;
163
164 private int _curPos;
165
167
169
171
172 private bool _whitespaceSeen;
173
174 private int _tokenStartPos;
175
176 private int _colonPos;
177
179
181
182 private int _currentEntityId;
183
184 private bool _freeFloatingDtd;
185
187
189
190 private int _condSectionDepth;
191
192 private LineInfo _literalLineInfo = new LineInfo(0, 0);
193
194 private char _literalQuoteChar = '"';
195
196 private string _documentBaseUri = string.Empty;
197
198 private string _externalDtdBaseUri = string.Empty;
199
201
203
205
207
209 {
210 get
211 {
213 {
214 return _internalSubsetValueSb != null;
215 }
216 return false;
217 }
218 }
219
221 {
222 get
223 {
224 if (_scanningFunction != 0)
225 {
226 if (_scanningFunction == ScanningFunction.ParamEntitySpace)
227 {
228 return _savedScanningFunction == ScanningFunction.SubsetContent;
229 }
230 return false;
231 }
232 return true;
233 }
234 }
235
237
238 private bool Normalize => _normalize;
239
241
243
244 private string BaseUriStr
245 {
246 get
247 {
248 Uri baseUri = _readerAdapter.BaseUri;
249 if (!(baseUri != null))
250 {
251 return string.Empty;
252 }
253 return baseUri.ToString();
254 }
255 }
256
257 private DtdParser()
258 {
259 }
260
261 internal static IDtdParser Create()
262 {
263 return new DtdParser();
264 }
265
291
292 private void InitializeFreeFloatingDtd(string baseUri, string docTypeName, string publicId, string systemId, string internalSubset, IDtdParserAdapter adapter)
293 {
294 Initialize(adapter);
295 if (docTypeName == null || docTypeName.Length == 0)
296 {
298 }
300 int num = docTypeName.IndexOf(':');
301 if (num == -1)
302 {
304 }
305 else
306 {
307 _schemaInfo.DocTypeName = new XmlQualifiedName(_nameTable.Add(docTypeName.Substring(0, num)), _nameTable.Add(docTypeName.Substring(num + 1)));
308 }
309 if (systemId != null && systemId.Length > 0)
310 {
311 int invCharPos;
312 if ((invCharPos = XmlCharType.IsOnlyCharData(systemId)) >= 0)
313 {
315 }
316 _systemId = systemId;
317 }
318 if (publicId != null && publicId.Length > 0)
319 {
320 int invCharPos;
321 if ((invCharPos = XmlCharType.IsPublicId(publicId)) >= 0)
322 {
324 }
325 _publicId = publicId;
326 }
327 if (internalSubset != null && internalSubset.Length > 0)
328 {
331 }
333 if (baseUri2 != null)
334 {
335 _documentBaseUri = baseUri2.ToString();
336 }
337 _freeFloatingDtd = true;
338 }
339
346
347 IDtdInfo IDtdParser.ParseFreeFloatingDtd(string baseUri, string docTypeName, string publicId, string systemId, string internalSubset, IDtdParserAdapter adapter)
348 {
349 InitializeFreeFloatingDtd(baseUri, docTypeName, publicId, systemId, internalSubset, adapter);
351 return _schemaInfo;
352 }
353
354 private void Parse(bool saveInternalSubset)
355 {
357 {
359 }
360 else
361 {
363 }
365 if (!_validate || _undeclaredNotations == null)
366 {
367 return;
368 }
370 {
372 {
374 }
375 }
376 }
377
379 {
383 if (GetToken(needWhiteSpace: false) != Token.QName)
384 {
386 }
388 Token token = GetToken(needWhiteSpace: false);
389 if (token == Token.SYSTEM || token == Token.PUBLIC)
390 {
392 token = GetToken(needWhiteSpace: false);
393 }
394 switch (token)
395 {
396 case Token.LeftBracket:
398 {
401 }
403 break;
404 default:
406 break;
407 case Token.GreaterThan:
408 break;
409 }
411 if (_systemId != null && _systemId.Length > 0)
412 {
414 }
415 }
416
417 private void ParseFreeFloatingDtd()
418 {
420 {
424 }
425 if (_systemId != null && _systemId.Length > 0)
426 {
428 }
429 }
430
431 private void ParseInternalSubset()
432 {
433 ParseSubset();
434 }
435
436 private void ParseExternalSubset()
437 {
439 {
440 Uri baseUri = _readerAdapter.BaseUri;
441 if (baseUri != null)
442 {
443 _externalDtdBaseUri = baseUri.ToString();
444 }
447 ParseSubset();
448 }
449 }
450
451 private void ParseSubset()
452 {
453 while (true)
454 {
455 Token token = GetToken(needWhiteSpace: false);
457 switch (token)
458 {
459 case Token.AttlistDecl:
461 break;
462 case Token.ElementDecl:
464 break;
465 case Token.EntityDecl:
467 break;
468 case Token.NotationDecl:
470 break;
471 case Token.Comment:
472 ParseComment();
473 break;
474 case Token.PI:
475 ParsePI();
476 break;
477 case Token.CondSectionStart:
479 {
481 }
484 break;
485 case Token.CondSectionEnd:
486 if (_condSectionDepth > 0)
487 {
490 {
492 }
493 }
494 else
495 {
497 }
498 break;
499 case Token.RightBracket:
501 {
502 if (_condSectionDepth != 0)
503 {
505 }
506 if (_internalSubsetValueSb != null)
507 {
511 }
512 if (GetToken(needWhiteSpace: false) != Token.GreaterThan)
513 {
515 }
516 }
517 else
518 {
520 }
521 return;
522 case Token.Eof:
524 {
526 }
527 if (_condSectionDepth != 0)
528 {
530 }
531 return;
532 }
534 {
535 if (_validate)
536 {
538 }
539 else if (!_v1Compat)
540 {
542 }
543 }
544 }
545 }
546
547 private void ParseAttlistDecl()
548 {
549 if (GetToken(needWhiteSpace: true) == Token.QName)
550 {
553 {
556 }
558 while (true)
559 {
560 switch (GetToken(needWhiteSpace: false))
561 {
562 case Token.QName:
563 {
569 bool flag = value.GetAttDef(schemaAttDef.Name) != null;
572 if (schemaAttDef.Prefix.Length > 0 && schemaAttDef.Prefix.Equals("xml"))
573 {
574 if (schemaAttDef.Name.Name == "space")
575 {
576 if (_v1Compat)
577 {
578 string text = schemaAttDef.DefaultValueExpanded.Trim();
579 if (text.Equals("preserve") || text.Equals("default"))
580 {
582 }
583 }
584 else
585 {
587 if (schemaAttDef.TokenizedType != XmlTokenizedType.ENUMERATION)
588 {
589 Throw(System.SR.Xml_EnumerationRequired, string.Empty, schemaAttDef.LineNumber, schemaAttDef.LinePosition);
590 }
591 if (_validate)
592 {
594 }
595 }
596 }
597 else if (schemaAttDef.Name.Name == "lang")
598 {
600 }
601 }
602 if (!flag)
603 {
604 value.AddAttDef(schemaAttDef);
605 }
606 continue;
607 }
608 case Token.GreaterThan:
609 if (_v1Compat && schemaAttDef != null && schemaAttDef.Prefix.Length > 0 && schemaAttDef.Prefix.Equals("xml") && schemaAttDef.Name.Name == "space")
610 {
612 if (schemaAttDef.Datatype.TokenizedType != XmlTokenizedType.ENUMERATION)
613 {
614 Throw(System.SR.Xml_EnumerationRequired, string.Empty, schemaAttDef.LineNumber, schemaAttDef.LinePosition);
615 }
616 if (_validate)
617 {
619 }
620 }
621 return;
622 }
623 break;
624 }
625 }
627 }
628
630 {
631 Token token = GetToken(needWhiteSpace: true);
632 if (token != 0)
633 {
635 }
636 if (IsAttributeValueType(token))
637 {
640 switch (token)
641 {
642 default:
643 return;
644 case Token.ID:
645 if (_validate && elementDecl.IsIdDeclared)
646 {
647 SchemaAttDef attDef = elementDecl.GetAttDef(attrDef.Name);
648 if ((attDef == null || attDef.Datatype.TokenizedType != XmlTokenizedType.ID) && !ignoreErrors)
649 {
651 }
652 }
654 return;
655 case Token.NOTATION:
656 break;
657 }
658 if (_validate)
659 {
660 if (elementDecl.IsNotationDeclared && !ignoreErrors)
661 {
663 }
664 else
665 {
666 if (elementDecl.ContentValidator != null && elementDecl.ContentValidator.ContentType == XmlSchemaContentType.Empty && !ignoreErrors)
667 {
669 }
671 }
672 }
673 if (GetToken(needWhiteSpace: true) == Token.LeftParen && GetToken(needWhiteSpace: false) == Token.Name)
674 {
675 do
676 {
677 string nameString = GetNameString();
679 {
681 }
682 if (_validate && !_v1Compat && attrDef.Values != null && attrDef.Values.Contains(nameString) && !ignoreErrors)
683 {
685 }
686 attrDef.AddValue(nameString);
687 switch (GetToken(needWhiteSpace: false))
688 {
689 case Token.Or:
690 continue;
691 case Token.RightParen:
692 return;
693 }
694 break;
695 }
696 while (GetToken(needWhiteSpace: false) == Token.Name);
697 }
698 }
699 else if (token == Token.LeftParen)
700 {
703 if (GetToken(needWhiteSpace: false) == Token.Nmtoken)
704 {
705 attrDef.AddValue(GetNameString());
706 while (true)
707 {
708 string nmtokenString;
709 switch (GetToken(needWhiteSpace: false))
710 {
711 case Token.Or:
712 if (GetToken(needWhiteSpace: false) == Token.Nmtoken)
713 {
715 if (_validate && !_v1Compat && attrDef.Values != null && attrDef.Values.Contains(nmtokenString) && !ignoreErrors)
716 {
718 }
719 goto IL_0278;
720 }
721 break;
722 case Token.RightParen:
723 return;
724 }
725 break;
726 IL_0278:
727 attrDef.AddValue(nmtokenString);
728 }
729 }
730 }
732 }
733
734 private void ParseAttlistDefault(SchemaAttDef attrDef, bool ignoreErrors)
735 {
736 switch (GetToken(needWhiteSpace: true))
737 {
738 case Token.REQUIRED:
740 return;
741 case Token.IMPLIED:
743 return;
744 case Token.FIXED:
746 if (GetToken(needWhiteSpace: true) != Token.Literal)
747 {
748 break;
749 }
750 goto case Token.Literal;
751 case Token.Literal:
752 if (_validate && attrDef.Datatype.TokenizedType == XmlTokenizedType.ID && !ignoreErrors)
753 {
755 }
756 if (attrDef.TokenizedType != 0)
757 {
759 }
760 else
761 {
763 }
767 return;
768 }
770 }
771
772 private void ParseElementDecl()
773 {
774 if (GetToken(needWhiteSpace: true) == Token.QName)
775 {
779 {
780 if (_validate)
781 {
783 }
784 }
785 else
786 {
788 {
790 }
791 else
792 {
794 }
796 }
798 Token token = GetToken(needWhiteSpace: true);
799 if (token != Token.LeftParen)
800 {
801 if (token != Token.ANY)
802 {
803 if (token != Token.EMPTY)
804 {
805 goto IL_0181;
806 }
808 }
809 else
810 {
812 }
813 }
814 else
815 {
818 if (token2 != Token.None)
819 {
820 if (token2 != Token.PCDATA)
821 {
822 goto IL_0181;
823 }
826 particleContentValidator.OpenGroup();
829 }
830 else
831 {
835 particleContentValidator2.OpenGroup();
838 }
839 }
840 if (GetToken(needWhiteSpace: false) != Token.GreaterThan)
841 {
843 }
844 return;
845 }
846 goto IL_0181;
847 IL_0181:
849 }
850
851 private void ParseElementOnlyContent(ParticleContentValidator pcv, int startParenEntityId)
852 {
856 while (true)
857 {
858 Token token = GetToken(needWhiteSpace: false);
859 if (token != Token.QName)
860 {
861 if (token != Token.LeftParen)
862 {
863 if (token != Token.GreaterThan)
864 {
865 goto IL_0148;
866 }
868 goto IL_014e;
869 }
870 pcv.OpenGroup();
873 continue;
874 }
875 pcv.AddName(GetNameQualified(canHavePrefix: true), null);
877 goto IL_0078;
878 IL_0148:
880 goto IL_014e;
881 IL_00f9:
882 pcv.CloseGroup();
884 {
886 }
888 goto IL_014e;
889 IL_00cb:
890 if (parseElementOnlyContent_LocalFrame.parsingSchema == Token.Comma)
891 {
893 }
894 pcv.AddChoice();
896 continue;
897 IL_014e:
898 stack.Pop();
899 if (stack.Count > 0)
900 {
902 goto IL_0078;
903 }
904 break;
905 IL_0135:
907 goto IL_014e;
908 IL_0078:
909 switch (GetToken(needWhiteSpace: false))
910 {
911 case Token.Comma:
912 break;
913 case Token.Or:
914 goto IL_00cb;
915 case Token.RightParen:
916 goto IL_00f9;
917 case Token.GreaterThan:
918 goto IL_0135;
919 default:
920 goto IL_0148;
921 }
922 if (parseElementOnlyContent_LocalFrame.parsingSchema == Token.Or)
923 {
925 }
926 pcv.AddSequence();
928 }
929 }
930
932 {
933 switch (GetToken(needWhiteSpace: false))
934 {
935 case Token.Star:
936 pcv.AddStar();
937 break;
938 case Token.QMark:
939 pcv.AddQMark();
940 break;
941 case Token.Plus:
942 pcv.AddPlus();
943 break;
944 }
945 }
946
947 private void ParseElementMixedContent(ParticleContentValidator pcv, int startParenEntityId)
948 {
949 bool flag = false;
950 int num = -1;
952 while (true)
953 {
954 switch (GetToken(needWhiteSpace: false))
955 {
956 case Token.RightParen:
957 pcv.CloseGroup();
958 if (_validate && _currentEntityId != startParenEntityId)
959 {
961 }
962 if (GetToken(needWhiteSpace: false) == Token.Star && flag)
963 {
964 pcv.AddStar();
965 }
966 else if (flag)
967 {
969 }
970 return;
971 case Token.Or:
972 {
973 if (!flag)
974 {
975 flag = true;
976 }
977 else
978 {
979 pcv.AddChoice();
980 }
981 if (_validate)
982 {
983 num = _currentEntityId;
984 if (currentEntityId < num)
985 {
987 }
988 }
989 if (GetToken(needWhiteSpace: false) != Token.QName)
990 {
991 break;
992 }
994 if (pcv.Exists(nameQualified) && _validate)
995 {
997 }
998 pcv.AddName(nameQualified, null);
999 if (_validate)
1000 {
1002 if (currentEntityId < num)
1003 {
1005 }
1006 }
1007 continue;
1008 }
1009 }
1011 }
1012 }
1013
1014 private void ParseEntityDecl()
1015 {
1016 bool flag = false;
1018 Token token = GetToken(needWhiteSpace: true);
1019 if (token == Token.Name)
1020 {
1021 goto IL_002c;
1022 }
1023 if (token == Token.Percent)
1024 {
1025 flag = true;
1026 if (GetToken(needWhiteSpace: true) == Token.Name)
1027 {
1028 goto IL_002c;
1029 }
1030 }
1031 goto IL_01d6;
1032 IL_002c:
1037 if (flag)
1038 {
1040 {
1042 }
1043 }
1045 {
1047 }
1051 if ((uint)(token2 - 33) > 1u)
1052 {
1053 if (token2 != Token.Literal)
1054 {
1055 goto IL_01d6;
1056 }
1060 }
1061 else
1062 {
1063 ParseExternalId(token2, Token.EntityDecl, out var publicId, out var systemId);
1065 schemaEntity.Url = systemId;
1066 schemaEntity.Pubid = publicId;
1067 if (GetToken(needWhiteSpace: false) == Token.NData)
1068 {
1069 if (flag)
1070 {
1071 ThrowUnexpectedToken(_curPos - 5, ">");
1072 }
1073 if (!_whitespaceSeen)
1074 {
1076 }
1077 if (GetToken(needWhiteSpace: true) != Token.Name)
1078 {
1079 goto IL_01d6;
1080 }
1082 string name = schemaEntity.NData.Name;
1084 {
1086 }
1087 }
1088 }
1089 if (GetToken(needWhiteSpace: false) == Token.GreaterThan)
1090 {
1092 return;
1093 }
1094 goto IL_01d6;
1095 IL_01d6:
1097 }
1098
1099 private void ParseNotationDecl()
1100 {
1101 if (GetToken(needWhiteSpace: true) != Token.Name)
1102 {
1104 }
1108 {
1109 if (_undeclaredNotations != null)
1110 {
1112 }
1115 }
1116 else if (_validate)
1117 {
1119 }
1120 Token token = GetToken(needWhiteSpace: true);
1121 if (token == Token.SYSTEM || token == Token.PUBLIC)
1122 {
1123 ParseExternalId(token, Token.NOTATION, out var publicId, out var systemId);
1124 if (schemaNotation != null)
1125 {
1127 schemaNotation.Pubid = publicId;
1128 }
1129 }
1130 else
1131 {
1133 }
1134 if (GetToken(needWhiteSpace: false) != Token.GreaterThan)
1135 {
1137 }
1138 }
1139
1157
1158 private void ParseComment()
1159 {
1161 try
1162 {
1164 {
1167 }
1168 else
1169 {
1171 }
1172 }
1173 catch (XmlException ex)
1174 {
1175 if (!(ex.ResString == System.SR.Xml_UnexpectedEOF) || _currentEntityId == 0)
1176 {
1177 throw;
1178 }
1180 }
1182 }
1183
1184 private void ParsePI()
1185 {
1188 {
1191 }
1192 else
1193 {
1194 _readerAdapter.ParsePI(null);
1195 }
1197 }
1198
1199 private void ParseCondSection()
1200 {
1202 switch (GetToken(needWhiteSpace: false))
1203 {
1204 case Token.INCLUDE:
1205 if (GetToken(needWhiteSpace: false) == Token.LeftBracket)
1206 {
1208 {
1210 }
1211 if (_validate)
1212 {
1213 if (_condSectionEntityIds == null)
1214 {
1215 _condSectionEntityIds = new int[2];
1216 }
1217 else if (_condSectionEntityIds.Length == _condSectionDepth)
1218 {
1219 int[] array = new int[_condSectionEntityIds.Length * 2];
1222 }
1224 }
1226 break;
1227 }
1228 goto default;
1229 case Token.IGNORE:
1230 if (GetToken(needWhiteSpace: false) == Token.LeftBracket)
1231 {
1233 {
1235 }
1236 if (GetToken(needWhiteSpace: false) == Token.CondSectionEnd)
1237 {
1239 {
1241 }
1242 break;
1243 }
1244 }
1245 goto default;
1246 default:
1248 break;
1249 }
1250 }
1251
1252 private void ParseExternalId(Token idTokenType, Token declType, out string publicId, out string systemId)
1253 {
1255 publicId = null;
1256 systemId = null;
1257 if (GetToken(needWhiteSpace: true) != Token.Literal)
1258 {
1259 ThrowUnexpectedToken(_curPos, "\"", "'");
1260 }
1261 if (idTokenType == Token.SYSTEM)
1262 {
1263 systemId = GetValue();
1264 if (systemId.Contains('#'))
1265 {
1266 Throw(_curPos - systemId.Length - 1, System.SR.Xml_FragmentId, new string[2]
1267 {
1268 systemId.Substring(systemId.IndexOf('#')),
1269 systemId
1270 });
1271 }
1272 if (declType == Token.DOCTYPE && !_freeFloatingDtd)
1273 {
1276 }
1277 return;
1278 }
1279 publicId = GetValue();
1280 int num;
1281 if ((num = XmlCharType.IsPublicId(publicId)) >= 0)
1282 {
1283 ThrowInvalidChar(_curPos - 1 - publicId.Length + num, publicId, num);
1284 }
1285 if (declType == Token.DOCTYPE && !_freeFloatingDtd)
1286 {
1289 if (GetToken(needWhiteSpace: false) == Token.Literal)
1290 {
1291 if (!_whitespaceSeen)
1292 {
1294 }
1295 systemId = GetValue();
1298 }
1299 else
1300 {
1301 ThrowUnexpectedToken(_curPos, "\"", "'");
1302 }
1303 }
1304 else if (GetToken(needWhiteSpace: false) == Token.Literal)
1305 {
1306 if (!_whitespaceSeen)
1307 {
1309 }
1310 systemId = GetValue();
1311 }
1312 else if (declType != Token.NOTATION)
1313 {
1314 ThrowUnexpectedToken(_curPos, "\"", "'");
1315 }
1316 }
1317
1319 {
1320 _whitespaceSeen = false;
1321 while (true)
1322 {
1323 switch (_chars[_curPos])
1324 {
1325 case '\0':
1326 if (_curPos != _charsUsed)
1327 {
1329 }
1330 break;
1331 case '\n':
1332 _whitespaceSeen = true;
1333 _curPos++;
1335 continue;
1336 case '\r':
1337 _whitespaceSeen = true;
1338 if (_chars[_curPos + 1] == '\n')
1339 {
1340 if (Normalize)
1341 {
1344 }
1345 _curPos += 2;
1346 }
1347 else
1348 {
1349 if (_curPos + 1 >= _charsUsed && !_readerAdapter.IsEof)
1350 {
1351 break;
1352 }
1353 _chars[_curPos] = '\n';
1354 _curPos++;
1355 }
1357 continue;
1358 case '\t':
1359 case ' ':
1360 _whitespaceSeen = true;
1361 _curPos++;
1362 continue;
1363 case '%':
1364 if (_charsUsed - _curPos < 2)
1365 {
1366 break;
1367 }
1369 {
1371 {
1372 _curPos++;
1373 }
1374 else
1375 {
1377 }
1378 continue;
1379 }
1380 goto default;
1381 default:
1383 {
1385 }
1387 while (true)
1388 {
1389 switch (_scanningFunction)
1390 {
1391 case ScanningFunction.Name:
1392 return ScanNameExpected();
1393 case ScanningFunction.QName:
1394 return ScanQNameExpected();
1395 case ScanningFunction.Nmtoken:
1396 return ScanNmtokenExpected();
1397 case ScanningFunction.SubsetContent:
1398 return ScanSubsetContent();
1399 case ScanningFunction.Doctype1:
1400 return ScanDoctype1();
1401 case ScanningFunction.Doctype2:
1402 return ScanDoctype2();
1403 case ScanningFunction.Element1:
1404 return ScanElement1();
1405 case ScanningFunction.Element2:
1406 return ScanElement2();
1407 case ScanningFunction.Element3:
1408 return ScanElement3();
1409 case ScanningFunction.Element4:
1410 return ScanElement4();
1411 case ScanningFunction.Element5:
1412 return ScanElement5();
1413 case ScanningFunction.Element6:
1414 return ScanElement6();
1415 case ScanningFunction.Element7:
1416 return ScanElement7();
1417 case ScanningFunction.Attlist1:
1418 return ScanAttlist1();
1419 case ScanningFunction.Attlist2:
1420 return ScanAttlist2();
1421 case ScanningFunction.Attlist3:
1422 return ScanAttlist3();
1423 case ScanningFunction.Attlist4:
1424 return ScanAttlist4();
1425 case ScanningFunction.Attlist5:
1426 return ScanAttlist5();
1427 case ScanningFunction.Attlist6:
1428 return ScanAttlist6();
1429 case ScanningFunction.Attlist7:
1430 return ScanAttlist7();
1431 case ScanningFunction.Notation1:
1432 return ScanNotation1();
1433 case ScanningFunction.SystemId:
1434 return ScanSystemId();
1435 case ScanningFunction.PublicId1:
1436 return ScanPublicId1();
1437 case ScanningFunction.PublicId2:
1438 return ScanPublicId2();
1439 case ScanningFunction.Entity1:
1440 return ScanEntity1();
1441 case ScanningFunction.Entity2:
1442 return ScanEntity2();
1443 case ScanningFunction.Entity3:
1444 return ScanEntity3();
1445 case ScanningFunction.CondSection1:
1446 return ScanCondSection1();
1447 case ScanningFunction.CondSection2:
1448 return ScanCondSection2();
1449 case ScanningFunction.CondSection3:
1450 return ScanCondSection3();
1451 case ScanningFunction.ClosingTag:
1452 return ScanClosingTag();
1453 case ScanningFunction.ParamEntitySpace:
1454 break;
1455 default:
1456 return Token.None;
1457 }
1458 _whitespaceSeen = true;
1460 }
1461 }
1462 if ((_readerAdapter.IsEof || ReadData() == 0) && !HandleEntityEnd(inLiteral: false))
1463 {
1464 if (_scanningFunction == ScanningFunction.SubsetContent)
1465 {
1466 break;
1467 }
1469 }
1470 }
1471 return Token.Eof;
1472 }
1473
1475 {
1476 while (true)
1477 {
1478 char c = _chars[_curPos];
1479 if (c != '<')
1480 {
1481 if (c != ']')
1482 {
1483 goto IL_04f3;
1484 }
1485 if (_charsUsed - _curPos >= 2 || _readerAdapter.IsEof)
1486 {
1487 if (_chars[_curPos + 1] != ']')
1488 {
1489 _curPos++;
1491 return Token.RightBracket;
1492 }
1493 if (_charsUsed - _curPos >= 3 || _readerAdapter.IsEof)
1494 {
1495 if (_chars[_curPos + 1] == ']' && _chars[_curPos + 2] == '>')
1496 {
1497 break;
1498 }
1499 goto IL_04f3;
1500 }
1501 }
1502 }
1503 else
1504 {
1505 switch (_chars[_curPos + 1])
1506 {
1507 case '!':
1508 switch (_chars[_curPos + 2])
1509 {
1510 case 'E':
1511 if (_chars[_curPos + 3] == 'L')
1512 {
1513 if (_charsUsed - _curPos >= 9)
1514 {
1515 if (_chars[_curPos + 4] != 'E' || _chars[_curPos + 5] != 'M' || _chars[_curPos + 6] != 'E' || _chars[_curPos + 7] != 'N' || _chars[_curPos + 8] != 'T')
1516 {
1518 }
1519 _curPos += 9;
1522 return Token.ElementDecl;
1523 }
1524 }
1525 else if (_chars[_curPos + 3] == 'N')
1526 {
1527 if (_charsUsed - _curPos >= 8)
1528 {
1529 if (_chars[_curPos + 4] != 'T' || _chars[_curPos + 5] != 'I' || _chars[_curPos + 6] != 'T' || _chars[_curPos + 7] != 'Y')
1530 {
1532 }
1533 _curPos += 8;
1535 return Token.EntityDecl;
1536 }
1537 }
1538 else if (_charsUsed - _curPos >= 4)
1539 {
1541 return Token.None;
1542 }
1543 break;
1544 case 'A':
1545 if (_charsUsed - _curPos >= 9)
1546 {
1547 if (_chars[_curPos + 3] != 'T' || _chars[_curPos + 4] != 'T' || _chars[_curPos + 5] != 'L' || _chars[_curPos + 6] != 'I' || _chars[_curPos + 7] != 'S' || _chars[_curPos + 8] != 'T')
1548 {
1550 }
1551 _curPos += 9;
1554 return Token.AttlistDecl;
1555 }
1556 break;
1557 case 'N':
1558 if (_charsUsed - _curPos >= 10)
1559 {
1560 if (_chars[_curPos + 3] != 'O' || _chars[_curPos + 4] != 'T' || _chars[_curPos + 5] != 'A' || _chars[_curPos + 6] != 'T' || _chars[_curPos + 7] != 'I' || _chars[_curPos + 8] != 'O' || _chars[_curPos + 9] != 'N')
1561 {
1563 }
1564 _curPos += 10;
1567 return Token.NotationDecl;
1568 }
1569 break;
1570 case '[':
1571 _curPos += 3;
1572 _scanningFunction = ScanningFunction.CondSection1;
1573 return Token.CondSectionStart;
1574 case '-':
1575 if (_chars[_curPos + 3] == '-')
1576 {
1577 _curPos += 4;
1578 return Token.Comment;
1579 }
1580 if (_charsUsed - _curPos >= 4)
1581 {
1583 }
1584 break;
1585 default:
1586 if (_charsUsed - _curPos >= 3)
1587 {
1589 }
1590 break;
1591 }
1592 break;
1593 case '?':
1594 _curPos += 2;
1595 return Token.PI;
1596 default:
1597 if (_charsUsed - _curPos >= 2)
1598 {
1600 return Token.None;
1601 }
1602 break;
1603 }
1604 }
1605 goto IL_0513;
1606 IL_0513:
1607 if (ReadData() == 0)
1608 {
1610 }
1611 continue;
1612 IL_04f3:
1613 if (_charsUsed - _curPos != 0)
1614 {
1616 }
1617 goto IL_0513;
1618 }
1619 _curPos += 3;
1620 return Token.CondSectionEnd;
1621 }
1622
1624 {
1625 ScanName();
1627 return Token.Name;
1628 }
1629
1631 {
1632 ScanQName();
1634 return Token.QName;
1635 }
1636
1638 {
1639 ScanNmtoken();
1641 return Token.Nmtoken;
1642 }
1643
1645 {
1646 switch (_chars[_curPos])
1647 {
1648 case 'P':
1649 if (!EatPublicKeyword())
1650 {
1652 }
1655 return Token.PUBLIC;
1656 case 'S':
1657 if (!EatSystemKeyword())
1658 {
1660 }
1663 return Token.SYSTEM;
1664 case '[':
1665 _curPos++;
1666 _scanningFunction = ScanningFunction.SubsetContent;
1667 return Token.LeftBracket;
1668 case '>':
1669 _curPos++;
1670 _scanningFunction = ScanningFunction.SubsetContent;
1671 return Token.GreaterThan;
1672 default:
1674 return Token.None;
1675 }
1676 }
1677
1679 {
1680 switch (_chars[_curPos])
1681 {
1682 case '[':
1683 _curPos++;
1684 _scanningFunction = ScanningFunction.SubsetContent;
1685 return Token.LeftBracket;
1686 case '>':
1687 _curPos++;
1688 _scanningFunction = ScanningFunction.SubsetContent;
1689 return Token.GreaterThan;
1690 default:
1692 return Token.None;
1693 }
1694 }
1695
1697 {
1698 if (_chars[_curPos] != '>')
1699 {
1701 }
1702 _curPos++;
1703 _scanningFunction = ScanningFunction.SubsetContent;
1704 return Token.GreaterThan;
1705 }
1706
1708 {
1709 while (true)
1710 {
1711 char c = _chars[_curPos];
1712 if (c != '(')
1713 {
1714 if (c != 'A')
1715 {
1716 if (c == 'E')
1717 {
1718 if (_charsUsed - _curPos < 5)
1719 {
1720 goto IL_011b;
1721 }
1722 if (_chars[_curPos + 1] == 'M' && _chars[_curPos + 2] == 'P' && _chars[_curPos + 3] == 'T' && _chars[_curPos + 4] == 'Y')
1723 {
1724 _curPos += 5;
1726 return Token.EMPTY;
1727 }
1728 }
1729 }
1730 else
1731 {
1732 if (_charsUsed - _curPos < 3)
1733 {
1734 goto IL_011b;
1735 }
1736 if (_chars[_curPos + 1] == 'N' && _chars[_curPos + 2] == 'Y')
1737 {
1738 break;
1739 }
1740 }
1742 goto IL_011b;
1743 }
1745 _curPos++;
1746 return Token.LeftParen;
1747 IL_011b:
1748 if (ReadData() == 0)
1749 {
1751 }
1752 }
1753 _curPos += 3;
1755 return Token.ANY;
1756 }
1757
1759 {
1760 if (_chars[_curPos] == '#')
1761 {
1762 while (_charsUsed - _curPos < 7)
1763 {
1764 if (ReadData() == 0)
1765 {
1767 }
1768 }
1769 if (_chars[_curPos + 1] == 'P' && _chars[_curPos + 2] == 'C' && _chars[_curPos + 3] == 'D' && _chars[_curPos + 4] == 'A' && _chars[_curPos + 5] == 'T' && _chars[_curPos + 6] == 'A')
1770 {
1771 _curPos += 7;
1773 return Token.PCDATA;
1774 }
1776 }
1778 return Token.None;
1779 }
1780
1782 {
1783 switch (_chars[_curPos])
1784 {
1785 case '(':
1786 _curPos++;
1787 return Token.LeftParen;
1788 case '>':
1789 _curPos++;
1790 _scanningFunction = ScanningFunction.SubsetContent;
1791 return Token.GreaterThan;
1792 default:
1793 ScanQName();
1795 return Token.QName;
1796 }
1797 }
1798
1800 {
1802 Token result;
1803 switch (_chars[_curPos])
1804 {
1805 case '*':
1806 result = Token.Star;
1807 break;
1808 case '?':
1809 result = Token.QMark;
1810 break;
1811 case '+':
1812 result = Token.Plus;
1813 break;
1814 default:
1815 return Token.None;
1816 }
1817 if (_whitespaceSeen)
1818 {
1820 }
1821 _curPos++;
1822 return result;
1823 }
1824
1826 {
1827 switch (_chars[_curPos])
1828 {
1829 case ',':
1830 _curPos++;
1832 return Token.Comma;
1833 case '|':
1834 _curPos++;
1836 return Token.Or;
1837 case ')':
1838 _curPos++;
1840 return Token.RightParen;
1841 case '>':
1842 _curPos++;
1843 _scanningFunction = ScanningFunction.SubsetContent;
1844 return Token.GreaterThan;
1845 default:
1847 return Token.None;
1848 }
1849 }
1850
1852 {
1853 switch (_chars[_curPos])
1854 {
1855 case ')':
1856 _curPos++;
1858 return Token.RightParen;
1859 case '|':
1860 _curPos++;
1863 return Token.Or;
1864 default:
1865 ThrowUnexpectedToken(_curPos, ")", "|");
1866 return Token.None;
1867 }
1868 }
1869
1871 {
1873 if (_chars[_curPos] == '*' && !_whitespaceSeen)
1874 {
1875 _curPos++;
1876 return Token.Star;
1877 }
1878 return Token.None;
1879 }
1880
1882 {
1883 char c = _chars[_curPos];
1884 if (c == '>')
1885 {
1886 _curPos++;
1887 _scanningFunction = ScanningFunction.SubsetContent;
1888 return Token.GreaterThan;
1889 }
1890 if (!_whitespaceSeen)
1891 {
1893 }
1894 ScanQName();
1896 return Token.QName;
1897 }
1898
1900 {
1901 while (true)
1902 {
1903 switch (_chars[_curPos])
1904 {
1905 case '(':
1906 _curPos++;
1909 return Token.LeftParen;
1910 case 'C':
1911 if (_charsUsed - _curPos >= 5)
1912 {
1913 if (_chars[_curPos + 1] != 'D' || _chars[_curPos + 2] != 'A' || _chars[_curPos + 3] != 'T' || _chars[_curPos + 4] != 'A')
1914 {
1916 }
1917 _curPos += 5;
1919 return Token.CDATA;
1920 }
1921 break;
1922 case 'E':
1923 if (_charsUsed - _curPos < 9)
1924 {
1925 break;
1926 }
1928 if (_chars[_curPos + 1] != 'N' || _chars[_curPos + 2] != 'T' || _chars[_curPos + 3] != 'I' || _chars[_curPos + 4] != 'T')
1929 {
1931 }
1932 switch (_chars[_curPos + 5])
1933 {
1934 case 'I':
1935 if (_chars[_curPos + 6] != 'E' || _chars[_curPos + 7] != 'S')
1936 {
1938 }
1939 _curPos += 8;
1940 return Token.ENTITIES;
1941 case 'Y':
1942 _curPos += 6;
1943 return Token.ENTITY;
1944 }
1946 break;
1947 case 'I':
1948 if (_charsUsed - _curPos >= 6)
1949 {
1951 if (_chars[_curPos + 1] != 'D')
1952 {
1954 }
1955 if (_chars[_curPos + 2] != 'R')
1956 {
1957 _curPos += 2;
1958 return Token.ID;
1959 }
1960 if (_chars[_curPos + 3] != 'E' || _chars[_curPos + 4] != 'F')
1961 {
1963 }
1964 if (_chars[_curPos + 5] != 'S')
1965 {
1966 _curPos += 5;
1967 return Token.IDREF;
1968 }
1969 _curPos += 6;
1970 return Token.IDREFS;
1971 }
1972 break;
1973 case 'N':
1974 if (_charsUsed - _curPos < 8 && !_readerAdapter.IsEof)
1975 {
1976 break;
1977 }
1978 switch (_chars[_curPos + 1])
1979 {
1980 case 'O':
1981 if (_chars[_curPos + 2] != 'T' || _chars[_curPos + 3] != 'A' || _chars[_curPos + 4] != 'T' || _chars[_curPos + 5] != 'I' || _chars[_curPos + 6] != 'O' || _chars[_curPos + 7] != 'N')
1982 {
1984 }
1985 _curPos += 8;
1987 return Token.NOTATION;
1988 case 'M':
1989 if (_chars[_curPos + 2] != 'T' || _chars[_curPos + 3] != 'O' || _chars[_curPos + 4] != 'K' || _chars[_curPos + 5] != 'E' || _chars[_curPos + 6] != 'N')
1990 {
1992 }
1994 if (_chars[_curPos + 7] == 'S')
1995 {
1996 _curPos += 8;
1997 return Token.NMTOKENS;
1998 }
1999 _curPos += 7;
2000 return Token.NMTOKEN;
2001 }
2003 break;
2004 default:
2006 break;
2007 }
2008 if (ReadData() == 0)
2009 {
2011 }
2012 }
2013 }
2014
2016 {
2017 if (_chars[_curPos] == '(')
2018 {
2019 _curPos++;
2022 return Token.LeftParen;
2023 }
2025 return Token.None;
2026 }
2027
2029 {
2030 switch (_chars[_curPos])
2031 {
2032 case ')':
2033 _curPos++;
2035 return Token.RightParen;
2036 case '|':
2037 _curPos++;
2040 return Token.Or;
2041 default:
2042 ThrowUnexpectedToken(_curPos, ")", "|");
2043 return Token.None;
2044 }
2045 }
2046
2048 {
2049 switch (_chars[_curPos])
2050 {
2051 case ')':
2052 _curPos++;
2054 return Token.RightParen;
2055 case '|':
2056 _curPos++;
2059 return Token.Or;
2060 default:
2061 ThrowUnexpectedToken(_curPos, ")", "|");
2062 return Token.None;
2063 }
2064 }
2065
2067 {
2068 while (true)
2069 {
2070 switch (_chars[_curPos])
2071 {
2072 case '"':
2073 case '\'':
2074 ScanLiteral(LiteralType.AttributeValue);
2076 return Token.Literal;
2077 case '#':
2078 if (_charsUsed - _curPos < 6)
2079 {
2080 break;
2081 }
2082 switch (_chars[_curPos + 1])
2083 {
2084 case 'R':
2085 if (_charsUsed - _curPos >= 9)
2086 {
2087 if (_chars[_curPos + 2] != 'E' || _chars[_curPos + 3] != 'Q' || _chars[_curPos + 4] != 'U' || _chars[_curPos + 5] != 'I' || _chars[_curPos + 6] != 'R' || _chars[_curPos + 7] != 'E' || _chars[_curPos + 8] != 'D')
2088 {
2090 }
2091 _curPos += 9;
2093 return Token.REQUIRED;
2094 }
2095 break;
2096 case 'I':
2097 if (_charsUsed - _curPos >= 8)
2098 {
2099 if (_chars[_curPos + 2] != 'M' || _chars[_curPos + 3] != 'P' || _chars[_curPos + 4] != 'L' || _chars[_curPos + 5] != 'I' || _chars[_curPos + 6] != 'E' || _chars[_curPos + 7] != 'D')
2100 {
2102 }
2103 _curPos += 8;
2105 return Token.IMPLIED;
2106 }
2107 break;
2108 case 'F':
2109 if (_chars[_curPos + 2] != 'I' || _chars[_curPos + 3] != 'X' || _chars[_curPos + 4] != 'E' || _chars[_curPos + 5] != 'D')
2110 {
2112 }
2113 _curPos += 6;
2115 return Token.FIXED;
2116 default:
2118 break;
2119 }
2120 break;
2121 default:
2123 break;
2124 }
2125 if (ReadData() == 0)
2126 {
2128 }
2129 }
2130 }
2131
2133 {
2134 char c = _chars[_curPos];
2135 if (c == '"' || c == '\'')
2136 {
2137 ScanLiteral(LiteralType.AttributeValue);
2139 return Token.Literal;
2140 }
2141 ThrowUnexpectedToken(_curPos, "\"", "'");
2142 return Token.None;
2143 }
2144
2146 {
2147 char c = _chars[_curPos];
2148 char value = ((literalType == LiteralType.AttributeValue) ? ' ' : '\n');
2151 _curPos++;
2154 while (true)
2155 {
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 {
2233 }
2234 _curPos++;
2235 continue;
2236 case '%':
2237 if (literalType != LiteralType.EntityReplText)
2238 {
2239 _curPos++;
2240 continue;
2241 }
2242 HandleEntityReference(paramEntity: true, inLiteral: true, literalType == LiteralType.AttributeValue);
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 }
2286 int num4 = _readerAdapter.ParseNamedCharRef(expand: false, null);
2288 if (num4 >= 0)
2289 {
2291 _curPos = num4;
2292 continue;
2293 }
2295 _curPos++;
2299 continue;
2300 }
2301 default:
2302 {
2303 if (_curPos == _charsUsed)
2304 {
2305 break;
2306 }
2307 char ch = _chars[_curPos];
2309 {
2310 if (_curPos + 1 == _charsUsed)
2311 {
2312 break;
2313 }
2314 _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 }
2339
2341 {
2342 try
2343 {
2344 ScanName();
2345 }
2346 catch (XmlException ex)
2347 {
2348 Throw(System.SR.Xml_ErrorParsingEntityName, string.Empty, ex.LineNumber, ex.LinePosition);
2349 }
2350 if (_chars[_curPos] != ';')
2351 {
2353 }
2355 _curPos++;
2356 return nameQualified;
2357 }
2358
2360 {
2361 switch (_chars[_curPos])
2362 {
2363 case 'P':
2364 if (!EatPublicKeyword())
2365 {
2367 }
2370 return Token.PUBLIC;
2371 case 'S':
2372 if (!EatSystemKeyword())
2373 {
2375 }
2378 return Token.SYSTEM;
2379 default:
2381 return Token.None;
2382 }
2383 }
2384
2386 {
2387 if (_chars[_curPos] != '"' && _chars[_curPos] != '\'')
2388 {
2389 ThrowUnexpectedToken(_curPos, "\"", "'");
2390 }
2391 ScanLiteral(LiteralType.SystemOrPublicID);
2393 return Token.Literal;
2394 }
2395
2397 {
2398 if (_chars[_curPos] == '%')
2399 {
2400 _curPos++;
2403 return Token.Percent;
2404 }
2405 ScanName();
2407 return Token.Name;
2408 }
2409
2411 {
2412 switch (_chars[_curPos])
2413 {
2414 case 'P':
2415 if (!EatPublicKeyword())
2416 {
2418 }
2421 return Token.PUBLIC;
2422 case 'S':
2423 if (!EatSystemKeyword())
2424 {
2426 }
2429 return Token.SYSTEM;
2430 case '"':
2431 case '\'':
2432 ScanLiteral(LiteralType.EntityReplText);
2434 return Token.Literal;
2435 default:
2437 return Token.None;
2438 }
2439 }
2440
2442 {
2443 if (_chars[_curPos] == 'N')
2444 {
2445 do
2446 {
2447 if (_charsUsed - _curPos >= 5)
2448 {
2449 if (_chars[_curPos + 1] != 'D' || _chars[_curPos + 2] != 'A' || _chars[_curPos + 3] != 'T' || _chars[_curPos + 4] != 'A')
2450 {
2451 break;
2452 }
2453 _curPos += 5;
2456 return Token.NData;
2457 }
2458 }
2459 while (ReadData() != 0);
2460 }
2462 return Token.None;
2463 }
2464
2466 {
2467 if (_chars[_curPos] != '"' && _chars[_curPos] != '\'')
2468 {
2469 ThrowUnexpectedToken(_curPos, "\"", "'");
2470 }
2471 ScanLiteral(LiteralType.SystemOrPublicID);
2473 return Token.Literal;
2474 }
2475
2477 {
2478 if (_chars[_curPos] != '"' && _chars[_curPos] != '\'')
2479 {
2481 return Token.None;
2482 }
2483 ScanLiteral(LiteralType.SystemOrPublicID);
2485 return Token.Literal;
2486 }
2487
2489 {
2490 if (_chars[_curPos] != 'I')
2491 {
2493 }
2494 _curPos++;
2495 while (true)
2496 {
2497 if (_charsUsed - _curPos >= 5)
2498 {
2499 char c = _chars[_curPos];
2500 if (c == 'G')
2501 {
2502 if (_chars[_curPos + 1] != 'N' || _chars[_curPos + 2] != 'O' || _chars[_curPos + 3] != 'R' || _chars[_curPos + 4] != 'E' || XmlCharType.IsNameSingleChar(_chars[_curPos + 5]))
2503 {
2504 break;
2505 }
2507 _scanningFunction = ScanningFunction.CondSection2;
2508 _curPos += 5;
2509 return Token.IGNORE;
2510 }
2511 if (c != 'N')
2512 {
2513 break;
2514 }
2515 if (_charsUsed - _curPos >= 6)
2516 {
2517 if (_chars[_curPos + 1] != 'C' || _chars[_curPos + 2] != 'L' || _chars[_curPos + 3] != 'U' || _chars[_curPos + 4] != 'D' || _chars[_curPos + 5] != 'E' || XmlCharType.IsNameSingleChar(_chars[_curPos + 6]))
2518 {
2519 break;
2520 }
2521 _nextScaningFunction = ScanningFunction.SubsetContent;
2522 _scanningFunction = ScanningFunction.CondSection2;
2523 _curPos += 6;
2524 return Token.INCLUDE;
2525 }
2526 }
2527 if (ReadData() == 0)
2528 {
2530 }
2531 }
2533 return Token.None;
2534 }
2535
2537 {
2538 if (_chars[_curPos] != '[')
2539 {
2541 }
2542 _curPos++;
2544 return Token.LeftBracket;
2545 }
2546
2548 {
2549 int num = 0;
2550 while (true)
2551 {
2553 {
2554 _curPos++;
2555 continue;
2556 }
2557 switch (_chars[_curPos])
2558 {
2559 case '\t':
2560 case '"':
2561 case '&':
2562 case '\'':
2563 _curPos++;
2564 continue;
2565 case '\n':
2566 _curPos++;
2568 continue;
2569 case '\r':
2570 if (_chars[_curPos + 1] == '\n')
2571 {
2572 _curPos += 2;
2573 }
2574 else
2575 {
2576 if (_curPos + 1 >= _charsUsed && !_readerAdapter.IsEof)
2577 {
2578 break;
2579 }
2580 _curPos++;
2581 }
2583 continue;
2584 case '<':
2585 if (_charsUsed - _curPos >= 3)
2586 {
2587 if (_chars[_curPos + 1] != '!' || _chars[_curPos + 2] != '[')
2588 {
2589 _curPos++;
2590 continue;
2591 }
2592 num++;
2593 _curPos += 3;
2594 continue;
2595 }
2596 break;
2597 case ']':
2598 if (_charsUsed - _curPos < 3)
2599 {
2600 break;
2601 }
2602 if (_chars[_curPos + 1] != ']' || _chars[_curPos + 2] != '>')
2603 {
2604 _curPos++;
2605 continue;
2606 }
2607 if (num > 0)
2608 {
2609 num--;
2610 _curPos += 3;
2611 continue;
2612 }
2613 _curPos += 3;
2614 _scanningFunction = ScanningFunction.SubsetContent;
2615 return Token.CondSectionEnd;
2616 default:
2617 {
2618 if (_curPos == _charsUsed)
2619 {
2620 break;
2621 }
2622 char ch = _chars[_curPos];
2624 {
2625 if (_curPos + 1 == _charsUsed)
2626 {
2627 break;
2628 }
2629 _curPos++;
2631 {
2632 _curPos++;
2633 continue;
2634 }
2635 }
2637 return Token.None;
2638 }
2639 }
2640 if (_readerAdapter.IsEof || ReadData() == 0)
2641 {
2642 if (HandleEntityEnd(inLiteral: false))
2643 {
2644 continue;
2645 }
2647 }
2649 }
2650 }
2651
2652 private void ScanName()
2653 {
2654 ScanQName(isQName: false);
2655 }
2656
2657 private void ScanQName()
2658 {
2660 }
2661
2662 private void ScanQName(bool isQName)
2663 {
2665 int num = -1;
2666 while (true)
2667 {
2669 {
2670 _curPos++;
2671 }
2672 else if (_curPos + 1 >= _charsUsed)
2673 {
2674 if (ReadDataInName())
2675 {
2676 continue;
2677 }
2679 }
2680 else
2681 {
2683 }
2684 while (true)
2685 {
2687 {
2688 _curPos++;
2689 continue;
2690 }
2691 if (_chars[_curPos] == ':')
2692 {
2693 if (isQName)
2694 {
2695 break;
2696 }
2697 _curPos++;
2698 continue;
2699 }
2700 if (_curPos == _charsUsed)
2701 {
2702 if (ReadDataInName())
2703 {
2704 continue;
2705 }
2706 if (_tokenStartPos == _curPos)
2707 {
2709 }
2710 }
2711 _colonPos = ((num == -1) ? (-1) : (_tokenStartPos + num));
2712 return;
2713 }
2714 if (num != -1)
2715 {
2717 }
2718 num = _curPos - _tokenStartPos;
2719 _curPos++;
2720 }
2721 }
2722
2723 private bool ReadDataInName()
2724 {
2725 int num = _curPos - _tokenStartPos;
2727 bool result = ReadData() != 0;
2729 _curPos += num;
2730 return result;
2731 }
2732
2733 private void ScanNmtoken()
2734 {
2736 int num;
2737 while (true)
2738 {
2740 {
2741 _curPos++;
2742 continue;
2743 }
2744 if (_curPos < _charsUsed)
2745 {
2746 if (_curPos - _tokenStartPos == 0)
2747 {
2749 }
2750 return;
2751 }
2752 num = _curPos - _tokenStartPos;
2754 if (ReadData() == 0)
2755 {
2756 if (num > 0)
2757 {
2758 break;
2759 }
2761 }
2763 _curPos += num;
2764 }
2766 _curPos += num;
2767 }
2768
2769 private bool EatPublicKeyword()
2770 {
2771 while (_charsUsed - _curPos < 6)
2772 {
2773 if (ReadData() == 0)
2774 {
2775 return false;
2776 }
2777 }
2778 if (_chars[_curPos + 1] != 'U' || _chars[_curPos + 2] != 'B' || _chars[_curPos + 3] != 'L' || _chars[_curPos + 4] != 'I' || _chars[_curPos + 5] != 'C')
2779 {
2780 return false;
2781 }
2782 _curPos += 6;
2783 return true;
2784 }
2785
2786 private bool EatSystemKeyword()
2787 {
2788 while (_charsUsed - _curPos < 6)
2789 {
2790 if (ReadData() == 0)
2791 {
2792 return false;
2793 }
2794 }
2795 if (_chars[_curPos + 1] != 'Y' || _chars[_curPos + 2] != 'S' || _chars[_curPos + 3] != 'T' || _chars[_curPos + 4] != 'E' || _chars[_curPos + 5] != 'M')
2796 {
2797 return false;
2798 }
2799 _curPos += 6;
2800 return true;
2801 }
2802
2816
2817 private string GetNameString()
2818 {
2820 }
2821
2822 private string GetNmtokenString()
2823 {
2824 return GetNameString();
2825 }
2826
2827 private string GetValue()
2828 {
2829 if (_stringBuilder.Length == 0)
2830 {
2832 }
2833 return _stringBuilder.ToString();
2834 }
2835
2837 {
2839 return StripSpaces(value);
2840 }
2841
2842 private int ReadData()
2843 {
2845 int result = _readerAdapter.ReadData();
2847 return result;
2848 }
2849
2856
2857 private void SaveParsingBuffer()
2858 {
2860 }
2861
2874
2880
2882 {
2885 {
2887 }
2889 if (schemaEntity == null)
2890 {
2891 return false;
2892 }
2893 if (schemaEntity.ParsingInProgress)
2894 {
2896 }
2897 int entityId;
2898 if (schemaEntity.IsExternal)
2899 {
2900 if (!_readerAdapter.PushEntity(schemaEntity, out entityId))
2901 {
2902 return false;
2903 }
2905 }
2906 else
2907 {
2908 if (schemaEntity.Text.Length == 0)
2909 {
2910 return false;
2911 }
2912 if (!_readerAdapter.PushEntity(schemaEntity, out entityId))
2913 {
2914 return false;
2915 }
2916 }
2917 _currentEntityId = entityId;
2918 if (paramEntity && !inLiteral && _scanningFunction != ScanningFunction.ParamEntitySpace)
2919 {
2921 _scanningFunction = ScanningFunction.ParamEntitySpace;
2922 }
2924 return true;
2925 }
2926
2927 private bool HandleEntityEnd(bool inLiteral)
2928 {
2931 {
2932 return false;
2933 }
2935 if (oldEntity == null)
2936 {
2937 if (_scanningFunction == ScanningFunction.ParamEntitySpace)
2938 {
2940 }
2941 return false;
2942 }
2943 if (oldEntity.IsExternal)
2944 {
2946 }
2947 if (!inLiteral && _scanningFunction != ScanningFunction.ParamEntitySpace)
2948 {
2950 _scanningFunction = ScanningFunction.ParamEntitySpace;
2951 }
2952 return true;
2953 }
2954
2956 {
2958 if (paramEntity)
2959 {
2961 }
2962 else
2963 {
2965 }
2966 if (value == null)
2967 {
2968 if (paramEntity)
2969 {
2970 if (_validate)
2971 {
2973 }
2974 }
2975 else if (mustBeDeclared)
2976 {
2978 {
2979 if (_validate)
2980 {
2982 }
2983 }
2984 else
2985 {
2987 }
2988 }
2989 return null;
2990 }
2991 if (!value.NData.IsEmpty)
2992 {
2994 }
2995 if (inAttribute && value.IsExternal)
2996 {
2998 }
2999 return value;
3000 }
3001
3002 private void SendValidationEvent(int pos, XmlSeverityType severity, string code, string arg)
3003 {
3005 }
3006
3011
3016
3017 private bool IsAttributeValueType(Token token)
3018 {
3019 if (token >= Token.CDATA)
3020 {
3021 return token <= Token.NOTATION;
3022 }
3023 return false;
3024 }
3025
3026 private void OnUnexpectedError()
3027 {
3029 }
3030
3031 private void Throw(int curPos, string res)
3032 {
3033 Throw(curPos, res, string.Empty);
3034 }
3035
3037 private void Throw(int curPos, string res, string arg)
3038 {
3039 _curPos = curPos;
3040 Uri baseUri = _readerAdapter.BaseUri;
3041 _readerAdapter.Throw(new XmlException(res, arg, LineNo, LinePos, (baseUri == null) ? null : baseUri.ToString()));
3042 }
3043
3045 private void Throw(int curPos, string res, string[] args)
3046 {
3047 _curPos = curPos;
3048 Uri baseUri = _readerAdapter.BaseUri;
3049 _readerAdapter.Throw(new XmlException(res, args, LineNo, LinePos, (baseUri == null) ? null : baseUri.ToString()));
3050 }
3051
3053 private void Throw(string res, string arg, int lineNo, int linePos)
3054 {
3055 Uri baseUri = _readerAdapter.BaseUri;
3056 _readerAdapter.Throw(new XmlException(res, arg, lineNo, linePos, (baseUri == null) ? null : baseUri.ToString()));
3057 }
3058
3059 private void ThrowInvalidChar(int pos, string data, int invCharPos)
3060 {
3062 }
3063
3068
3069 private void ThrowUnexpectedToken(int pos, string expectedToken)
3070 {
3072 }
3073
3074 private void ThrowUnexpectedToken(int pos, string expectedToken1, string expectedToken2)
3075 {
3076 string text = ParseUnexpectedToken(pos);
3077 if (expectedToken2 != null)
3078 {
3079 Throw(_curPos, System.SR.Xml_UnexpectedTokens2, new string[3] { text, expectedToken1, expectedToken2 });
3080 }
3081 else
3082 {
3083 Throw(_curPos, System.SR.Xml_UnexpectedTokenEx, new string[2] { text, expectedToken1 });
3084 }
3085 }
3086
3087 private string ParseUnexpectedToken(int startPos)
3088 {
3090 {
3091 int i;
3092 for (i = startPos; XmlCharType.IsNCNameSingleChar(_chars[i]); i++)
3093 {
3094 }
3095 int num = i - startPos;
3096 return new string(_chars, startPos, (num <= 0) ? 1 : num);
3097 }
3098 return new string(_chars, startPos, 1);
3099 }
3100
3101 internal static string StripSpaces(string value)
3102 {
3103 int length = value.Length;
3104 if (length <= 0)
3105 {
3106 return string.Empty;
3107 }
3108 int num = 0;
3110 while (value[num] == ' ')
3111 {
3112 num++;
3113 if (num == length)
3114 {
3115 return " ";
3116 }
3117 }
3118 int i;
3119 for (i = num; i < length; i++)
3120 {
3121 if (value[i] != ' ')
3122 {
3123 continue;
3124 }
3125 int j;
3126 for (j = i + 1; j < length && value[j] == ' '; j++)
3127 {
3128 }
3129 if (j == length)
3130 {
3131 if (stringBuilder == null)
3132 {
3133 return value.Substring(num, i - num);
3134 }
3135 stringBuilder.Append(value, num, i - num);
3136 return stringBuilder.ToString();
3137 }
3138 if (j > i + 1)
3139 {
3140 if (stringBuilder == null)
3141 {
3143 }
3144 stringBuilder.Append(value, num, i - num + 1);
3145 num = j;
3146 i = j - 1;
3147 }
3148 }
3149 if (stringBuilder == null)
3150 {
3151 if (num != 0)
3152 {
3153 return value.Substring(num, length - num);
3154 }
3155 return value;
3156 }
3157 if (i > num)
3158 {
3159 stringBuilder.Append(value, num, i - num);
3160 }
3161 return stringBuilder.ToString();
3162 }
3163
3170
3171 async Task<IDtdInfo> IDtdParser.ParseFreeFloatingDtdAsync(string baseUri, string docTypeName, string publicId, string systemId, string internalSubset, IDtdParserAdapter adapter)
3172 {
3173 InitializeFreeFloatingDtd(baseUri, docTypeName, publicId, systemId, internalSubset, adapter);
3174 await ParseAsync(saveInternalSubset: false).ConfigureAwait(continueOnCapturedContext: false);
3175 return _schemaInfo;
3176 }
3177
3179 {
3180 if (!_freeFloatingDtd)
3181 {
3183 }
3184 else
3185 {
3187 }
3189 if (!_validate || _undeclaredNotations == null)
3190 {
3191 return;
3192 }
3194 {
3196 {
3198 }
3199 }
3200 }
3201
3203 {
3207 if (await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false) != Token.QName)
3208 {
3210 }
3212 Token token = await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false);
3213 if (token == Token.SYSTEM || token == Token.PUBLIC)
3214 {
3215 (string, string) tuple = await ParseExternalIdAsync(token, Token.DOCTYPE).ConfigureAwait(continueOnCapturedContext: false);
3216 _publicId = tuple.Item1;
3217 _systemId = tuple.Item2;
3218 token = await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false);
3219 }
3220 switch (token)
3221 {
3222 case Token.LeftBracket:
3224 {
3227 }
3229 break;
3230 default:
3232 break;
3233 case Token.GreaterThan:
3234 break;
3235 }
3237 if (_systemId != null && _systemId.Length > 0)
3238 {
3240 }
3241 }
3242
3244 {
3246 {
3250 }
3251 if (_systemId != null && _systemId.Length > 0)
3252 {
3254 }
3255 }
3256
3258 {
3259 return ParseSubsetAsync();
3260 }
3261
3263 {
3265 {
3266 Uri baseUri = _readerAdapter.BaseUri;
3267 if (baseUri != null)
3268 {
3269 _externalDtdBaseUri = baseUri.ToString();
3270 }
3273 await ParseSubsetAsync().ConfigureAwait(continueOnCapturedContext: false);
3274 }
3275 }
3276
3278 {
3279 while (true)
3280 {
3281 Token token = await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false);
3283 switch (token)
3284 {
3285 case Token.AttlistDecl:
3286 await ParseAttlistDeclAsync().ConfigureAwait(continueOnCapturedContext: false);
3287 break;
3288 case Token.ElementDecl:
3289 await ParseElementDeclAsync().ConfigureAwait(continueOnCapturedContext: false);
3290 break;
3291 case Token.EntityDecl:
3292 await ParseEntityDeclAsync().ConfigureAwait(continueOnCapturedContext: false);
3293 break;
3294 case Token.NotationDecl:
3296 break;
3297 case Token.Comment:
3298 await ParseCommentAsync().ConfigureAwait(continueOnCapturedContext: false);
3299 break;
3300 case Token.PI:
3301 await ParsePIAsync().ConfigureAwait(continueOnCapturedContext: false);
3302 break;
3303 case Token.CondSectionStart:
3305 {
3307 }
3308 await ParseCondSectionAsync().ConfigureAwait(continueOnCapturedContext: false);
3310 break;
3311 case Token.CondSectionEnd:
3312 if (_condSectionDepth > 0)
3313 {
3316 {
3318 }
3319 }
3320 else
3321 {
3323 }
3324 break;
3325 case Token.RightBracket:
3327 {
3328 if (_condSectionDepth != 0)
3329 {
3331 }
3332 if (_internalSubsetValueSb != null)
3333 {
3337 }
3338 if (await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false) != Token.GreaterThan)
3339 {
3341 }
3342 }
3343 else
3344 {
3346 }
3347 return;
3348 case Token.Eof:
3350 {
3352 }
3353 if (_condSectionDepth != 0)
3354 {
3356 }
3357 return;
3358 }
3360 {
3361 if (_validate)
3362 {
3364 }
3365 else if (!_v1Compat)
3366 {
3368 }
3369 }
3370 }
3371 }
3372
3374 {
3375 if (await GetTokenAsync(needWhiteSpace: true).ConfigureAwait(continueOnCapturedContext: false) == Token.QName)
3376 {
3379 {
3382 }
3383 SchemaAttDef attrDef = null;
3384 while (true)
3385 {
3386 switch (await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false))
3387 {
3388 case Token.QName:
3389 {
3392 {
3393 IsDeclaredInExternal = !ParsingInternalSubset,
3394 LineNumber = LineNo,
3395 LinePosition = LinePos - (_curPos - _tokenStartPos)
3396 };
3397 bool attrDefAlreadyExists = elementDecl.GetAttDef(attrDef.Name) != null;
3400 if (attrDef.Prefix.Length > 0 && attrDef.Prefix.Equals("xml"))
3401 {
3402 if (attrDef.Name.Name == "space")
3403 {
3404 if (_v1Compat)
3405 {
3406 string text = attrDef.DefaultValueExpanded.Trim();
3407 if (text.Equals("preserve") || text.Equals("default"))
3408 {
3410 }
3411 }
3412 else
3413 {
3415 if (attrDef.TokenizedType != XmlTokenizedType.ENUMERATION)
3416 {
3417 Throw(System.SR.Xml_EnumerationRequired, string.Empty, attrDef.LineNumber, attrDef.LinePosition);
3418 }
3419 if (_validate)
3420 {
3422 }
3423 }
3424 }
3425 else if (attrDef.Name.Name == "lang")
3426 {
3428 }
3429 }
3431 {
3432 elementDecl.AddAttDef(attrDef);
3433 }
3434 continue;
3435 }
3436 case Token.GreaterThan:
3437 if (_v1Compat && attrDef != null && attrDef.Prefix.Length > 0 && attrDef.Prefix.Equals("xml") && attrDef.Name.Name == "space")
3438 {
3440 if (attrDef.Datatype.TokenizedType != XmlTokenizedType.ENUMERATION)
3441 {
3442 Throw(System.SR.Xml_EnumerationRequired, string.Empty, attrDef.LineNumber, attrDef.LinePosition);
3443 }
3444 if (_validate)
3445 {
3447 }
3448 }
3449 return;
3450 }
3451 break;
3452 }
3453 }
3455 }
3456
3458 {
3459 Token token = await GetTokenAsync(needWhiteSpace: true).ConfigureAwait(continueOnCapturedContext: false);
3460 if (token != 0)
3461 {
3463 }
3464 if (IsAttributeValueType(token))
3465 {
3468 switch (token)
3469 {
3470 default:
3471 return;
3472 case Token.ID:
3473 if (_validate && elementDecl.IsIdDeclared)
3474 {
3475 SchemaAttDef attDef = elementDecl.GetAttDef(attrDef.Name);
3476 if ((attDef == null || attDef.Datatype.TokenizedType != XmlTokenizedType.ID) && !ignoreErrors)
3477 {
3479 }
3480 }
3482 return;
3483 case Token.NOTATION:
3484 break;
3485 }
3486 if (_validate)
3487 {
3488 if (elementDecl.IsNotationDeclared && !ignoreErrors)
3489 {
3491 }
3492 else
3493 {
3494 if (elementDecl.ContentValidator != null && elementDecl.ContentValidator.ContentType == XmlSchemaContentType.Empty && !ignoreErrors)
3495 {
3497 }
3499 }
3500 }
3501 if (await GetTokenAsync(needWhiteSpace: true).ConfigureAwait(continueOnCapturedContext: false) == Token.LeftParen && await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false) == Token.Name)
3502 {
3503 do
3504 {
3505 string nameString = GetNameString();
3507 {
3509 }
3510 if (_validate && !_v1Compat && attrDef.Values != null && attrDef.Values.Contains(nameString) && !ignoreErrors)
3511 {
3513 }
3514 attrDef.AddValue(nameString);
3515 switch (await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false))
3516 {
3517 case Token.Or:
3518 continue;
3519 case Token.RightParen:
3520 return;
3521 }
3522 break;
3523 }
3524 while (await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false) == Token.Name);
3525 }
3526 }
3527 else if (token == Token.LeftParen)
3528 {
3531 if (await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false) == Token.Nmtoken)
3532 {
3533 attrDef.AddValue(GetNameString());
3534 while (true)
3535 {
3536 string nmtokenString;
3537 switch (await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false))
3538 {
3539 case Token.Or:
3540 if (await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false) == Token.Nmtoken)
3541 {
3543 if (_validate && !_v1Compat && attrDef.Values != null && attrDef.Values.Contains(nmtokenString) && !ignoreErrors)
3544 {
3546 }
3547 goto IL_068c;
3548 }
3549 break;
3550 case Token.RightParen:
3551 return;
3552 }
3553 break;
3554 IL_068c:
3555 attrDef.AddValue(nmtokenString);
3556 }
3557 }
3558 }
3560 }
3561
3563 {
3564 switch (await GetTokenAsync(needWhiteSpace: true).ConfigureAwait(continueOnCapturedContext: false))
3565 {
3566 case Token.REQUIRED:
3568 return;
3569 case Token.IMPLIED:
3571 return;
3572 case Token.FIXED:
3574 if (await GetTokenAsync(needWhiteSpace: true).ConfigureAwait(continueOnCapturedContext: false) != Token.Literal)
3575 {
3576 break;
3577 }
3578 goto case Token.Literal;
3579 case Token.Literal:
3580 if (_validate && attrDef.Datatype.TokenizedType == XmlTokenizedType.ID && !ignoreErrors)
3581 {
3583 }
3584 if (attrDef.TokenizedType != 0)
3585 {
3587 }
3588 else
3589 {
3591 }
3595 return;
3596 }
3598 }
3599
3601 {
3602 if (await GetTokenAsync(needWhiteSpace: true).ConfigureAwait(continueOnCapturedContext: false) == Token.QName)
3603 {
3607 {
3608 if (_validate)
3609 {
3611 }
3612 }
3613 else
3614 {
3616 {
3618 }
3619 else
3620 {
3622 }
3624 }
3626 Token token = await GetTokenAsync(needWhiteSpace: true).ConfigureAwait(continueOnCapturedContext: false);
3627 if (token != Token.LeftParen)
3628 {
3629 if (token != Token.ANY)
3630 {
3631 if (token != Token.EMPTY)
3632 {
3633 goto IL_0483;
3634 }
3636 }
3637 else
3638 {
3640 }
3641 }
3642 else
3643 {
3644 int startParenEntityId = _currentEntityId;
3646 if (token2 != Token.None)
3647 {
3648 if (token2 != Token.PCDATA)
3649 {
3650 goto IL_0483;
3651 }
3653 pcv.Start();
3654 pcv.OpenGroup();
3655 await ParseElementMixedContentAsync(pcv, startParenEntityId).ConfigureAwait(continueOnCapturedContext: false);
3656 elementDecl.ContentValidator = pcv.Finish(useDFA: true);
3657 }
3658 else
3659 {
3661 pcv.Start();
3662 pcv.OpenGroup();
3663 await ParseElementOnlyContentAsync(pcv, startParenEntityId).ConfigureAwait(continueOnCapturedContext: false);
3664 elementDecl.ContentValidator = pcv.Finish(useDFA: true);
3665 }
3666 }
3667 if (await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false) != Token.GreaterThan)
3668 {
3670 }
3671 return;
3672 }
3673 goto IL_0483;
3674 IL_0483:
3676 }
3677
3679 {
3681 ParseElementOnlyContent_LocalFrame currentFrame = new ParseElementOnlyContent_LocalFrame(startParenEntityId);
3682 localFrames.Push(currentFrame);
3683 while (true)
3684 {
3685 Token token = await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false);
3686 if (token != Token.QName)
3687 {
3688 if (token != Token.LeftParen)
3689 {
3690 if (token != Token.GreaterThan)
3691 {
3692 goto IL_036a;
3693 }
3695 goto IL_0370;
3696 }
3697 pcv.OpenGroup();
3699 localFrames.Push(currentFrame);
3700 continue;
3701 }
3702 pcv.AddName(GetNameQualified(canHavePrefix: true), null);
3703 await ParseHowManyAsync(pcv).ConfigureAwait(continueOnCapturedContext: false);
3704 goto IL_01a2;
3705 IL_036a:
3707 goto IL_0370;
3708 IL_02aa:
3709 pcv.CloseGroup();
3710 if (_validate && _currentEntityId != currentFrame.startParenEntityId)
3711 {
3713 }
3714 await ParseHowManyAsync(pcv).ConfigureAwait(continueOnCapturedContext: false);
3715 goto IL_0370;
3716 IL_026d:
3717 if (currentFrame.parsingSchema == Token.Comma)
3718 {
3720 }
3721 pcv.AddChoice();
3723 continue;
3724 IL_0370:
3725 localFrames.Pop();
3726 if (localFrames.Count > 0)
3727 {
3728 currentFrame = localFrames.Peek();
3729 goto IL_01a2;
3730 }
3731 break;
3732 IL_0357:
3734 goto IL_0370;
3735 IL_01a2:
3736 switch (await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false))
3737 {
3738 case Token.Comma:
3739 break;
3740 case Token.Or:
3741 goto IL_026d;
3742 case Token.RightParen:
3743 goto IL_02aa;
3744 case Token.GreaterThan:
3745 goto IL_0357;
3746 default:
3747 goto IL_036a;
3748 }
3749 if (currentFrame.parsingSchema == Token.Or)
3750 {
3752 }
3753 pcv.AddSequence();
3755 }
3756 }
3757
3759 {
3760 switch (await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false))
3761 {
3762 case Token.Star:
3763 pcv.AddStar();
3764 break;
3765 case Token.QMark:
3766 pcv.AddQMark();
3767 break;
3768 case Token.Plus:
3769 pcv.AddPlus();
3770 break;
3771 }
3772 }
3773
3775 {
3776 bool hasNames = false;
3777 int connectorEntityId = -1;
3779 while (true)
3780 {
3781 switch (await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false))
3782 {
3783 case Token.RightParen:
3784 pcv.CloseGroup();
3785 if (_validate && _currentEntityId != startParenEntityId)
3786 {
3788 }
3789 if (await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false) == Token.Star && hasNames)
3790 {
3791 pcv.AddStar();
3792 }
3793 else if (hasNames)
3794 {
3796 }
3797 return;
3798 case Token.Or:
3799 {
3800 if (!hasNames)
3801 {
3802 hasNames = true;
3803 }
3804 else
3805 {
3806 pcv.AddChoice();
3807 }
3808 if (_validate)
3809 {
3812 {
3814 }
3815 }
3816 if (await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false) != Token.QName)
3817 {
3818 break;
3819 }
3821 if (pcv.Exists(nameQualified) && _validate)
3822 {
3824 }
3825 pcv.AddName(nameQualified, null);
3826 if (_validate)
3827 {
3830 {
3832 }
3833 }
3834 continue;
3835 }
3836 }
3838 }
3839 }
3840
3842 {
3843 bool isParamEntity = false;
3844 Token token = await GetTokenAsync(needWhiteSpace: true).ConfigureAwait(continueOnCapturedContext: false);
3845 if (token == Token.Name)
3846 {
3847 goto IL_013a;
3848 }
3849 if (token == Token.Percent)
3850 {
3851 isParamEntity = true;
3852 if (await GetTokenAsync(needWhiteSpace: true).ConfigureAwait(continueOnCapturedContext: false) == Token.Name)
3853 {
3854 goto IL_013a;
3855 }
3856 }
3857 goto IL_0552;
3858 IL_013a:
3861 {
3862 BaseURI = BaseUriStr,
3864 };
3865 if (isParamEntity)
3866 {
3868 {
3870 }
3871 }
3873 {
3875 }
3879 if ((uint)(token2 - 33) > 1u)
3880 {
3881 if (token2 != Token.Literal)
3882 {
3883 goto IL_0552;
3884 }
3888 }
3889 else
3890 {
3891 (string, string) tuple = await ParseExternalIdAsync(token2, Token.EntityDecl).ConfigureAwait(continueOnCapturedContext: false);
3892 string item = tuple.Item1;
3893 string item2 = tuple.Item2;
3894 entity.IsExternal = true;
3895 entity.Url = item2;
3897 if (await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false) == Token.NData)
3898 {
3899 if (isParamEntity)
3900 {
3901 ThrowUnexpectedToken(_curPos - 5, ">");
3902 }
3903 if (!_whitespaceSeen)
3904 {
3906 }
3907 if (await GetTokenAsync(needWhiteSpace: true).ConfigureAwait(continueOnCapturedContext: false) != Token.Name)
3908 {
3909 goto IL_0552;
3910 }
3912 string name = entity.NData.Name;
3914 {
3916 }
3917 }
3918 }
3919 if (await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false) == Token.GreaterThan)
3920 {
3922 return;
3923 }
3924 goto IL_0552;
3925 IL_0552:
3927 }
3928
3930 {
3931 if (await GetTokenAsync(needWhiteSpace: true).ConfigureAwait(continueOnCapturedContext: false) != Token.Name)
3932 {
3934 }
3936 SchemaNotation notation = null;
3938 {
3939 if (_undeclaredNotations != null)
3940 {
3942 }
3945 }
3946 else if (_validate)
3947 {
3949 }
3950 Token token = await GetTokenAsync(needWhiteSpace: true).ConfigureAwait(continueOnCapturedContext: false);
3951 if (token == Token.SYSTEM || token == Token.PUBLIC)
3952 {
3953 var (pubid, systemLiteral) = await ParseExternalIdAsync(token, Token.NOTATION).ConfigureAwait(continueOnCapturedContext: false);
3954 if (notation != null)
3955 {
3958 }
3959 }
3960 else
3961 {
3963 }
3964 if (await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false) != Token.GreaterThan)
3965 {
3967 }
3968 }
3969
3971 {
3973 try
3974 {
3976 {
3978 }
3979 else
3980 {
3983 }
3984 }
3985 catch (XmlException ex)
3986 {
3987 if (!(ex.ResString == System.SR.Xml_UnexpectedEOF) || _currentEntityId == 0)
3988 {
3989 throw;
3990 }
3992 }
3994 }
3995
4010
4012 {
4014 switch (await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false))
4015 {
4016 case Token.INCLUDE:
4017 if (await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false) == Token.LeftBracket)
4018 {
4020 {
4022 }
4023 if (_validate)
4024 {
4025 if (_condSectionEntityIds == null)
4026 {
4027 _condSectionEntityIds = new int[2];
4028 }
4029 else if (_condSectionEntityIds.Length == _condSectionDepth)
4030 {
4031 int[] array = new int[_condSectionEntityIds.Length * 2];
4034 }
4036 }
4038 break;
4039 }
4040 goto default;
4041 case Token.IGNORE:
4042 if (await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false) == Token.LeftBracket)
4043 {
4045 {
4047 }
4048 if (await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false) == Token.CondSectionEnd)
4049 {
4051 {
4053 }
4054 break;
4055 }
4056 }
4057 goto default;
4058 default:
4060 break;
4061 }
4062 }
4063
4065 {
4067 string publicId = null;
4068 string systemId = null;
4069 if (await GetTokenAsync(needWhiteSpace: true).ConfigureAwait(continueOnCapturedContext: false) != Token.Literal)
4070 {
4071 ThrowUnexpectedToken(_curPos, "\"", "'");
4072 }
4073 if (idTokenType == Token.SYSTEM)
4074 {
4075 systemId = GetValue();
4076 if (systemId.Contains('#'))
4077 {
4078 Throw(_curPos - systemId.Length - 1, System.SR.Xml_FragmentId, new string[2]
4079 {
4080 systemId.Substring(systemId.IndexOf('#')),
4081 systemId
4082 });
4083 }
4084 if (declType == Token.DOCTYPE && !_freeFloatingDtd)
4085 {
4088 }
4089 }
4090 else
4091 {
4092 publicId = GetValue();
4093 int num;
4094 if ((num = XmlCharType.IsPublicId(publicId)) >= 0)
4095 {
4096 ThrowInvalidChar(_curPos - 1 - publicId.Length + num, publicId, num);
4097 }
4098 if (declType == Token.DOCTYPE && !_freeFloatingDtd)
4099 {
4102 if (await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false) == Token.Literal)
4103 {
4104 if (!_whitespaceSeen)
4105 {
4107 }
4108 systemId = GetValue();
4111 }
4112 else
4113 {
4114 ThrowUnexpectedToken(_curPos, "\"", "'");
4115 }
4116 }
4117 else if (await GetTokenAsync(needWhiteSpace: false).ConfigureAwait(continueOnCapturedContext: false) == Token.Literal)
4118 {
4119 if (!_whitespaceSeen)
4120 {
4122 }
4123 systemId = GetValue();
4124 }
4125 else if (declType != Token.NOTATION)
4126 {
4127 ThrowUnexpectedToken(_curPos, "\"", "'");
4128 }
4129 }
4130 return (publicId, systemId);
4131 }
4132
4134 {
4135 _whitespaceSeen = false;
4136 while (true)
4137 {
4138 switch (_chars[_curPos])
4139 {
4140 case '\0':
4141 if (_curPos != _charsUsed)
4142 {
4144 }
4145 break;
4146 case '\n':
4147 _whitespaceSeen = true;
4148 _curPos++;
4150 continue;
4151 case '\r':
4152 _whitespaceSeen = true;
4153 if (_chars[_curPos + 1] == '\n')
4154 {
4155 if (Normalize)
4156 {
4159 }
4160 _curPos += 2;
4161 }
4162 else
4163 {
4164 if (_curPos + 1 >= _charsUsed && !_readerAdapter.IsEof)
4165 {
4166 break;
4167 }
4168 _chars[_curPos] = '\n';
4169 _curPos++;
4170 }
4172 continue;
4173 case '\t':
4174 case ' ':
4175 _whitespaceSeen = true;
4176 _curPos++;
4177 continue;
4178 case '%':
4179 if (_charsUsed - _curPos < 2)
4180 {
4181 break;
4182 }
4184 {
4186 {
4187 _curPos++;
4188 }
4189 else
4190 {
4191 await HandleEntityReferenceAsync(paramEntity: true, inLiteral: false, inAttribute: false).ConfigureAwait(continueOnCapturedContext: false);
4192 }
4193 continue;
4194 }
4195 goto default;
4196 default:
4198 {
4200 }
4202 while (true)
4203 {
4204 switch (_scanningFunction)
4205 {
4206 case ScanningFunction.Name:
4207 return await ScanNameExpectedAsync().ConfigureAwait(continueOnCapturedContext: false);
4208 case ScanningFunction.QName:
4209 return await ScanQNameExpectedAsync().ConfigureAwait(continueOnCapturedContext: false);
4210 case ScanningFunction.Nmtoken:
4211 return await ScanNmtokenExpectedAsync().ConfigureAwait(continueOnCapturedContext: false);
4212 case ScanningFunction.SubsetContent:
4213 return await ScanSubsetContentAsync().ConfigureAwait(continueOnCapturedContext: false);
4214 case ScanningFunction.Doctype1:
4215 return await ScanDoctype1Async().ConfigureAwait(continueOnCapturedContext: false);
4216 case ScanningFunction.Doctype2:
4217 return ScanDoctype2();
4218 case ScanningFunction.Element1:
4219 return await ScanElement1Async().ConfigureAwait(continueOnCapturedContext: false);
4220 case ScanningFunction.Element2:
4221 return await ScanElement2Async().ConfigureAwait(continueOnCapturedContext: false);
4222 case ScanningFunction.Element3:
4223 return await ScanElement3Async().ConfigureAwait(continueOnCapturedContext: false);
4224 case ScanningFunction.Element4:
4225 return ScanElement4();
4226 case ScanningFunction.Element5:
4227 return ScanElement5();
4228 case ScanningFunction.Element6:
4229 return ScanElement6();
4230 case ScanningFunction.Element7:
4231 return ScanElement7();
4232 case ScanningFunction.Attlist1:
4233 return await ScanAttlist1Async().ConfigureAwait(continueOnCapturedContext: false);
4234 case ScanningFunction.Attlist2:
4235 return await ScanAttlist2Async().ConfigureAwait(continueOnCapturedContext: false);
4236 case ScanningFunction.Attlist3:
4237 return ScanAttlist3();
4238 case ScanningFunction.Attlist4:
4239 return ScanAttlist4();
4240 case ScanningFunction.Attlist5:
4241 return ScanAttlist5();
4242 case ScanningFunction.Attlist6:
4243 return await ScanAttlist6Async().ConfigureAwait(continueOnCapturedContext: false);
4244 case ScanningFunction.Attlist7:
4245 return ScanAttlist7();
4246 case ScanningFunction.Notation1:
4247 return await ScanNotation1Async().ConfigureAwait(continueOnCapturedContext: false);
4248 case ScanningFunction.SystemId:
4249 return await ScanSystemIdAsync().ConfigureAwait(continueOnCapturedContext: false);
4250 case ScanningFunction.PublicId1:
4251 return await ScanPublicId1Async().ConfigureAwait(continueOnCapturedContext: false);
4252 case ScanningFunction.PublicId2:
4253 return await ScanPublicId2Async().ConfigureAwait(continueOnCapturedContext: false);
4254 case ScanningFunction.Entity1:
4255 return await ScanEntity1Async().ConfigureAwait(continueOnCapturedContext: false);
4256 case ScanningFunction.Entity2:
4257 return await ScanEntity2Async().ConfigureAwait(continueOnCapturedContext: false);
4258 case ScanningFunction.Entity3:
4259 return await ScanEntity3Async().ConfigureAwait(continueOnCapturedContext: false);
4260 case ScanningFunction.CondSection1:
4261 return await ScanCondSection1Async().ConfigureAwait(continueOnCapturedContext: false);
4262 case ScanningFunction.CondSection2:
4263 return ScanCondSection2();
4264 case ScanningFunction.CondSection3:
4265 return await ScanCondSection3Async().ConfigureAwait(continueOnCapturedContext: false);
4266 case ScanningFunction.ClosingTag:
4267 return ScanClosingTag();
4268 case ScanningFunction.ParamEntitySpace:
4269 break;
4270 default:
4271 return Token.None;
4272 }
4273 _whitespaceSeen = true;
4275 }
4276 }
4277 bool isEof = _readerAdapter.IsEof;
4278 bool flag = isEof;
4279 if (!flag)
4280 {
4281 flag = await ReadDataAsync().ConfigureAwait(continueOnCapturedContext: false) == 0;
4282 }
4283 if (flag && !HandleEntityEnd(inLiteral: false))
4284 {
4285 if (_scanningFunction == ScanningFunction.SubsetContent)
4286 {
4287 break;
4288 }
4290 }
4291 }
4292 return Token.Eof;
4293 }
4294
4296 {
4297 while (true)
4298 {
4299 char c = _chars[_curPos];
4300 if (c != '<')
4301 {
4302 if (c != ']')
4303 {
4304 goto IL_0548;
4305 }
4306 if (_charsUsed - _curPos >= 2 || _readerAdapter.IsEof)
4307 {
4308 if (_chars[_curPos + 1] != ']')
4309 {
4310 _curPos++;
4312 return Token.RightBracket;
4313 }
4314 if (_charsUsed - _curPos >= 3 || _readerAdapter.IsEof)
4315 {
4316 if (_chars[_curPos + 1] == ']' && _chars[_curPos + 2] == '>')
4317 {
4318 break;
4319 }
4320 goto IL_0548;
4321 }
4322 }
4323 }
4324 else
4325 {
4326 switch (_chars[_curPos + 1])
4327 {
4328 case '!':
4329 switch (_chars[_curPos + 2])
4330 {
4331 case 'E':
4332 if (_chars[_curPos + 3] == 'L')
4333 {
4334 if (_charsUsed - _curPos >= 9)
4335 {
4336 if (_chars[_curPos + 4] != 'E' || _chars[_curPos + 5] != 'M' || _chars[_curPos + 6] != 'E' || _chars[_curPos + 7] != 'N' || _chars[_curPos + 8] != 'T')
4337 {
4339 }
4340 _curPos += 9;
4343 return Token.ElementDecl;
4344 }
4345 }
4346 else if (_chars[_curPos + 3] == 'N')
4347 {
4348 if (_charsUsed - _curPos >= 8)
4349 {
4350 if (_chars[_curPos + 4] != 'T' || _chars[_curPos + 5] != 'I' || _chars[_curPos + 6] != 'T' || _chars[_curPos + 7] != 'Y')
4351 {
4353 }
4354 _curPos += 8;
4356 return Token.EntityDecl;
4357 }
4358 }
4359 else if (_charsUsed - _curPos >= 4)
4360 {
4362 return Token.None;
4363 }
4364 break;
4365 case 'A':
4366 if (_charsUsed - _curPos >= 9)
4367 {
4368 if (_chars[_curPos + 3] != 'T' || _chars[_curPos + 4] != 'T' || _chars[_curPos + 5] != 'L' || _chars[_curPos + 6] != 'I' || _chars[_curPos + 7] != 'S' || _chars[_curPos + 8] != 'T')
4369 {
4371 }
4372 _curPos += 9;
4375 return Token.AttlistDecl;
4376 }
4377 break;
4378 case 'N':
4379 if (_charsUsed - _curPos >= 10)
4380 {
4381 if (_chars[_curPos + 3] != 'O' || _chars[_curPos + 4] != 'T' || _chars[_curPos + 5] != 'A' || _chars[_curPos + 6] != 'T' || _chars[_curPos + 7] != 'I' || _chars[_curPos + 8] != 'O' || _chars[_curPos + 9] != 'N')
4382 {
4384 }
4385 _curPos += 10;
4388 return Token.NotationDecl;
4389 }
4390 break;
4391 case '[':
4392 _curPos += 3;
4393 _scanningFunction = ScanningFunction.CondSection1;
4394 return Token.CondSectionStart;
4395 case '-':
4396 if (_chars[_curPos + 3] == '-')
4397 {
4398 _curPos += 4;
4399 return Token.Comment;
4400 }
4401 if (_charsUsed - _curPos >= 4)
4402 {
4404 }
4405 break;
4406 default:
4407 if (_charsUsed - _curPos >= 3)
4408 {
4410 }
4411 break;
4412 }
4413 break;
4414 case '?':
4415 _curPos += 2;
4416 return Token.PI;
4417 default:
4418 if (_charsUsed - _curPos >= 2)
4419 {
4421 return Token.None;
4422 }
4423 break;
4424 }
4425 }
4426 goto IL_0568;
4427 IL_0568:
4428 if (await ReadDataAsync().ConfigureAwait(continueOnCapturedContext: false) == 0)
4429 {
4431 }
4432 continue;
4433 IL_0548:
4434 if (_charsUsed - _curPos != 0)
4435 {
4437 }
4438 goto IL_0568;
4439 }
4440 _curPos += 3;
4441 return Token.CondSectionEnd;
4442 }
4443
4450
4457
4459 {
4460 await ScanNmtokenAsync().ConfigureAwait(continueOnCapturedContext: false);
4462 return Token.Nmtoken;
4463 }
4464
4466 {
4467 switch (_chars[_curPos])
4468 {
4469 case 'P':
4470 if (!(await EatPublicKeywordAsync().ConfigureAwait(continueOnCapturedContext: false)))
4471 {
4473 }
4476 return Token.PUBLIC;
4477 case 'S':
4478 if (!(await EatSystemKeywordAsync().ConfigureAwait(continueOnCapturedContext: false)))
4479 {
4481 }
4484 return Token.SYSTEM;
4485 case '[':
4486 _curPos++;
4487 _scanningFunction = ScanningFunction.SubsetContent;
4488 return Token.LeftBracket;
4489 case '>':
4490 _curPos++;
4491 _scanningFunction = ScanningFunction.SubsetContent;
4492 return Token.GreaterThan;
4493 default:
4495 return Token.None;
4496 }
4497 }
4498
4500 {
4501 while (true)
4502 {
4503 char c = _chars[_curPos];
4504 if (c != '(')
4505 {
4506 if (c != 'A')
4507 {
4508 if (c == 'E')
4509 {
4510 if (_charsUsed - _curPos < 5)
4511 {
4512 goto IL_0141;
4513 }
4514 if (_chars[_curPos + 1] == 'M' && _chars[_curPos + 2] == 'P' && _chars[_curPos + 3] == 'T' && _chars[_curPos + 4] == 'Y')
4515 {
4516 _curPos += 5;
4518 return Token.EMPTY;
4519 }
4520 }
4521 }
4522 else
4523 {
4524 if (_charsUsed - _curPos < 3)
4525 {
4526 goto IL_0141;
4527 }
4528 if (_chars[_curPos + 1] == 'N' && _chars[_curPos + 2] == 'Y')
4529 {
4530 break;
4531 }
4532 }
4534 goto IL_0141;
4535 }
4537 _curPos++;
4538 return Token.LeftParen;
4539 IL_0141:
4540 if (await ReadDataAsync().ConfigureAwait(continueOnCapturedContext: false) == 0)
4541 {
4543 }
4544 }
4545 _curPos += 3;
4547 return Token.ANY;
4548 }
4549
4551 {
4552 if (_chars[_curPos] == '#')
4553 {
4554 while (_charsUsed - _curPos < 7)
4555 {
4556 if (await ReadDataAsync().ConfigureAwait(continueOnCapturedContext: false) == 0)
4557 {
4559 }
4560 }
4561 if (_chars[_curPos + 1] == 'P' && _chars[_curPos + 2] == 'C' && _chars[_curPos + 3] == 'D' && _chars[_curPos + 4] == 'A' && _chars[_curPos + 5] == 'T' && _chars[_curPos + 6] == 'A')
4562 {
4563 _curPos += 7;
4565 return Token.PCDATA;
4566 }
4568 }
4570 return Token.None;
4571 }
4572
4574 {
4575 switch (_chars[_curPos])
4576 {
4577 case '(':
4578 _curPos++;
4579 return Token.LeftParen;
4580 case '>':
4581 _curPos++;
4582 _scanningFunction = ScanningFunction.SubsetContent;
4583 return Token.GreaterThan;
4584 default:
4587 return Token.QName;
4588 }
4589 }
4590
4592 {
4593 char c = _chars[_curPos];
4594 if (c == '>')
4595 {
4596 _curPos++;
4597 _scanningFunction = ScanningFunction.SubsetContent;
4598 return Token.GreaterThan;
4599 }
4600 if (!_whitespaceSeen)
4601 {
4603 }
4606 return Token.QName;
4607 }
4608
4610 {
4611 while (true)
4612 {
4613 switch (_chars[_curPos])
4614 {
4615 case '(':
4616 _curPos++;
4619 return Token.LeftParen;
4620 case 'C':
4621 if (_charsUsed - _curPos >= 5)
4622 {
4623 if (_chars[_curPos + 1] != 'D' || _chars[_curPos + 2] != 'A' || _chars[_curPos + 3] != 'T' || _chars[_curPos + 4] != 'A')
4624 {
4626 }
4627 _curPos += 5;
4629 return Token.CDATA;
4630 }
4631 break;
4632 case 'E':
4633 if (_charsUsed - _curPos < 9)
4634 {
4635 break;
4636 }
4638 if (_chars[_curPos + 1] != 'N' || _chars[_curPos + 2] != 'T' || _chars[_curPos + 3] != 'I' || _chars[_curPos + 4] != 'T')
4639 {
4641 }
4642 switch (_chars[_curPos + 5])
4643 {
4644 case 'I':
4645 if (_chars[_curPos + 6] != 'E' || _chars[_curPos + 7] != 'S')
4646 {
4648 }
4649 _curPos += 8;
4650 return Token.ENTITIES;
4651 case 'Y':
4652 _curPos += 6;
4653 return Token.ENTITY;
4654 }
4656 break;
4657 case 'I':
4658 if (_charsUsed - _curPos >= 6)
4659 {
4661 if (_chars[_curPos + 1] != 'D')
4662 {
4664 }
4665 if (_chars[_curPos + 2] != 'R')
4666 {
4667 _curPos += 2;
4668 return Token.ID;
4669 }
4670 if (_chars[_curPos + 3] != 'E' || _chars[_curPos + 4] != 'F')
4671 {
4673 }
4674 if (_chars[_curPos + 5] != 'S')
4675 {
4676 _curPos += 5;
4677 return Token.IDREF;
4678 }
4679 _curPos += 6;
4680 return Token.IDREFS;
4681 }
4682 break;
4683 case 'N':
4684 if (_charsUsed - _curPos < 8 && !_readerAdapter.IsEof)
4685 {
4686 break;
4687 }
4688 switch (_chars[_curPos + 1])
4689 {
4690 case 'O':
4691 if (_chars[_curPos + 2] != 'T' || _chars[_curPos + 3] != 'A' || _chars[_curPos + 4] != 'T' || _chars[_curPos + 5] != 'I' || _chars[_curPos + 6] != 'O' || _chars[_curPos + 7] != 'N')
4692 {
4694 }
4695 _curPos += 8;
4697 return Token.NOTATION;
4698 case 'M':
4699 if (_chars[_curPos + 2] != 'T' || _chars[_curPos + 3] != 'O' || _chars[_curPos + 4] != 'K' || _chars[_curPos + 5] != 'E' || _chars[_curPos + 6] != 'N')
4700 {
4702 }
4704 if (_chars[_curPos + 7] == 'S')
4705 {
4706 _curPos += 8;
4707 return Token.NMTOKENS;
4708 }
4709 _curPos += 7;
4710 return Token.NMTOKEN;
4711 }
4713 break;
4714 default:
4716 break;
4717 }
4718 if (await ReadDataAsync().ConfigureAwait(continueOnCapturedContext: false) == 0)
4719 {
4721 }
4722 }
4723 }
4724
4726 {
4727 while (true)
4728 {
4729 switch (_chars[_curPos])
4730 {
4731 case '"':
4732 case '\'':
4733 await ScanLiteralAsync(LiteralType.AttributeValue).ConfigureAwait(continueOnCapturedContext: false);
4735 return Token.Literal;
4736 case '#':
4737 if (_charsUsed - _curPos < 6)
4738 {
4739 break;
4740 }
4741 switch (_chars[_curPos + 1])
4742 {
4743 case 'R':
4744 if (_charsUsed - _curPos >= 9)
4745 {
4746 if (_chars[_curPos + 2] != 'E' || _chars[_curPos + 3] != 'Q' || _chars[_curPos + 4] != 'U' || _chars[_curPos + 5] != 'I' || _chars[_curPos + 6] != 'R' || _chars[_curPos + 7] != 'E' || _chars[_curPos + 8] != 'D')
4747 {
4749 }
4750 _curPos += 9;
4752 return Token.REQUIRED;
4753 }
4754 break;
4755 case 'I':
4756 if (_charsUsed - _curPos >= 8)
4757 {
4758 if (_chars[_curPos + 2] != 'M' || _chars[_curPos + 3] != 'P' || _chars[_curPos + 4] != 'L' || _chars[_curPos + 5] != 'I' || _chars[_curPos + 6] != 'E' || _chars[_curPos + 7] != 'D')
4759 {
4761 }
4762 _curPos += 8;
4764 return Token.IMPLIED;
4765 }
4766 break;
4767 case 'F':
4768 if (_chars[_curPos + 2] != 'I' || _chars[_curPos + 3] != 'X' || _chars[_curPos + 4] != 'E' || _chars[_curPos + 5] != 'D')
4769 {
4771 }
4772 _curPos += 6;
4774 return Token.FIXED;
4775 default:
4777 break;
4778 }
4779 break;
4780 default:
4782 break;
4783 }
4784 if (await ReadDataAsync().ConfigureAwait(continueOnCapturedContext: false) == 0)
4785 {
4787 }
4788 }
4789 }
4790
4792 {
4793 char quoteChar = _chars[_curPos];
4794 char replaceChar = ((literalType == LiteralType.AttributeValue) ? ' ' : '\n');
4797 _curPos++;
4800 while (true)
4801 {
4803 {
4804 _curPos++;
4805 continue;
4806 }
4807 if (_chars[_curPos] == quoteChar && _currentEntityId == startQuoteEntityId)
4808 {
4809 break;
4810 }
4811 int num = _curPos - _tokenStartPos;
4812 if (num > 0)
4813 {
4816 }
4817 switch (_chars[_curPos])
4818 {
4819 case '"':
4820 case '\'':
4821 case '>':
4822 _curPos++;
4823 continue;
4824 case '\n':
4825 _curPos++;
4826 if (Normalize)
4827 {
4830 }
4832 continue;
4833 case '\r':
4834 if (_chars[_curPos + 1] == '\n')
4835 {
4836 if (Normalize)
4837 {
4838 if (literalType == LiteralType.AttributeValue)
4839 {
4841 }
4842 else
4843 {
4845 }
4846 _tokenStartPos = _curPos + 2;
4849 }
4850 _curPos += 2;
4851 }
4852 else
4853 {
4854 if (_curPos + 1 == _charsUsed)
4855 {
4856 break;
4857 }
4858 _curPos++;
4859 if (Normalize)
4860 {
4863 }
4864 }
4866 continue;
4867 case '\t':
4868 if (literalType == LiteralType.AttributeValue && Normalize)
4869 {
4872 }
4873 _curPos++;
4874 continue;
4875 case '<':
4876 if (literalType == LiteralType.AttributeValue)
4877 {
4879 }
4880 _curPos++;
4881 continue;
4882 case '%':
4883 if (literalType != LiteralType.EntityReplText)
4884 {
4885 _curPos++;
4886 continue;
4887 }
4888 await HandleEntityReferenceAsync(paramEntity: true, inLiteral: true, literalType == LiteralType.AttributeValue).ConfigureAwait(continueOnCapturedContext: false);
4890 continue;
4891 case '&':
4892 {
4893 if (literalType == LiteralType.SystemOrPublicID)
4894 {
4895 _curPos++;
4896 continue;
4897 }
4898 if (_curPos + 1 == _charsUsed)
4899 {
4900 break;
4901 }
4902 if (_chars[_curPos + 1] == '#')
4903 {
4910 _curPos = num2;
4911 continue;
4912 }
4914 if (literalType == LiteralType.AttributeValue)
4915 {
4918 if (num3 >= 0)
4919 {
4923 _curPos = num3;
4924 }
4925 else
4926 {
4929 }
4930 continue;
4931 }
4932 int num4 = await _readerAdapter.ParseNamedCharRefAsync(expand: false, null).ConfigureAwait(continueOnCapturedContext: false);
4934 if (num4 >= 0)
4935 {
4937 _curPos = num4;
4938 continue;
4939 }
4941 _curPos++;
4945 continue;
4946 }
4947 default:
4948 {
4949 if (_curPos == _charsUsed)
4950 {
4951 break;
4952 }
4953 char ch = _chars[_curPos];
4955 {
4956 if (_curPos + 1 == _charsUsed)
4957 {
4958 break;
4959 }
4960 _curPos++;
4962 {
4963 _curPos++;
4964 continue;
4965 }
4966 }
4968 return Token.None;
4969 }
4970 }
4971 bool isEof = _readerAdapter.IsEof;
4972 bool flag = isEof;
4973 if (!flag)
4974 {
4975 flag = await ReadDataAsync().ConfigureAwait(continueOnCapturedContext: false) == 0;
4976 }
4977 if (flag && (literalType == LiteralType.SystemOrPublicID || !HandleEntityEnd(inLiteral: true)))
4978 {
4980 }
4982 }
4983 if (_stringBuilder.Length > 0)
4984 {
4986 }
4987 _curPos++;
4988 _literalQuoteChar = quoteChar;
4989 return Token.Literal;
4990 }
4991
4993 {
4994 switch (_chars[_curPos])
4995 {
4996 case 'P':
4997 if (!(await EatPublicKeywordAsync().ConfigureAwait(continueOnCapturedContext: false)))
4998 {
5000 }
5003 return Token.PUBLIC;
5004 case 'S':
5005 if (!(await EatSystemKeywordAsync().ConfigureAwait(continueOnCapturedContext: false)))
5006 {
5008 }
5011 return Token.SYSTEM;
5012 default:
5014 return Token.None;
5015 }
5016 }
5017
5019 {
5020 if (_chars[_curPos] != '"' && _chars[_curPos] != '\'')
5021 {
5022 ThrowUnexpectedToken(_curPos, "\"", "'");
5023 }
5024 await ScanLiteralAsync(LiteralType.SystemOrPublicID).ConfigureAwait(continueOnCapturedContext: false);
5026 return Token.Literal;
5027 }
5028
5030 {
5031 if (_chars[_curPos] == '%')
5032 {
5033 _curPos++;
5036 return Token.Percent;
5037 }
5040 return Token.Name;
5041 }
5042
5044 {
5045 switch (_chars[_curPos])
5046 {
5047 case 'P':
5048 if (!(await EatPublicKeywordAsync().ConfigureAwait(continueOnCapturedContext: false)))
5049 {
5051 }
5054 return Token.PUBLIC;
5055 case 'S':
5056 if (!(await EatSystemKeywordAsync().ConfigureAwait(continueOnCapturedContext: false)))
5057 {
5059 }
5062 return Token.SYSTEM;
5063 case '"':
5064 case '\'':
5065 await ScanLiteralAsync(LiteralType.EntityReplText).ConfigureAwait(continueOnCapturedContext: false);
5067 return Token.Literal;
5068 default:
5070 return Token.None;
5071 }
5072 }
5073
5075 {
5076 if (_chars[_curPos] == 'N')
5077 {
5078 do
5079 {
5080 if (_charsUsed - _curPos >= 5)
5081 {
5082 if (_chars[_curPos + 1] != 'D' || _chars[_curPos + 2] != 'A' || _chars[_curPos + 3] != 'T' || _chars[_curPos + 4] != 'A')
5083 {
5084 break;
5085 }
5086 _curPos += 5;
5089 return Token.NData;
5090 }
5091 }
5092 while (await ReadDataAsync().ConfigureAwait(continueOnCapturedContext: false) != 0);
5093 }
5095 return Token.None;
5096 }
5097
5099 {
5100 if (_chars[_curPos] != '"' && _chars[_curPos] != '\'')
5101 {
5102 ThrowUnexpectedToken(_curPos, "\"", "'");
5103 }
5104 await ScanLiteralAsync(LiteralType.SystemOrPublicID).ConfigureAwait(continueOnCapturedContext: false);
5106 return Token.Literal;
5107 }
5108
5110 {
5111 if (_chars[_curPos] != '"' && _chars[_curPos] != '\'')
5112 {
5114 return Token.None;
5115 }
5116 await ScanLiteralAsync(LiteralType.SystemOrPublicID).ConfigureAwait(continueOnCapturedContext: false);
5118 return Token.Literal;
5119 }
5120
5122 {
5123 if (_chars[_curPos] != 'I')
5124 {
5126 }
5127 _curPos++;
5128 while (true)
5129 {
5130 if (_charsUsed - _curPos >= 5)
5131 {
5132 char c = _chars[_curPos];
5133 if (c == 'G')
5134 {
5135 if (_chars[_curPos + 1] != 'N' || _chars[_curPos + 2] != 'O' || _chars[_curPos + 3] != 'R' || _chars[_curPos + 4] != 'E' || XmlCharType.IsNameSingleChar(_chars[_curPos + 5]))
5136 {
5137 break;
5138 }
5140 _scanningFunction = ScanningFunction.CondSection2;
5141 _curPos += 5;
5142 return Token.IGNORE;
5143 }
5144 if (c != 'N')
5145 {
5146 break;
5147 }
5148 if (_charsUsed - _curPos >= 6)
5149 {
5150 if (_chars[_curPos + 1] != 'C' || _chars[_curPos + 2] != 'L' || _chars[_curPos + 3] != 'U' || _chars[_curPos + 4] != 'D' || _chars[_curPos + 5] != 'E' || XmlCharType.IsNameSingleChar(_chars[_curPos + 6]))
5151 {
5152 break;
5153 }
5154 _nextScaningFunction = ScanningFunction.SubsetContent;
5155 _scanningFunction = ScanningFunction.CondSection2;
5156 _curPos += 6;
5157 return Token.INCLUDE;
5158 }
5159 }
5160 if (await ReadDataAsync().ConfigureAwait(continueOnCapturedContext: false) == 0)
5161 {
5163 }
5164 }
5166 return Token.None;
5167 }
5168
5170 {
5171 int ignoreSectionDepth = 0;
5172 while (true)
5173 {
5175 {
5176 _curPos++;
5177 continue;
5178 }
5179 switch (_chars[_curPos])
5180 {
5181 case '\t':
5182 case '"':
5183 case '&':
5184 case '\'':
5185 _curPos++;
5186 continue;
5187 case '\n':
5188 _curPos++;
5190 continue;
5191 case '\r':
5192 if (_chars[_curPos + 1] == '\n')
5193 {
5194 _curPos += 2;
5195 }
5196 else
5197 {
5198 if (_curPos + 1 >= _charsUsed && !_readerAdapter.IsEof)
5199 {
5200 break;
5201 }
5202 _curPos++;
5203 }
5205 continue;
5206 case '<':
5207 if (_charsUsed - _curPos >= 3)
5208 {
5209 if (_chars[_curPos + 1] != '!' || _chars[_curPos + 2] != '[')
5210 {
5211 _curPos++;
5212 continue;
5213 }
5215 _curPos += 3;
5216 continue;
5217 }
5218 break;
5219 case ']':
5220 if (_charsUsed - _curPos < 3)
5221 {
5222 break;
5223 }
5224 if (_chars[_curPos + 1] != ']' || _chars[_curPos + 2] != '>')
5225 {
5226 _curPos++;
5227 continue;
5228 }
5229 if (ignoreSectionDepth > 0)
5230 {
5232 _curPos += 3;
5233 continue;
5234 }
5235 _curPos += 3;
5236 _scanningFunction = ScanningFunction.SubsetContent;
5237 return Token.CondSectionEnd;
5238 default:
5239 {
5240 if (_curPos == _charsUsed)
5241 {
5242 break;
5243 }
5244 char ch = _chars[_curPos];
5246 {
5247 if (_curPos + 1 == _charsUsed)
5248 {
5249 break;
5250 }
5251 _curPos++;
5253 {
5254 _curPos++;
5255 continue;
5256 }
5257 }
5259 return Token.None;
5260 }
5261 }
5262 bool isEof = _readerAdapter.IsEof;
5263 bool flag = isEof;
5264 if (!flag)
5265 {
5266 flag = await ReadDataAsync().ConfigureAwait(continueOnCapturedContext: false) == 0;
5267 }
5268 if (flag)
5269 {
5270 if (HandleEntityEnd(inLiteral: false))
5271 {
5272 continue;
5273 }
5275 }
5277 }
5278 }
5279
5281 {
5282 return ScanQNameAsync(isQName: false);
5283 }
5284
5286 {
5288 }
5289
5291 {
5293 int colonOffset = -1;
5294 while (true)
5295 {
5297 {
5298 _curPos++;
5299 }
5300 else if (_curPos + 1 >= _charsUsed)
5301 {
5302 if (await ReadDataInNameAsync().ConfigureAwait(continueOnCapturedContext: false))
5303 {
5304 continue;
5305 }
5307 }
5308 else
5309 {
5311 }
5312 while (true)
5313 {
5315 {
5316 _curPos++;
5317 continue;
5318 }
5319 if (_chars[_curPos] == ':')
5320 {
5321 if (isQName)
5322 {
5323 break;
5324 }
5325 _curPos++;
5326 continue;
5327 }
5328 if (_curPos == _charsUsed)
5329 {
5330 if (await ReadDataInNameAsync().ConfigureAwait(continueOnCapturedContext: false))
5331 {
5332 continue;
5333 }
5334 if (_tokenStartPos == _curPos)
5335 {
5337 }
5338 }
5339 _colonPos = ((colonOffset == -1) ? (-1) : (_tokenStartPos + colonOffset));
5340 return;
5341 }
5342 if (colonOffset != -1)
5343 {
5345 }
5347 _curPos++;
5348 }
5349 }
5350
5352 {
5355 bool result = await ReadDataAsync().ConfigureAwait(continueOnCapturedContext: false) != 0;
5357 _curPos += offset;
5358 return result;
5359 }
5360
5362 {
5364 int len;
5365 while (true)
5366 {
5368 {
5369 _curPos++;
5370 continue;
5371 }
5372 if (_curPos < _charsUsed)
5373 {
5374 if (_curPos - _tokenStartPos == 0)
5375 {
5377 }
5378 return;
5379 }
5382 if (await ReadDataAsync().ConfigureAwait(continueOnCapturedContext: false) == 0)
5383 {
5384 if (len > 0)
5385 {
5386 break;
5387 }
5389 }
5391 _curPos += len;
5392 }
5394 _curPos += len;
5395 }
5396
5398 {
5399 while (_charsUsed - _curPos < 6)
5400 {
5401 if (await ReadDataAsync().ConfigureAwait(continueOnCapturedContext: false) == 0)
5402 {
5403 return false;
5404 }
5405 }
5406 if (_chars[_curPos + 1] != 'U' || _chars[_curPos + 2] != 'B' || _chars[_curPos + 3] != 'L' || _chars[_curPos + 4] != 'I' || _chars[_curPos + 5] != 'C')
5407 {
5408 return false;
5409 }
5410 _curPos += 6;
5411 return true;
5412 }
5413
5415 {
5416 while (_charsUsed - _curPos < 6)
5417 {
5418 if (await ReadDataAsync().ConfigureAwait(continueOnCapturedContext: false) == 0)
5419 {
5420 return false;
5421 }
5422 }
5423 if (_chars[_curPos + 1] != 'Y' || _chars[_curPos + 2] != 'S' || _chars[_curPos + 3] != 'T' || _chars[_curPos + 4] != 'E' || _chars[_curPos + 5] != 'M')
5424 {
5425 return false;
5426 }
5427 _curPos += 6;
5428 return true;
5429 }
5430
5432 {
5436 return result;
5437 }
5438
5444
5446 {
5449 {
5451 }
5453 if (schemaEntity == null)
5454 {
5455 return false;
5456 }
5457 if (schemaEntity.ParsingInProgress)
5458 {
5460 }
5461 int currentEntityId;
5462 if (schemaEntity.IsExternal)
5463 {
5465 (currentEntityId, _) = tuple;
5466 if (!tuple.Item2)
5467 {
5468 return false;
5469 }
5471 }
5472 else
5473 {
5474 if (schemaEntity.Text.Length == 0)
5475 {
5476 return false;
5477 }
5480 if (!tuple3.Item2)
5481 {
5482 return false;
5483 }
5484 }
5486 if (paramEntity && !inLiteral && _scanningFunction != ScanningFunction.ParamEntitySpace)
5487 {
5489 _scanningFunction = ScanningFunction.ParamEntitySpace;
5490 }
5492 return true;
5493 }
5494}
static unsafe void Copy(Array sourceArray, Array destinationArray, int length)
Definition Array.cs:624
bool ICollection< TValue >. Contains(TValue item)
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
bool ICollection< KeyValuePair< TKey, TValue > >. Remove(KeyValuePair< TKey, TValue > keyValuePair)
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
void Add(TKey key, TValue value)
static string Xml_BadAttributeChar
Definition SR.cs:74
static string Xml_ExpectIgnoreOrInclude
Definition SR.cs:276
static string Xml_UndeclaredParEntity
Definition SR.cs:214
static string Xml_ExpectDtdMarkup
Definition SR.cs:244
static string Xml_AttlistDuplNotationValue
Definition SR.cs:232
static string Xml_InvalidParEntityRef
Definition SR.cs:268
static string Xml_ExpectSubOrClose
Definition SR.cs:270
static string Sch_NotationAttributeOnEmptyElement
Definition SR.cs:716
static string Xml_UnclosedQuote
Definition SR.cs:34
static string Xml_ExternalEntityInAttValue
Definition SR.cs:126
static string Xml_ExpectNoWhitespace
Definition SR.cs:256
static string Xml_BadStartNameChar
Definition SR.cs:42
static string Xml_ExpectOp
Definition SR.cs:258
static string Xml_EnumerationRequired
Definition SR.cs:248
static string Sch_DupElementDecl
Definition SR.cs:404
static string Xml_UndeclaredEntity
Definition SR.cs:120
static string Xml_InvalidConditionalSection
Definition SR.cs:238
static string Xml_FragmentId
Definition SR.cs:252
static string Xml_IncompleteDtdContent
Definition SR.cs:246
static string Xml_UnexpectedCDataEnd
Definition SR.cs:240
static string Sch_DupNotationAttribute
Definition SR.cs:712
static string Sch_ParEntityRefNesting
Definition SR.cs:392
static string Xml_AttlistDuplEnumValue
Definition SR.cs:230
static string Xml_UnparsedEntityRef
Definition SR.cs:128
static string Xml_RecursiveParEntity
Definition SR.cs:122
static string Xml_ExpectExternalIdOrEntityValue
Definition SR.cs:274
static string Xml_InternalError
Definition SR.cs:54
static string Xml_ColonInLocalName
Definition SR.cs:266
static string Sch_DupElement
Definition SR.cs:480
static string Xml_InvalidAttributeType1
Definition SR.cs:262
static string Xml_UnexpectedTokens2
Definition SR.cs:64
static string Xml_ExpectAttType
Definition SR.cs:264
static string Xml_InvalidCharacter
Definition SR.cs:110
static string Xml_ExpectExternalOrPublicId
Definition SR.cs:272
static string Xml_UnexpectedTokenEx
Definition SR.cs:62
static string Xml_InvalidContentModel
Definition SR.cs:250
static string Sch_AttListPresence
Definition SR.cs:564
static string Xml_InvalidAttributeType
Definition SR.cs:260
static string Xml_ExpectingWhiteSpace
Definition SR.cs:66
static string Xml_ErrorParsingEntityName
Definition SR.cs:136
static string Xml_BadNameChar
Definition SR.cs:44
static string Sch_IdAttrDeclared
Definition SR.cs:406
static string Xml_UnexpectedEOF
Definition SR.cs:36
static string Xml_ExpectPcData
Definition SR.cs:254
static string Xml_RecursiveGenEntity
Definition SR.cs:124
static string Xml_UnclosedConditionalSection
Definition SR.cs:242
static string Sch_UndeclaredNotation
Definition SR.cs:416
static string Xml_ExpectExternalOrClose
Definition SR.cs:76
static string Sch_DupNotation
Definition SR.cs:534
Definition SR.cs:7
override string ToString()
StringBuilder Append(char value, int repeatCount)
new ConfiguredTaskAwaitable< TResult > ConfigureAwait(bool continueOnCapturedContext)
Definition Task.cs:226
override string ToString()
Definition Uri.cs:1119
ParseElementOnlyContent_LocalFrame(int startParentEntityIdParam)
Definition DtdParser.cs:133
UndeclaredNotation(string name, int lineNo, int linePos)
Definition DtdParser.cs:118
async Task ParseNotationDeclAsync()
Token ScanLiteral(LiteralType literalType)
async Task< Token > ScanCondSection3Async()
void ThrowUnexpectedToken(int pos, string expectedToken1, string expectedToken2)
async Task< Token > ScanAttlist1Async()
void ParseHowMany(ParticleContentValidator pcv)
Definition DtdParser.cs:931
async Task< Token > ScanEntity2Async()
void ParseInDocumentDtd(bool saveInternalSubset)
Definition DtdParser.cs:378
ScanningFunction _nextScaningFunction
Definition DtdParser.cs:168
async Task< Token > ScanEntity3Async()
async Task< int > ReadDataAsync()
void ParseAttlistDefault(SchemaAttDef attrDef, bool ignoreErrors)
Definition DtdParser.cs:734
static IDtdParser Create()
Definition DtdParser.cs:261
async Task ParseAttlistTypeAsync(SchemaAttDef attrDef, SchemaElementDecl elementDecl, bool ignoreErrors)
void Parse(bool saveInternalSubset)
Definition DtdParser.cs:354
async Task< Token > ScanElement2Async()
void SendValidationEvent(int pos, XmlSeverityType severity, string code, string arg)
async Task ParseElementDeclAsync()
async Task< bool > EatSystemKeywordAsync()
async Task ParseElementOnlyContentAsync(ParticleContentValidator pcv, int startParenEntityId)
async Task ScanQNameAsync(bool isQName)
void AddUndeclaredNotation(string notationName)
Dictionary< string, UndeclaredNotation > _undeclaredNotations
Definition DtdParser.cs:200
static string StripSpaces(string value)
async Task ParsePIAsync()
async Task ParseHowManyAsync(ParticleContentValidator pcv)
async Task< Token > ScanSystemIdAsync()
Token ScanNmtokenExpected()
void ParseElementMixedContent(ParticleContentValidator pcv, int startParenEntityId)
Definition DtdParser.cs:947
async Task< bool > EatPublicKeywordAsync()
async Task ParseSubsetAsync()
void ScanQName(bool isQName)
async Task< Token > ScanElement1Async()
async Task< Token > ScanElement3Async()
async Task ParseAttlistDeclAsync()
async Task< Token > ScanQNameExpectedAsync()
void Throw(int curPos, string res)
bool IsAttributeValueType(Token token)
async Task< Token > ScanNotation1Async()
async Task< bool > HandleEntityReferenceAsync(XmlQualifiedName entityName, bool paramEntity, bool inLiteral, bool inAttribute)
async Task< Token > ScanCondSection1Async()
XmlQualifiedName GetNameQualified(bool canHavePrefix)
async Task ParseCommentAsync()
bool HandleEntityReference(XmlQualifiedName entityName, bool paramEntity, bool inLiteral, bool inAttribute)
async Task< Token > ScanPublicId1Async()
void Throw(string res, string arg, int lineNo, int linePos)
XmlQualifiedName ScanEntityName()
async Task ParseElementMixedContentAsync(ParticleContentValidator pcv, int startParenEntityId)
bool HandleEntityEnd(bool inLiteral)
Task ParseInternalSubsetAsync()
async Task< bool > ReadDataInNameAsync()
LineInfo _literalLineInfo
Definition DtdParser.cs:192
void Throw(int curPos, string res, string arg)
Token GetToken(bool needWhiteSpace)
void ParseFreeFloatingDtd()
Definition DtdParser.cs:417
async Task< Token > ScanDoctype1Async()
void InitializeFreeFloatingDtd(string baseUri, string docTypeName, string publicId, string systemId, string internalSubset, IDtdParserAdapter adapter)
Definition DtdParser.cs:292
async Task ParseCondSectionAsync()
void SaveParsingBuffer(int internalSubsetValueEndPos)
void ThrowUnexpectedToken(int pos, string expectedToken)
void Initialize(IDtdParserAdapter readerAdapter)
Definition DtdParser.cs:266
ScanningFunction _savedScanningFunction
Definition DtdParser.cs:170
async Task< Token > ScanAttlist2Async()
async Task< Token > ScanAttlist6Async()
IDtdParserAdapterWithValidation _readerAdapterWithValidation
Definition DtdParser.cs:142
SchemaEntity VerifyEntityReference(XmlQualifiedName entityName, bool paramEntity, bool mustBeDeclared, bool inAttribute)
async Task< Token > ScanLiteralAsync(LiteralType literalType)
async Task ParseAttlistDefaultAsync(SchemaAttDef attrDef, bool ignoreErrors)
void ParseElementOnlyContent(ParticleContentValidator pcv, int startParenEntityId)
Definition DtdParser.cs:851
IDtdParserAdapter _readerAdapter
Definition DtdParser.cs:140
async Task ParseAsync(bool saveInternalSubset)
StringBuilder _internalSubsetValueSb
Definition DtdParser.cs:178
string ParseUnexpectedToken(int startPos)
async Task< Token > ScanEntity1Async()
string GetValueWithStrippedSpaces()
Task< bool > HandleEntityReferenceAsync(bool paramEntity, bool inLiteral, bool inAttribute)
void ThrowInvalidChar(char[] data, int length, int invCharPos)
async Task< Token > ScanNameExpectedAsync()
XmlNameTable _nameTable
Definition DtdParser.cs:144
async Task<(string, string)> ParseExternalIdAsync(Token idTokenType, Token declType)
void ParseExternalId(Token idTokenType, Token declType, out string publicId, out string systemId)
async Task< Token > ScanPublicId2Async()
void SendValidationEvent(XmlSeverityType severity, XmlSchemaException e)
bool HandleEntityReference(bool paramEntity, bool inLiteral, bool inAttribute)
async Task ScanNmtokenAsync()
SchemaInfo _schemaInfo
Definition DtdParser.cs:146
ScanningFunction _scanningFunction
Definition DtdParser.cs:166
async Task ParseFreeFloatingDtdAsync()
bool _hasFreeFloatingInternalSubset
Definition DtdParser.cs:186
string GetNmtokenString()
async Task ParseInDocumentDtdAsync(bool saveInternalSubset)
async Task< Token > GetTokenAsync(bool needWhiteSpace)
async Task< Token > ScanNmtokenExpectedAsync()
async Task ParseEntityDeclAsync()
void ThrowInvalidChar(int pos, string data, int invCharPos)
void SendValidationEvent(XmlSeverityType severity, string code, string arg)
StringBuilder _stringBuilder
Definition DtdParser.cs:188
async Task ParseExternalSubsetAsync()
void ParseAttlistType(SchemaAttDef attrDef, SchemaElementDecl elementDecl, bool ignoreErrors)
Definition DtdParser.cs:629
async Task< Token > ScanSubsetContentAsync()
void Throw(int curPos, string res, string[] args)
static readonly ContentValidator Empty
static readonly ContentValidator Any
static void SetDefaultTypedValue(SchemaAttDef attdef, IDtdParserAdapter readerAdapter)
Dictionary< XmlQualifiedName, SchemaEntity > GeneralEntities
Definition SchemaInfo.cs:60
Dictionary< string, SchemaNotation > Notations
Dictionary< XmlQualifiedName, SchemaEntity > ParameterEntities
Definition SchemaInfo.cs:72
Dictionary< XmlQualifiedName, SchemaElementDecl > ElementDecls
Definition SchemaInfo.cs:55
Dictionary< XmlQualifiedName, SchemaElementDecl > UndeclaredElementDecls
Definition SchemaInfo.cs:57
static ? XmlSchemaSimpleType GetBuiltInSimpleType(XmlQualifiedName qualifiedName)
static bool IsStartNCNameSingleChar(char ch)
static bool IsAttributeValueChar(char ch)
static int IsOnlyCharData(string str)
static bool IsNCNameSingleChar(char ch)
static bool IsWhiteSpace(char ch)
static bool IsTextChar(char ch)
static bool IsLowSurrogate(int ch)
static bool IsNameSingleChar(char ch)
static bool IsHighSurrogate(int ch)
static int IsPublicId(string str)
static ArgumentException CreateInvalidNameArgumentException(string name, string argumentName)
static string VerifyName(string name)
static string[] BuildCharExceptionArgs(string data, int invCharIndex)
string Add(char[] array, int offset, int length)
bool PushExternalSubset(string systemId, string publicId)
void ParsePI(StringBuilder sb)
Task ParsePIAsync(StringBuilder sb)
Task< int > ParseNumericCharRefAsync(StringBuilder internalSubsetBuilder)
Task< int > ParseNamedCharRefAsync(bool expand, StringBuilder internalSubsetBuilder)
void OnSystemId(string systemId, LineInfo keywordLineInfo, LineInfo systemLiteralLineInfo)
bool PopEntity(out IDtdEntityInfo oldEntity, out int newEntityId)
Task ParseCommentAsync(StringBuilder sb)
void OnPublicId(string publicId, LineInfo keywordLineInfo, LineInfo publicLiteralLineInfo)
void PushInternalDtd(string baseUri, string internalDtd)
Task<(int, bool)> PushEntityAsync(IDtdEntityInfo entity)
void Throw(Exception e)
Task< bool > PushExternalSubsetAsync(string systemId, string publicId)
int ParseNamedCharRef(bool expand, StringBuilder internalSubsetBuilder)
void ParseComment(StringBuilder sb)
bool PushEntity(IDtdEntityInfo entity, out int entityId)
int ParseNumericCharRef(StringBuilder internalSubsetBuilder)
IDtdInfo ParseInternalDtd(IDtdParserAdapter adapter, bool saveInternalSubset)
Task< IDtdInfo > ParseInternalDtdAsync(IDtdParserAdapter adapter, bool saveInternalSubset)
IDtdInfo ParseFreeFloatingDtd(string baseUri, string docTypeName, string publicId, string systemId, string internalSubset, IDtdParserAdapter adapter)
Task< IDtdInfo > ParseFreeFloatingDtdAsync(string baseUri, string docTypeName, string publicId, string systemId, string internalSubset, IDtdParserAdapter adapter)
void SendEvent(Exception exception, XmlSeverityType severity)
void Set(int lineNo, int linePos)
Definition LineInfo.cs:15