_Core/Lang/Plugins/Parser/BoolPlugin.cs
(完整代码) 1KBusing System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ComLib.Lang;
namespace ComLib.Lang.Extensions
{
/* *************************************************************************
<doc:example>
// Bool plugin allows aliases for true/false
var result = on;
var result = off;
var result = yes;
var result = no;
</doc:example>
***************************************************************************/
/// <summary>
/// Combinator for handling days of the week.
/// </summary>
public class BoolPlugin : AliasTokenPlugin
{
/// <summary>
/// Initialize
/// </summary>
public BoolPlugin()
: base("yes", ComLib.Lang.Tokens.True)
{
Register("Yes", ComLib.Lang.Tokens.True);
Register("on", ComLib.Lang.Tokens.True);
Register("On", ComLib.Lang.Tokens.True);
Register("no", ComLib.Lang.Tokens.False);
Register("No", ComLib.Lang.Tokens.False);
Register("off", ComLib.Lang.Tokens.False);
Register("Off", ComLib.Lang.Tokens.False);
_tokens = new string[] { "yes", "Yes", "no", "No", "on", "On", "off", "Off" };
}
}
}
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
