Example #1
0
        private static bool ShallEscape(IDocCommentNode node, int offset)
        {
            IDocCommentBlockNode docBlock = node.GetContainingNode <IDocCommentBlockNode>(true);

            if (docBlock == null)
            {
                return(false);
            }
            XmlDocLexer lexer = new XmlDocLexer(docBlock);

            lexer.Start();

            bool inCData   = false;
            bool insideTag = false;

            while (lexer.TokenType != null)
            {
                if (lexer.TokenType == lexer.XmlTokenType.TAG_START)
                {
                    insideTag = true;
                }
                else if (lexer.TokenType == lexer.XmlTokenType.TAG_END)
                {
                    insideTag = false;
                }
                else if (lexer.TokenType == lexer.XmlTokenType.TAG_START1)
                {
                    insideTag = true;
                }
                else if (lexer.TokenType == lexer.XmlTokenType.TAG_END1)
                {
                    insideTag = false;
                }
                else if (lexer.TokenType == lexer.XmlTokenType.CDATA_START)
                {
                    inCData = true;
                }
                else if (lexer.TokenType == lexer.XmlTokenType.CDATA_END)
                {
                    inCData = false;
                }
                else if (offset >= lexer.TokenLocalRange.StartOffset && offset <= lexer.TokenLocalRange.EndOffset)
                {
                    return(!inCData && !insideTag);
                }
                else if (offset < lexer.TokenLocalRange.StartOffset)
                {
                    return(false);
                }
                lexer.Advance();
            }

            return(false);
        }
 public XmlCommentReflowableBlockLexer(IDocCommentBlock docCommentBlock)
 {
     _docLexer = new XmlDocLexer(docCommentBlock);
     _docLexer.Start();
 }