コード例 #1
0

        
コード例 #2
0
ファイル: ReferenceParser.cs プロジェクト: WS-QA/cassette
        public IEnumerable<ParsedReference> Parse(string code, IAsset asset)
        {
            var comments = commentParser.Parse(code);

            return
                from comment in comments
                from path in ParsePaths(comment.Value, asset, comment.LineNumber)
                select new ParsedReference { Path = path, LineNumber = comment.LineNumber };
        }
コード例 #3
0
 private static bool Validate(string header, ICommentParser commentParser)
 {
     try
     {
         return(commentParser.Parse(header) == header);
     }
     catch (ParseException)
     {
         return(false);
     }
 }
コード例 #4
0
 public IComment Parse(ICommentParser parser, XmlNode node, bool first, bool last, ParseOptions options)
 {
     var typeAttribute = node.Attributes["type"];
     var listTypeName = typeAttribute == null ? string.Empty : typeAttribute.Value;
     var list = createListForType(listTypeName);
     foreach (XmlNode itemNode in node.SelectNodes("item"))
     {
         Paragraph term = null;
         Paragraph definition = null;
         var termNode = itemNode.SelectSingleNode("term");
         if (termNode != null)
         {
             term = new Paragraph(parser.Parse(termNode.ChildNodes));
         }
         var definitionNode = itemNode.SelectSingleNode("description");
         if (definitionNode != null)
         {
             definition = new Paragraph(parser.Parse(definitionNode.ChildNodes));
         }
         list.Items.Add(new InlineListItem(term, definition));
     }
     return list;
 }
コード例 #5
0
        public Comment Parse(ICommentParser parser, XmlNode node, bool first, bool last, ParseOptions options)
        {
            var typeAttribute = node.Attributes["type"];
            var listTypeName  = typeAttribute == null ? string.Empty : typeAttribute.Value;
            var list          = createListForType(listTypeName);

            foreach (XmlNode itemNode in node.SelectNodes("item"))
            {
                Paragraph term       = null;
                Paragraph definition = null;
                var       termNode   = itemNode.SelectSingleNode("term");
                if (termNode != null)
                {
                    term = new Paragraph(parser.Parse(termNode.ChildNodes));
                }
                var definitionNode = itemNode.SelectSingleNode("description");
                if (definitionNode != null)
                {
                    definition = new Paragraph(parser.Parse(definitionNode.ChildNodes));
                }
                list.Items.Add(new InlineListItem(term, definition));
            }
            return(list);
        }
コード例 #6
0
        private IEnumerable <XmlDocumentationMember> Parse(XmlDocument document)
        {
            if (document == null)
            {
                throw new ArgumentNullException("document");
            }

            // Get the assembly Identity.
            var members = new List <XmlDocumentationMember>();

            // Get all members and parse them.
            var nodes = document.SelectNodes("/doc/members/member");

            if (nodes != null)
            {
                foreach (XmlNode node in nodes)
                {
                    Debug.Assert(node != null, "Node cannot be null.");
                    Debug.Assert(node.Attributes != null, "Node has no attributes.");

                    var name = node.Attributes["name"];
                    if (name == null)
                    {
                        throw new SparrowException("Encountered XML member without name.");
                    }

                    var comments = new List <Comment>();
                    foreach (XmlNode commentNode in node.ChildNodes)
                    {
                        var comment = _parser.Parse(commentNode);
                        if (comment != null)
                        {
                            comments.Add(comment);
                        }
                    }

                    members.Add(new XmlDocumentationMember(name.InnerText, comments));
                }
            }

            // Return the result.
            return(members);
        }
コード例 #7
0
    public static string Prepare (string headerText, string currentHeaderText, ICommentParser commentParser)
    {
      var lineEndingInDocument = NewLineManager.DetectMostFrequentLineEnd (headerText);


      var headerWithNewLine = headerText;
      var newLine = NewLineManager.DetectMostFrequentLineEnd (headerWithNewLine);

      headerWithNewLine = NewLineManager.ReplaceAllLineEnds (headerWithNewLine, lineEndingInDocument);
      
      //if there's a comment right at the beginning of the file,
      //we need to add an empty line so that the comment doesn't
      //become a part of the header
      if (!string.IsNullOrEmpty (commentParser.Parse (currentHeaderText)) && !headerWithNewLine.EndsWith(lineEndingInDocument + lineEndingInDocument))
        headerWithNewLine += newLine;
      

      return headerWithNewLine;
    }
コード例 #8
0
        public static string Prepare(string headerText, string currentHeaderText, ICommentParser commentParser)
        {
            var lineEndingInDocument = NewLineManager.DetectMostFrequentLineEnd(headerText);


            var headerWithNewLine = headerText;
            var newLine           = NewLineManager.DetectMostFrequentLineEnd(headerWithNewLine);

            headerWithNewLine = NewLineManager.ReplaceAllLineEnds(headerWithNewLine, lineEndingInDocument);

            //if there's a comment right at the beginning of the file,
            //we need to add an empty line so that the comment doesn't
            //become a part of the header
            if (!string.IsNullOrEmpty(commentParser.Parse(currentHeaderText)) && !headerWithNewLine.EndsWith(lineEndingInDocument + lineEndingInDocument))
            {
                headerWithNewLine += newLine;
            }


            return(headerWithNewLine);
        }
コード例 #9
0
ファイル: ParagraphCommentParser.cs プロジェクト: cdrnet/docu
 public Comment Parse(ICommentParser parser, XmlNode node, bool first, bool last, ParseOptions options)
 {
     return new Paragraph(parser.Parse(node.ChildNodes));
 }
コード例 #10
0
 private static bool CurrentFileContainsCommentOnTop(string currentHeaderText, ICommentParser commentParser)
 {
     return(!string.IsNullOrEmpty(commentParser.Parse(currentHeaderText)));
 }
コード例 #11
0
 public Comment Parse(ICommentParser parser, XmlNode node, bool first, bool last, ParseOptions options)
 {
     return(new Paragraph(parser.Parse(node.ChildNodes)));
 }