_Core/Lang/Plugins/Parser/SwapPlugin.cs
(开头部分) 3KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ComLib.Lang;
namespace ComLib.Lang.Extensions
{
/* *************************************************************************
<doc:example>
// Swap plugin provides 1 line statement to swap variables.
var a = 1, b = 2;
// Swap values in 1 statement.
// Instead of needing a third variable.
swap a with b;
</doc:example>
***************************************************************************/
/// <summary>
/// Combinator for handling swapping of variable values. swap a and b.
/// </summary>
public class SwapPlugin : ExprPlugin
{
private static string[] _tokens = new string[] { "swap", "Swap" };
/// <summary>
/// Intialize.
/// </summary>
public SwapPlugin()
{
_hasStatementSupport = true;
_canHandleExpression = true;
_startTokens = _tokens;
}
/// <summary>
/// The grammer for the function declaration
/// </summary>
public override string Grammer
{
get
{
return "swap <id> with <id> <statementtermninator>";
}
}
/// <summary>
/// Examples
/// </summary>
public override string[] Examples
{
后面还有 65 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
