_Core/Lang/Plugins/Parser/SuffixPlugin.cs

(开头部分) 3KB

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

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


namespace ComLib.Lang.Extensions
{

    /* *************************************************************************
    <doc:example>	
    // Suffix plugin enables the use of functions as postfix operators on constants.
    
    // create hours with timespan object using number of hours supplied
    function hours( num )
    {
         return new TimeSpan( 0, num, 0 , 0 )
    }

    // create minutes with timespan object using number of minutes supplied
    function minutes( num )
    {
        return new TimeSpan(0, 0, num, 0 )
    }

    // timespan objects can be added together
    var time = 3 hours + 20 minutes;
     
    </doc:example>
    ***************************************************************************/

    /// <summary>
    /// Combinator for handling comparisons.
    /// </summary>
    public class SuffixPlugin : ExprPlugin
    {
        private static string[] _tokens = new string[] { "$Suffix" };


        /// <summary>
        /// Initialize
        /// </summary>
        public SuffixPlugin()
        {
            _startTokens = _tokens;
            _hasStatementSupport = true;
        }


        /// <summary>
        /// The grammer for the function declaration
        /// </summary>
        public override string Grammer
        {
            get
            {
                return "<literal> <identifier>";
            }
        }
后面还有 59 行代码,解锁后查看完整代码

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

AI 解读

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

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