_Core/Lang/Plugins/Core/AliasPlugin.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ComLib.Lang;
namespace ComLib.Lang.Extensions
{
/* *************************************************************************
<doc:example>
// Alias plugin is a base class for other plugin that want to register aliases
// for tokens. e.g using "set" to actually represent "var" or using
// "and" to represent &&
</doc:example>
***************************************************************************/
/// <summary>
/// Combinator for handling days of the week.
/// </summary>
public class AliasTokenPlugin : TokenPlugin
{
private IDictionary<string, Token> _map;
/// <summary>
/// Initialize
/// </summary>
public AliasTokenPlugin(string alias, Token replacement)
{
_map = new Dictionary<string, Token>();
_tokens = new string[] { alias };
_canHandleToken = true;
Register(alias, replacement);
}
/// <summary>
/// The grammer for the function declaration
/// </summary>
public override string Grammer
{
get
{
return "<alias> -> <replacement>";
}
}
/// <summary>
/// Examples
/// </summary>
public override string[] Examples
{
get
{
return new string[]
{
后面还有 67 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
