_Core/Lang/Helpers/DocHelper.cs

(开头部分) 7KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using ComLib.Lang.Docs;


namespace ComLib.Lang.Helpers
{
    /// <summary>
    /// Helper class for processing doctags.
    /// </summary>
    public class DocHelper
    {
        /// <summary>
        /// Parses doctags supporting simple format for the 1st release.
        /// </summary>
        /// <param name="comments"></param>
        /// <returns></returns>
        public static Tuple<DocTags, List<string>> ParseDocTags(List<string> comments)
        {
            var commentTokens = new List<CommentToken>();
            foreach (var comment in comments)
                commentTokens.Add(new CommentToken(comment));

            return ParseDocTags(commentTokens);
        }


        /// <summary>
        /// Parses doctags supporting simple format for the 1st release.
        /// </summary>
        /// <param name="comments"></param>
        /// <returns></returns>
        public static Tuple<DocTags, List<string>> ParseDocTags(List<CommentToken> comments)
        {
            var tags = new DocTags();
            var warnings = new List<string>();

            // What was the last comment type
            var lastType = "";
            foreach (var c in comments)
            {
                var comment = c.Text;
                if (comment.StartsWith("#"))
                    comment = comment.Substring(1);

                comment = comment.Trim();

                if (comment.Contains("@summary"))
                {
                    Try(() => tags.Summary = comment.Replace("@summary:", "").Trim(), "summary", comment, 1, warnings);
                    lastType = "sum";
                }
                else if (comment.Contains("@arg"))
                {
                    Try(() => tags.Args.Add(ParseArg(comment)), "arg", comment, 1, warnings);
                    lastType = "arg";
                }
后面还有 151 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。