当前位置: 首页>>代码示例>>C#>>正文


C# ScanningFunction类代码示例

本文整理汇总了C#中ScanningFunction的典型用法代码示例。如果您正苦于以下问题:C# ScanningFunction类的具体用法?C# ScanningFunction怎么用?C# ScanningFunction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ScanningFunction类属于命名空间,在下文中一共展示了ScanningFunction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ScanCondSection3

        private Token ScanCondSection3()
        {
            int ignoreSectionDepth = 0;

            // skip ignored part
            for (;;)
            {
                while (_xmlCharType.IsTextChar(_chars[_curPos]) && _chars[_curPos] != ']')
                {
                    _curPos++;
                }

                switch (_chars[_curPos])
                {
                    case '"':
                    case '\'':
                    case (char)0x9:
                    case '&':
                        _curPos++;
                        continue;
                    // eol
                    case (char)0xA:
                        _curPos++;
                        _readerAdapter.OnNewLine(_curPos);
                        continue;
                    case (char)0xD:
                        if (_chars[_curPos + 1] == (char)0xA)
                        {
                            _curPos += 2;
                        }
                        else if (_curPos + 1 < _charsUsed || _readerAdapter.IsEof)
                        {
                            _curPos++;
                        }
                        else
                        {
                            goto ReadData;
                        }
                        _readerAdapter.OnNewLine(_curPos);
                        continue;
                    case '<':
                        if (_charsUsed - _curPos < 3)
                        {
                            goto ReadData;
                        }
                        if (_chars[_curPos + 1] != '!' || _chars[_curPos + 2] != '[')
                        {
                            _curPos++;
                            continue;
                        }
                        ignoreSectionDepth++;
                        _curPos += 3;
                        continue;
                    case ']':
                        if (_charsUsed - _curPos < 3)
                        {
                            goto ReadData;
                        }
                        if (_chars[_curPos + 1] != ']' || _chars[_curPos + 2] != '>')
                        {
                            _curPos++;
                            continue;
                        }
                        if (ignoreSectionDepth > 0)
                        {
                            ignoreSectionDepth--;
                            _curPos += 3;
                            continue;
                        }
                        else
                        {
                            _curPos += 3;
                            _scanningFunction = ScanningFunction.SubsetContent;
                            return Token.CondSectionEnd;
                        }
                    default:
                        // end of buffer
                        if (_curPos == _charsUsed)
                        {
                            goto ReadData;
                        }
                        // surrogate chars
                        else
                        {
                            char ch = _chars[_curPos];
                            if (XmlCharType.IsHighSurrogate(ch))
                            {
                                if (_curPos + 1 == _charsUsed)
                                {
                                    goto ReadData;
                                }
                                _curPos++;
                                if (XmlCharType.IsLowSurrogate(_chars[_curPos]))
                                {
                                    _curPos++;
                                    continue;
                                }
                            }
                            ThrowInvalidChar(_chars, _charsUsed, _curPos);
                            return Token.None;
//.........这里部分代码省略.........
开发者ID:chcosta,项目名称:corefx,代码行数:101,代码来源:DtdParser.cs

示例2: HandleEntityEnd

        private bool HandleEntityEnd(bool inLiteral)
        {
            SaveParsingBuffer();

            IDtdEntityInfo oldEntity;
            if (!_readerAdapter.PopEntity(out oldEntity, out _currentEntityId))
            {
                return false;
            }
            LoadParsingBuffer();

            if (oldEntity == null)
            {
                // external subset popped
                Debug.Assert(!ParsingInternalSubset || _freeFloatingDtd);
                Debug.Assert(_currentEntityId == 0);
                if (_scanningFunction == ScanningFunction.ParamEntitySpace)
                {
                    _scanningFunction = _savedScanningFunction;
                }
                return false;
            }

            if (oldEntity.IsExternal)
            {
                _externalEntitiesDepth--;
            }

            if (!inLiteral && _scanningFunction != ScanningFunction.ParamEntitySpace)
            {
                _savedScanningFunction = _scanningFunction;
                _scanningFunction = ScanningFunction.ParamEntitySpace;
            }

            return true;
        }
开发者ID:chcosta,项目名称:corefx,代码行数:36,代码来源:DtdParser.cs

示例3: ScanPublicId1

        private Token ScanPublicId1()
        {
            if (_chars[_curPos] != '"' && _chars[_curPos] != '\'')
            {
                ThrowUnexpectedToken(_curPos, "\"", "'");
            }

            ScanLiteral(LiteralType.SystemOrPublicID);

            _scanningFunction = ScanningFunction.PublicId2;
            return Token.Literal;
        }
开发者ID:chcosta,项目名称:corefx,代码行数:12,代码来源:DtdParser.cs

示例4: ScanCondSection1

        private Token ScanCondSection1()
        {
            if (_chars[_curPos] != 'I')
            {
                Throw(_curPos, SR.Xml_ExpectIgnoreOrInclude);
            }
            _curPos++;

            for (;;)
            {
                if (_charsUsed - _curPos < 5)
                {
                    goto ReadData;
                }
                switch (_chars[_curPos])
                {
                    case 'N':
                        if (_charsUsed - _curPos < 6)
                        {
                            goto ReadData;
                        }
                        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])
#if XML10_FIFTH_EDITION
                             || xmlCharType.IsNCNameHighSurrogateChar( chars[curPos+6] ) 
#endif
                            )
                        {
                            goto default;
                        }
                        _nextScaningFunction = ScanningFunction.SubsetContent;
                        _scanningFunction = ScanningFunction.CondSection2;
                        _curPos += 6;
                        return Token.INCLUDE;
                    case 'G':
                        if (_chars[_curPos + 1] != 'N' || _chars[_curPos + 2] != 'O' ||
                             _chars[_curPos + 3] != 'R' || _chars[_curPos + 4] != 'E' ||
                             _xmlCharType.IsNameSingleChar(_chars[_curPos + 5])
#if XML10_FIFTH_EDITION
                            ||xmlCharType.IsNCNameHighSurrogateChar( chars[curPos+5] ) 
#endif
                            )
                        {
                            goto default;
                        }
                        _nextScaningFunction = ScanningFunction.CondSection3;
                        _scanningFunction = ScanningFunction.CondSection2;
                        _curPos += 5;
                        return Token.IGNORE;
                    default:
                        Throw(_curPos - 1, SR.Xml_ExpectIgnoreOrInclude);
                        return Token.None;
                }
            ReadData:
                if (ReadData() == 0)
                {
                    Throw(_curPos, SR.Xml_IncompleteDtdContent);
                }
            }
        }
开发者ID:chcosta,项目名称:corefx,代码行数:61,代码来源:DtdParser.cs

示例5: ScanNotation1

 private Token ScanNotation1()
 {
     switch (_chars[_curPos])
     {
         case 'P':
             if (!EatPublicKeyword())
             {
                 Throw(_curPos, SR.Xml_ExpectExternalOrClose);
             }
             _nextScaningFunction = ScanningFunction.ClosingTag;
             _scanningFunction = ScanningFunction.PublicId1;
             return Token.PUBLIC;
         case 'S':
             if (!EatSystemKeyword())
             {
                 Throw(_curPos, SR.Xml_ExpectExternalOrClose);
             }
             _nextScaningFunction = ScanningFunction.ClosingTag;
             _scanningFunction = ScanningFunction.SystemId;
             return Token.SYSTEM;
         default:
             Throw(_curPos, SR.Xml_ExpectExternalOrPublicId);
             return Token.None;
     }
 }
开发者ID:chcosta,项目名称:corefx,代码行数:25,代码来源:DtdParser.cs

示例6: ScanEntity2

        private Token ScanEntity2()
        {
            switch (_chars[_curPos])
            {
                case 'P':
                    if (!EatPublicKeyword())
                    {
                        Throw(_curPos, SR.Xml_ExpectExternalOrClose);
                    }
                    _nextScaningFunction = ScanningFunction.Entity3;
                    _scanningFunction = ScanningFunction.PublicId1;
                    return Token.PUBLIC;
                case 'S':
                    if (!EatSystemKeyword())
                    {
                        Throw(_curPos, SR.Xml_ExpectExternalOrClose);
                    }
                    _nextScaningFunction = ScanningFunction.Entity3;
                    _scanningFunction = ScanningFunction.SystemId;
                    return Token.SYSTEM;

                case '"':
                case '\'':
                    ScanLiteral(LiteralType.EntityReplText);
                    _scanningFunction = ScanningFunction.ClosingTag;
                    return Token.Literal;
                default:
                    Throw(_curPos, SR.Xml_ExpectExternalIdOrEntityValue);
                    return Token.None;
            }
        }
开发者ID:chcosta,项目名称:corefx,代码行数:31,代码来源:DtdParser.cs

示例7: ScanElement3

 private Token ScanElement3()
 {
     switch (_chars[_curPos])
     {
         case '(':
             _curPos++;
             return Token.LeftParen;
         case '>':
             _curPos++;
             _scanningFunction = ScanningFunction.SubsetContent;
             return Token.GreaterThan;
         default:
             ScanQName();
             _scanningFunction = ScanningFunction.Element4;
             return Token.QName;
     }
 }
开发者ID:chcosta,项目名称:corefx,代码行数:17,代码来源:DtdParser.cs

示例8: ScanElement4

        private Token ScanElement4()
        {
            _scanningFunction = ScanningFunction.Element5;

            Token t;
            switch (_chars[_curPos])
            {
                case '*':
                    t = Token.Star;
                    break;
                case '?':
                    t = Token.QMark;
                    break;
                case '+':
                    t = Token.Plus;
                    break;
                default:
                    return Token.None;
            }
            if (_whitespaceSeen)
            {
                Throw(_curPos, SR.Xml_ExpectNoWhitespace);
            }
            _curPos++;
            return t;
        }
开发者ID:chcosta,项目名称:corefx,代码行数:26,代码来源:DtdParser.cs

示例9: ScanElement1

 private Token ScanElement1()
 {
     for (;;)
     {
         switch (_chars[_curPos])
         {
             case '(':
                 _scanningFunction = ScanningFunction.Element2;
                 _curPos++;
                 return Token.LeftParen;
             case 'E':
                 if (_charsUsed - _curPos < 5)
                 {
                     goto ReadData;
                 }
                 if (_chars[_curPos + 1] == 'M' && _chars[_curPos + 2] == 'P' &&
                      _chars[_curPos + 3] == 'T' && _chars[_curPos + 4] == 'Y')
                 {
                     _curPos += 5;
                     _scanningFunction = ScanningFunction.ClosingTag;
                     return Token.EMPTY;
                 }
                 goto default;
             case 'A':
                 if (_charsUsed - _curPos < 3)
                 {
                     goto ReadData;
                 }
                 if (_chars[_curPos + 1] == 'N' && _chars[_curPos + 2] == 'Y')
                 {
                     _curPos += 3;
                     _scanningFunction = ScanningFunction.ClosingTag;
                     return Token.ANY;
                 }
                 goto default;
             default:
                 Throw(_curPos, SR.Xml_InvalidContentModel);
                 break;
         }
     ReadData:
         if (ReadData() == 0)
         {
             Throw(_curPos, SR.Xml_IncompleteDtdContent);
         }
     }
 }
开发者ID:chcosta,项目名称:corefx,代码行数:46,代码来源:DtdParser.cs

示例10: ScanElement2

        private Token ScanElement2()
        {
            if (_chars[_curPos] == '#')
            {
                while (_charsUsed - _curPos < 7)
                {
                    if (ReadData() == 0)
                    {
                        Throw(_curPos, SR.Xml_IncompleteDtdContent);
                    }
                }
                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')
                {
                    _curPos += 7;
                    _scanningFunction = ScanningFunction.Element6;
                    return Token.PCDATA;
                }
                else
                {
                    Throw(_curPos + 1, SR.Xml_ExpectPcData);
                }
            }

            _scanningFunction = ScanningFunction.Element3;
            return Token.None;
        }
开发者ID:chcosta,项目名称:corefx,代码行数:28,代码来源:DtdParser.cs

示例11: ScanClosingTag

 private Token ScanClosingTag()
 {
     if (_chars[_curPos] != '>')
     {
         ThrowUnexpectedToken(_curPos, ">");
     }
     _curPos++;
     _scanningFunction = ScanningFunction.SubsetContent;
     return Token.GreaterThan;
 }
开发者ID:chcosta,项目名称:corefx,代码行数:10,代码来源:DtdParser.cs

示例12: ScanDoctype2

 private Token ScanDoctype2()
 {
     switch (_chars[_curPos])
     {
         case '[':
             _curPos++;
             _scanningFunction = ScanningFunction.SubsetContent;
             return Token.LeftBracket;
         case '>':
             _curPos++;
             _scanningFunction = ScanningFunction.SubsetContent;
             return Token.GreaterThan;
         default:
             Throw(_curPos, SR.Xml_ExpectSubOrClose);
             return Token.None;
     }
 }
开发者ID:chcosta,项目名称:corefx,代码行数:17,代码来源:DtdParser.cs

示例13: ScanDoctype1

 private Token ScanDoctype1()
 {
     switch (_chars[_curPos])
     {
         case 'P':
             if (!EatPublicKeyword())
             {
                 Throw(_curPos, SR.Xml_ExpectExternalOrClose);
             }
             _nextScaningFunction = ScanningFunction.Doctype2;
             _scanningFunction = ScanningFunction.PublicId1;
             return Token.PUBLIC;
         case 'S':
             if (!EatSystemKeyword())
             {
                 Throw(_curPos, SR.Xml_ExpectExternalOrClose);
             }
             _nextScaningFunction = ScanningFunction.Doctype2;
             _scanningFunction = ScanningFunction.SystemId;
             return Token.SYSTEM;
         case '[':
             _curPos++;
             _scanningFunction = ScanningFunction.SubsetContent;
             return Token.LeftBracket;
         case '>':
             _curPos++;
             _scanningFunction = ScanningFunction.SubsetContent;
             return Token.GreaterThan;
         default:
             Throw(_curPos, SR.Xml_ExpectExternalOrClose);
             return Token.None;
     }
 }
开发者ID:chcosta,项目名称:corefx,代码行数:33,代码来源:DtdParser.cs

示例14: ScanAttlist6

 private Token ScanAttlist6()
 {
     for (;;)
     {
         switch (_chars[_curPos])
         {
             case '"':
             case '\'':
                 ScanLiteral(LiteralType.AttributeValue);
                 _scanningFunction = ScanningFunction.Attlist1;
                 return Token.Literal;
             case '#':
                 if (_charsUsed - _curPos < 6)
                     goto ReadData;
                 switch (_chars[_curPos + 1])
                 {
                     case 'R':
                         if (_charsUsed - _curPos < 9)
                             goto ReadData;
                         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')
                         {
                             Throw(_curPos, SR.Xml_ExpectAttType);
                         }
                         _curPos += 9;
                         _scanningFunction = ScanningFunction.Attlist1;
                         return Token.REQUIRED;
                     case 'I':
                         if (_charsUsed - _curPos < 8)
                             goto ReadData;
                         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')
                         {
                             Throw(_curPos, SR.Xml_ExpectAttType);
                         }
                         _curPos += 8;
                         _scanningFunction = ScanningFunction.Attlist1;
                         return Token.IMPLIED;
                     case 'F':
                         if (_chars[_curPos + 2] != 'I' || _chars[_curPos + 3] != 'X' ||
                              _chars[_curPos + 4] != 'E' || _chars[_curPos + 5] != 'D')
                         {
                             Throw(_curPos, SR.Xml_ExpectAttType);
                         }
                         _curPos += 6;
                         _scanningFunction = ScanningFunction.Attlist7;
                         return Token.FIXED;
                     default:
                         Throw(_curPos, SR.Xml_ExpectAttType);
                         break;
                 }
                 break;
             default:
                 Throw(_curPos, SR.Xml_ExpectAttType);
                 break;
         }
     ReadData:
         if (ReadData() == 0)
         {
             Throw(_curPos, SR.Xml_IncompleteDtdContent);
         }
     }
 }
开发者ID:chcosta,项目名称:corefx,代码行数:66,代码来源:DtdParser.cs

示例15: ScanElement5

 private Token ScanElement5()
 {
     switch (_chars[_curPos])
     {
         case ',':
             _curPos++;
             _scanningFunction = ScanningFunction.Element3;
             return Token.Comma;
         case '|':
             _curPos++;
             _scanningFunction = ScanningFunction.Element3;
             return Token.Or;
         case ')':
             _curPos++;
             _scanningFunction = ScanningFunction.Element4;
             return Token.RightParen;
         case '>':
             _curPos++;
             _scanningFunction = ScanningFunction.SubsetContent;
             return Token.GreaterThan;
         default:
             Throw(_curPos, SR.Xml_ExpectOp);
             return Token.None;
     }
 }
开发者ID:chcosta,项目名称:corefx,代码行数:25,代码来源:DtdParser.cs


注:本文中的ScanningFunction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。