_Core/Lang/Plugins/Parser/MarkerPlugin.cs

(开头部分) 6KB

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

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


namespace ComLib.Lang.Extensions
{
    /* *************************************************************************
    <doc:example>	
    // Marker plugin allows you to mark code like comments but in the form of statements
    // so that syntax is checked. This allows for structured comments.
    
    // Case1 : Todo
    @todo: i need to add extra comments here
    
    // Case2 : Todo quoted
    @todo: "I need to add extra checks here and
    also do additional cleanup of code"
    
    // Case 3 : bug
    @bug: 'this bug related to parsing'
    @bug: this bug related to johns code!
    
    </doc:example>
    ***************************************************************************/
    /// <summary>
    /// Combinator for handling boolean values in differnt formats (yes, Yes, no, No, off Off, on On).
    /// </summary>
    public class MarkerLexPlugin : LexPlugin
    {
        /// <summary>
        /// Initialize
        /// </summary>
        public MarkerLexPlugin()
        {
            // "todo", "note", "bug", "review", "implement", "optimize", "refactor", "critical"
            _tokens = new string[] { "@" };
        }


        /// <summary>
        /// Whether or not the lexer can handle this token.
        /// </summary>
        /// <param name="current"></param>
        /// <returns></returns>
        public override bool CanHandle(Token current)
        {
            string nextWord = _lexer.PeekWord();
            if (MarkerPlugin._markers.ContainsKey(nextWord))
                return true;

            return false;
        }


        /// <summary>
        /// todo i need
        /// </summary>
后面还有 179 行代码,解锁后查看完整代码

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

AI 解读

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

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