_Core/Lang/Plugins/System/IfPlugin.cs

(开头部分) 3KB

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

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

namespace ComLib.Lang
{
    /// <summary>
    /// Plugin for throwing errors from the script.
    /// </summary>
    public class IfPlugin : StmtBlockPlugin
    {
        private static string[] _tokens = new string[] { "if" };


        /// <summary>
        /// Intialize.
        /// </summary>
        public IfPlugin()
        {
            _startTokens = _tokens;
            _isSystemLevel = true;
            _supportsBlock = true;
        }


        /// <summary>
        /// The grammer for the function declaration
        /// </summary>
        public override string Grammer
        {
            get { return "if ( ( <expression> then <statementblock> ) | ( '(' <expression> ')' <statementblock> ) )"; }
        }


        /// <summary>
        /// Examples
        /// </summary>
        public override string[] Examples
        {
            get
            {
                return new string[]
                {
                    "if true then print hi",
                    "if ( total > 10 ) print hi",
                    "if ( isActive && age >= 21  ) { print('fluent'); print('script'); }"
                };
            }
        }


        /// <summary>
        /// return value;
        /// </summary>
        /// <returns></returns>
        public override Stmt Parse()
后面还有 88 行代码,解锁后查看完整代码

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

AI 解读

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

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