Beispiel #1
0
        private CSharpSyntaxNode LexXmlDocComment(XmlDocCommentStyle style)
        {
            var saveMode = _mode;
            bool isTerminated;

            var mode = style == XmlDocCommentStyle.SingleLine
                    ? LexerMode.XmlDocCommentStyleSingleLine
                    : LexerMode.XmlDocCommentStyleDelimited;
            if (_xmlParser == null)
            {
                _xmlParser = new DocumentationCommentParser(this, mode);
            }
            else
            {
                _xmlParser.ReInitialize(mode);
            }

            var docComment = _xmlParser.ParseDocumentationComment(out isTerminated);

            // We better have finished with the whole comment. There should be error
            // code in the implementation of ParseXmlDocComment that ensures this.
            Debug.Assert(this.LocationIs(XmlDocCommentLocation.End) || TextWindow.PeekChar() == SlidingTextWindow.InvalidCharacter);

            _mode = saveMode;

            if (!isTerminated)
            {
                // The comment didn't end.  Report an error at the start point.
                // NOTE: report this error even if the DocumentationMode is less than diagnose - the comment
                // would be malformed as a non-doc comment as well.
                this.AddError(TextWindow.LexemeStartPosition, TextWindow.Width, ErrorCode.ERR_OpenEndedComment);
            }

            return docComment;
        }
Beispiel #2
0
 private bool StyleIs(XmlDocCommentStyle style)
 {
     return StyleOf(_mode) == style;
 }