mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-04-28 02:33:23 +08:00
1. 移除了FlipflopContext,统一流程API
2. Script项目脚本修复了 RawString 原始字符串存在的问题 3. Script使用了ValueNode统一了值类型节点,为后续扩展更多的值类型做准备 4. TypeHelper.ToTypeOfString()方法中添加了部分值类型的"Type[]”与“List<Type>”的显式定义,用于脚本在类型中定义数组成员 5. Script项目脚本默认挂载的json方法拆分为jsonObj(String)与jsonStr(Object)以支持序列化与反序列化 6. 项目保存为dnf项目文件时,将不再保存名称为”Default"并且没有节点的画布,避免重复保存时默认画布增多。
This commit is contained in:
@@ -15,10 +15,12 @@ namespace Serein.Library.Api
|
|||||||
/// 触发器完成的状态(根据业务场景手动设置)
|
/// 触发器完成的状态(根据业务场景手动设置)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
FlipflopStateType State { get; set; }
|
FlipflopStateType State { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 触发类型
|
/// 触发类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
TriggerDescription Type { get; set; }
|
TriggerDescription Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 触发时传递的数据
|
/// 触发时传递的数据
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -14,16 +14,22 @@ namespace Serein.Library.Api
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IFlowContext
|
public interface IFlowContext
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 标识流程
|
||||||
|
/// </summary>
|
||||||
|
string Guid {get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否记录流程信息
|
/// 是否记录流程信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
bool IsRecordInvokeInfo { get; set; }
|
bool IsRecordInvokeInfo { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 标识流程
|
/// <para>用于同一个流程上下文中共享、存储任意数据</para>
|
||||||
|
/// <para>流程完毕时,如果存储的对象实现了 IDisposable 接口,将会自动调用</para>
|
||||||
|
/// <para>谨慎使用,注意数据的生命周期和内存管理</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string Guid {get; }
|
object? Tag { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 运行环境
|
/// 运行环境
|
||||||
|
|||||||
@@ -1012,7 +1012,6 @@ namespace Serein.Library.Api
|
|||||||
void SetUIContextOperation(UIContextOperation uiContextOperation);
|
void SetUIContextOperation(UIContextOperation uiContextOperation);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region 项目相关操作
|
#region 项目相关操作
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1068,7 +1067,6 @@ namespace Serein.Library.Api
|
|||||||
bool TryGetDelegateDetails(string assemblyName, string methodName, out DelegateDetails del);
|
bool TryGetDelegateDetails(string assemblyName, string methodName, out DelegateDetails del);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
#region 类库依赖相关
|
#region 类库依赖相关
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -1099,8 +1097,6 @@ namespace Serein.Library.Api
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region 远程相关
|
#region 远程相关
|
||||||
/*/// <summary>
|
/*/// <summary>
|
||||||
/// 启动远程服务
|
/// 启动远程服务
|
||||||
@@ -1142,8 +1138,6 @@ namespace Serein.Library.Api
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region 节点中断、表达式(暂时没用)
|
#region 节点中断、表达式(暂时没用)
|
||||||
#if false
|
#if false
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ namespace Serein.Library
|
|||||||
/// <param name="message"></param>
|
/// <param name="message"></param>
|
||||||
/// <param name="isCancel"></param>
|
/// <param name="isCancel"></param>
|
||||||
/// <param name="clsss"></param>
|
/// <param name="clsss"></param>
|
||||||
public FlipflopException(string message, bool isCancel = true,CancelClass clsss = CancelClass.CancelBranch) :base(message)
|
public FlipflopException(string message, bool isCancel = true, CancelClass clsss = CancelClass.CancelBranch) :base(message)
|
||||||
{
|
{
|
||||||
IsCancel = isCancel;
|
IsCancel = isCancel;
|
||||||
Type = clsss;
|
Type = clsss;
|
||||||
|
|||||||
@@ -27,6 +27,14 @@ namespace Serein.Library
|
|||||||
RunState = RunState.Running;
|
RunState = RunState.Running;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <para>用于同一个流程上下文中共享、存储任意数据</para>
|
||||||
|
/// <para>流程完毕时,如果存储的对象实现了 IDisposable 接口,将会自动调用</para>
|
||||||
|
/// <para>谨慎使用,注意数据的生命周期和内存管理</para>
|
||||||
|
/// </summary>
|
||||||
|
public object? Tag { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否记录流程调用信息
|
/// 是否记录流程调用信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -79,7 +87,6 @@ namespace Serein.Library
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 记录流程调用信息
|
/// 记录流程调用信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -255,11 +262,15 @@ namespace Serein.Library
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Reset()
|
public void Reset()
|
||||||
{
|
{
|
||||||
|
if(Tag is IDisposable disposable)
|
||||||
|
{
|
||||||
|
disposable.Dispose(); // 释放 Tag 中的资源
|
||||||
|
}
|
||||||
this.dictNodeFlowData?.Clear();
|
this.dictNodeFlowData?.Clear();
|
||||||
ExceptionOfRuning = null;
|
ExceptionOfRuning = null;
|
||||||
|
flowInvokeInfos.Clear();
|
||||||
NextOrientation = ConnectionInvokeType.None;
|
NextOrientation = ConnectionInvokeType.None;
|
||||||
RunState = RunState.Running;
|
RunState = RunState.Running;
|
||||||
flowInvokeInfos.Clear();
|
|
||||||
Guid = global::System.Guid.NewGuid().ToString();
|
Guid = global::System.Guid.NewGuid().ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ namespace Serein.Library
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="content"></param>
|
/// <param name="content"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static IJsonToken json(string content)
|
public static IJsonToken jsonObj(string content)
|
||||||
{
|
{
|
||||||
/*if (string.IsNullOrWhiteSpace(content))
|
/*if (string.IsNullOrWhiteSpace(content))
|
||||||
{
|
{
|
||||||
@@ -152,6 +152,20 @@ namespace Serein.Library
|
|||||||
return JsonHelper.Parse(content);
|
return JsonHelper.Parse(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 转为JSON字符串
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="content"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static string jsonStr(object data)
|
||||||
|
{
|
||||||
|
if (data is null)
|
||||||
|
{
|
||||||
|
return "{}";
|
||||||
|
}
|
||||||
|
return JsonHelper.Serialize(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -55,11 +55,15 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Remove="Api\IFlipflopContext.cs" />
|
||||||
|
<Compile Remove="Enums\FlipflopStateType.cs" />
|
||||||
<Compile Remove="Extension\FlowModelExtension.cs" />
|
<Compile Remove="Extension\FlowModelExtension.cs" />
|
||||||
<Compile Remove="FlowNode\Attribute.cs" />
|
<Compile Remove="FlowNode\Attribute.cs" />
|
||||||
|
<Compile Remove="FlowNode\FlipflopContext.cs" />
|
||||||
<Compile Remove="FlowNode\NodeModelBaseData.cs" />
|
<Compile Remove="FlowNode\NodeModelBaseData.cs" />
|
||||||
<Compile Remove="FlowNode\NodeModelBaseFunc.cs" />
|
<Compile Remove="FlowNode\NodeModelBaseFunc.cs" />
|
||||||
<Compile Remove="FlowNode\ScriptFlowApi.cs" />
|
<Compile Remove="FlowNode\ScriptFlowApi.cs" />
|
||||||
|
<Compile Remove="Utils\ExpressionHelper.cs" />
|
||||||
<Compile Remove="Utils\NativeDllHelper.cs" />
|
<Compile Remove="Utils\NativeDllHelper.cs" />
|
||||||
<Compile Remove="Utils\RemoteMsgUtil.cs" />
|
<Compile Remove="Utils\RemoteMsgUtil.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -70,7 +70,6 @@ namespace Serein.Library.Utils
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 字面量转为对应类型
|
/// 字面量转为对应类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -84,11 +83,13 @@ namespace Serein.Library.Utils
|
|||||||
return Type.GetType(valueStr);
|
return Type.GetType(valueStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region 常见值类型
|
||||||
|
|
||||||
if (valueStr.Equals("bool", StringComparison.OrdinalIgnoreCase))
|
if (valueStr.Equals("bool", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
return typeof(bool);
|
return typeof(bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 整数型
|
#region 整数型
|
||||||
else if (valueStr.Equals("sbyte", StringComparison.OrdinalIgnoreCase)
|
else if (valueStr.Equals("sbyte", StringComparison.OrdinalIgnoreCase)
|
||||||
|| valueStr.Equals(nameof(SByte), StringComparison.OrdinalIgnoreCase))
|
|| valueStr.Equals(nameof(SByte), StringComparison.OrdinalIgnoreCase))
|
||||||
@@ -167,6 +168,170 @@ namespace Serein.Library.Utils
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Array数组类型
|
||||||
|
if (valueStr.Equals("bool" + "[]", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(bool[]);
|
||||||
|
}
|
||||||
|
#region 整数型
|
||||||
|
else if (valueStr.Equals("sbyte" + "[]", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| valueStr.Equals(nameof(SByte) + "[]", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(SByte[]);
|
||||||
|
}
|
||||||
|
else if (valueStr.Equals("short" + "[]", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| valueStr.Equals(nameof(Int16) + "[]", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(Int16[]);
|
||||||
|
}
|
||||||
|
else if (valueStr.Equals("int" + "[]", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| valueStr.Equals(nameof(Int32) + "[]", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(Int32[]);
|
||||||
|
}
|
||||||
|
else if (valueStr.Equals("long" + "[]", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| valueStr.Equals(nameof(Int64) + "[]", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(Int64[]);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (valueStr.Equals("byte" + "[]", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| valueStr.Equals(nameof(Byte) + "[]", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(Byte[]);
|
||||||
|
}
|
||||||
|
else if (valueStr.Equals("ushort" + "[]", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| valueStr.Equals(nameof(UInt16) + "[]", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(UInt16[]);
|
||||||
|
}
|
||||||
|
else if (valueStr.Equals("uint" + "[]", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| valueStr.Equals(nameof(UInt32) + "[]", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(UInt32[]);
|
||||||
|
}
|
||||||
|
else if (valueStr.Equals("ulong" + "[]", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| valueStr.Equals(nameof(UInt64) + "[]", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(UInt64[]);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 浮点型
|
||||||
|
else if (valueStr.Equals("float" + "[]", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| valueStr.Equals(nameof(Single) + "[]", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(Single[]);
|
||||||
|
}
|
||||||
|
else if (valueStr.Equals("double" + "[]", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| valueStr.Equals(nameof(Double) + "[]", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(Double[]);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 小数型
|
||||||
|
|
||||||
|
else if (valueStr.Equals("decimal" + "[]", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| valueStr.Equals(nameof(Decimal) + "[]", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(Decimal[]);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 其他常见的类型
|
||||||
|
else if (valueStr.Equals(nameof(String) + "[]", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(String[]);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region List<> 数组类型
|
||||||
|
if (valueStr.Equals("list<bool>", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(List<bool>);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 整数型
|
||||||
|
else if (valueStr.Equals("list<sbyte>", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| valueStr.Equals(nameof(List<SByte>), StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(List<SByte>);
|
||||||
|
}
|
||||||
|
else if (valueStr.Equals("list<short>", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| valueStr.Equals(nameof(List<Int16>), StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(List<Int16>);
|
||||||
|
}
|
||||||
|
else if (valueStr.Equals("list<int>", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| valueStr.Equals(nameof(List<Int32>), StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(List<Int32>);
|
||||||
|
}
|
||||||
|
else if (valueStr.Equals("list<long>", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| valueStr.Equals(nameof(List<Int64>), StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(List<Int64>);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (valueStr.Equals("list<byte>", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| valueStr.Equals(nameof(List<Byte>), StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(List<Byte>);
|
||||||
|
}
|
||||||
|
else if (valueStr.Equals("list<ushort>", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| valueStr.Equals(nameof(List<UInt16>), StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(List<UInt16>);
|
||||||
|
}
|
||||||
|
else if (valueStr.Equals("list<uint>", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| valueStr.Equals(nameof(List<UInt32>), StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(List<UInt32>);
|
||||||
|
}
|
||||||
|
else if (valueStr.Equals("list<ulong>", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| valueStr.Equals(nameof(List<UInt64>), StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(List<UInt64>);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 浮点型
|
||||||
|
else if (valueStr.Equals("list<float>", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| valueStr.Equals(nameof(List<Single>), StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(List<Single>);
|
||||||
|
}
|
||||||
|
else if (valueStr.Equals("list<double>", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| valueStr.Equals(nameof(List<Double>), StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(List<Double>);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 小数型
|
||||||
|
|
||||||
|
else if (valueStr.Equals("list<decimal>", StringComparison.OrdinalIgnoreCase)
|
||||||
|
|| valueStr.Equals(nameof(List<Decimal>), StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(List<Decimal>);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 其他常见的类型
|
||||||
|
|
||||||
|
else if (valueStr.Equals(nameof(List<String>), StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return typeof(List<String>);
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new ArgumentException($"无法解析的字面量类型[{valueStr}]");
|
throw new ArgumentException($"无法解析的字面量类型[{valueStr}]");
|
||||||
|
|||||||
@@ -48,8 +48,6 @@ namespace Serein.NodeFlow.Env
|
|||||||
private readonly FlowLibraryService flowLibraryManagement;
|
private readonly FlowLibraryService flowLibraryManagement;
|
||||||
private readonly FlowOperationService flowOperationService;
|
private readonly FlowOperationService flowOperationService;
|
||||||
private readonly FlowModelService flowModelService;
|
private readonly FlowModelService flowModelService;
|
||||||
//private readonly NodeMVVMService nodeMVVMService;
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 注册基本节点类型
|
/// 注册基本节点类型
|
||||||
@@ -633,33 +631,31 @@ namespace Serein.NodeFlow.Env
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* var nodeModels = flowModelService.GetAllNodeModel();
|
/* var nodeModels = flowModelService.GetAllNodeModel();
|
||||||
foreach (var toNode in nodeModels)
|
foreach (var toNode in nodeModels)
|
||||||
{
|
{
|
||||||
var canvasGuid = toNode.CanvasDetails.Guid;
|
var canvasGuid = toNode.CanvasDetails.Guid;
|
||||||
if (toNode.MethodDetails.ParameterDetailss == null)
|
if (toNode.MethodDetails.ParameterDetailss == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (var i = 0; i < toNode.MethodDetails.ParameterDetailss.Length; i++)
|
for (var i = 0; i < toNode.MethodDetails.ParameterDetailss.Length; i++)
|
||||||
{
|
{
|
||||||
var pd = toNode.MethodDetails.ParameterDetailss[i];
|
var pd = toNode.MethodDetails.ParameterDetailss[i];
|
||||||
if (!string.IsNullOrEmpty(pd.ArgDataSourceNodeGuid)
|
if (!string.IsNullOrEmpty(pd.ArgDataSourceNodeGuid)
|
||||||
&& TryGetNodeModel(pd.ArgDataSourceNodeGuid, out var fromNode))
|
&& TryGetNodeModel(pd.ArgDataSourceNodeGuid, out var fromNode))
|
||||||
{
|
{
|
||||||
*//*if (fromNode.NeedResultNodes[pd.ArgDataSourceType].Contains(toNode)
|
*//*if (fromNode.NeedResultNodes[pd.ArgDataSourceType].Contains(toNode)
|
||||||
&& pd.ArgDataSourceNodeGuid == fromNode.Guid
|
&& pd.ArgDataSourceNodeGuid == fromNode.Guid
|
||||||
&& )
|
&& )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}*//*
|
}*//*
|
||||||
ConnectArgSourceNode(canvasGuid, fromNode.Guid, toNode.Guid, JunctionType.ReturnData, JunctionType.ArgData, pd.ArgDataSourceType, pd.Index);
|
ConnectArgSourceNode(canvasGuid, fromNode.Guid, toNode.Guid, JunctionType.ReturnData, JunctionType.ArgData, pd.ArgDataSourceType, pd.Index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -339,9 +339,14 @@ namespace Serein.NodeFlow.Env
|
|||||||
var projectData = new SereinProjectData()
|
var projectData = new SereinProjectData()
|
||||||
{
|
{
|
||||||
Librarys = this._flowLibraryService.GetAllLibraryInfo().ToArray(),
|
Librarys = this._flowLibraryService.GetAllLibraryInfo().ToArray(),
|
||||||
Nodes = _flowModelService.GetAllNodeModel().Select(node => node.ToInfo()).Where(info => info is not null).ToArray(),
|
Nodes = _flowModelService.GetAllNodeModel()
|
||||||
Canvass = _flowModelService.GetAllCanvasModel().Select(canvas => canvas.ToInfo()).ToArray(),
|
.Select(node => node.ToInfo())
|
||||||
//StartNode = NodeModels.Values.FirstOrDefault(it => it.IsStart)?.Guid,
|
.Where(info => info is not null)
|
||||||
|
.ToArray(),
|
||||||
|
Canvass = _flowModelService.GetAllCanvasModel()
|
||||||
|
.Where(canvas => canvas.Nodes.Count != 0 && !"Default".Equals(canvas.Name))
|
||||||
|
.Select(canvas => canvas.ToInfo())
|
||||||
|
.ToArray(),
|
||||||
};
|
};
|
||||||
|
|
||||||
return projectData;
|
return projectData;
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ namespace Serein.NodeFlow
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/*/// <summary>
|
||||||
/// 触发器运行后状态转为对应的后继分支类别
|
/// 触发器运行后状态转为对应的后继分支类别
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="flowStateType"></param>
|
/// <param name="flowStateType"></param>
|
||||||
@@ -126,7 +126,7 @@ namespace Serein.NodeFlow
|
|||||||
FlipflopStateType.Cancel => ConnectionInvokeType.None,
|
FlipflopStateType.Cancel => ConnectionInvokeType.None,
|
||||||
_ => throw new NotImplementedException("未定义的流程状态")
|
_ => throw new NotImplementedException("未定义的流程状态")
|
||||||
};
|
};
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -72,23 +72,12 @@ namespace Serein.NodeFlow.Model.Nodes
|
|||||||
instance = ioc.Get(md.ActingInstanceType);
|
instance = ioc.Get(md.ActingInstanceType);
|
||||||
}
|
}
|
||||||
|
|
||||||
var args = MethodDetails.ParameterDetailss.Length == 0 ? [] : await this.GetParametersAsync(context, token);
|
var args = MethodDetails.ParameterDetailss.Length == 0 ? []
|
||||||
|
: await this.GetParametersAsync(context, token);
|
||||||
|
|
||||||
// 因为这里会返回不确定的泛型 IFlipflopContext<TRsult>
|
var result = await dd.InvokeAsync(instance, args);
|
||||||
// 而我们只需要获取到 State 和 Value(返回的数据)
|
var flowResult = FlowResult.OK(this.Guid, context, result);
|
||||||
// 所以使用 dynamic 类型接收
|
return flowResult;
|
||||||
dynamic flipflopContext = await dd.InvokeAsync(instance, args);
|
|
||||||
FlipflopStateType flipflopStateType = flipflopContext.State;
|
|
||||||
context.NextOrientation = flipflopStateType.ToContentType();
|
|
||||||
|
|
||||||
|
|
||||||
if (flipflopContext.Type == TriggerDescription.Overtime)
|
|
||||||
{
|
|
||||||
throw new FlipflopException(MethodDetails.MethodName + "触发器超时触发。Guid" + Guid);
|
|
||||||
}
|
|
||||||
object result = flipflopContext.Value;
|
|
||||||
var flowReslt = FlowResult.OK(this.Guid, context, result);
|
|
||||||
return flowReslt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -409,16 +409,6 @@ namespace Serein.NodeFlow.Services
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
await CallSuccessorNodesAsync(flipflopNode, token, pool, context);
|
await CallSuccessorNodesAsync(flipflopNode, token, pool, context);
|
||||||
/*if (flipflopNode.IsWaitSuccessorNodes)
|
|
||||||
{
|
|
||||||
_ = Task.Run(async () => await CallSuccessorNodesAsync(flipflopNode, token, pool, context));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
await CallSuccessorNodesAsync(flipflopNode, token, pool, context);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (FlipflopException ex)
|
catch (FlipflopException ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -103,20 +103,34 @@ public static class NodeMethodDetailsHelper
|
|||||||
if (methodInfo.ReturnType.IsGenericType && methodInfo.ReturnType.GetGenericTypeDefinition() == typeof(Task<>))
|
if (methodInfo.ReturnType.IsGenericType && methodInfo.ReturnType.GetGenericTypeDefinition() == typeof(Task<>))
|
||||||
{
|
{
|
||||||
// 获取 Task<> 的泛型参数类型
|
// 获取 Task<> 的泛型参数类型
|
||||||
var innerType = methodInfo.ReturnType.GetGenericArguments()[0];
|
var innerTypes = methodInfo.ReturnType.GetGenericArguments();
|
||||||
if (innerType.IsGenericType && innerType.GetGenericTypeDefinition() == typeof(IFlipflopContext<>))
|
if(innerTypes.Length == 1)
|
||||||
{
|
{
|
||||||
var flipflopType = innerType.GetGenericArguments()[0];
|
var innerType = innerTypes[0];
|
||||||
returnType = flipflopType;
|
returnType = innerType;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SereinEnv.WriteLine(InfoType.WARN, $"[{methodName}]跳过创建,返回类型非预期的Task<IFlipflopContext<TResult>>。");
|
SereinEnv.WriteLine(InfoType.WARN, $"[{methodName}]跳过创建,返回类型非预期的Task<TResult>。");
|
||||||
outMethodInfo = null;
|
outMethodInfo = null;
|
||||||
methodDetails = null;
|
methodDetails = null;
|
||||||
delegateDetails = null;
|
delegateDetails = null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
//var innerType = methodInfo.ReturnType.GetGenericArguments()[0];
|
||||||
|
//if (innerType.IsGenericType && innerType.GetGenericTypeDefinition() == typeof(IFlipflopContext<>))
|
||||||
|
//{
|
||||||
|
// var flipflopType = innerType.GetGenericArguments()[0];
|
||||||
|
// returnType = flipflopType;
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// SereinEnv.WriteLine(InfoType.WARN, $"[{methodName}]跳过创建,返回类型非预期的Task<IFlipflopContext<TResult>>。");
|
||||||
|
// outMethodInfo = null;
|
||||||
|
// methodDetails = null;
|
||||||
|
// delegateDetails = null;
|
||||||
|
// return false;
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,14 +9,7 @@ namespace Serein.Script.Node
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 布尔字面量
|
/// 布尔字面量
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class BooleanNode : ASTNode
|
public class BooleanNode(bool value) : ValueNode<bool>(value)
|
||||||
{
|
{
|
||||||
public bool Value { get; }
|
|
||||||
public BooleanNode(bool value) => Value = value;
|
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return $"{Value}";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,16 +6,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace Serein.Script.Node
|
namespace Serein.Script.Node
|
||||||
{
|
{
|
||||||
internal class CharNode : ASTNode
|
internal class CharNode(char value) : ValueNode<char>(value)
|
||||||
{
|
{
|
||||||
public char Value { get; }
|
|
||||||
public CharNode(string value)
|
|
||||||
{
|
|
||||||
Value = char.Parse(value);
|
|
||||||
}
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return $"'{Value}'";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,15 +9,9 @@ namespace Serein.Script.Node
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数值型节点
|
/// 数值型节点
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class NumberNode<T> : ASTNode where T : struct, IComparable<T>
|
public abstract class NumberNode<T> : ValueNode<T> where T : struct, IComparable<T>
|
||||||
{
|
{
|
||||||
public T Value { get; }
|
|
||||||
public NumberNode(T value) => Value = value;
|
public NumberNode(T value) => Value = value;
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return $"{Value}";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
8
Serein.Script/Node/ValueNode/RawStringNode.cs
Normal file
8
Serein.Script/Node/ValueNode/RawStringNode.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
namespace Serein.Script.Node
|
||||||
|
{
|
||||||
|
public class RawStringNode(string value) : ValueNode<string>(value)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -9,11 +9,9 @@ namespace Serein.Script.Node
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 字符串字面量节点
|
/// 字符串字面量节点
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class StringNode : ASTNode
|
public class StringNode : ValueNode<string>
|
||||||
{
|
{
|
||||||
public string Value { get; }
|
public StringNode(string input) : base()
|
||||||
|
|
||||||
public StringNode(string input)
|
|
||||||
{
|
{
|
||||||
// 使用 StringBuilder 来构建输出
|
// 使用 StringBuilder 来构建输出
|
||||||
StringBuilder output = new StringBuilder(input.Length);
|
StringBuilder output = new StringBuilder(input.Length);
|
||||||
@@ -59,11 +57,6 @@ namespace Serein.Script.Node
|
|||||||
}
|
}
|
||||||
Value = output.ToString();
|
Value = output.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
|
||||||
{
|
|
||||||
return $"\"{Value}\"";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
26
Serein.Script/Node/ValueNode/ValueNode.cs
Normal file
26
Serein.Script/Node/ValueNode/ValueNode.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Serein.Script.Node
|
||||||
|
{
|
||||||
|
public class ValueNode<T> : ASTNode
|
||||||
|
{
|
||||||
|
public T Value { get; protected set; }
|
||||||
|
|
||||||
|
public ValueNode()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
public ValueNode(T value)
|
||||||
|
{
|
||||||
|
this.Value = value;
|
||||||
|
}
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"{Value}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -56,6 +56,8 @@ namespace Serein.Script
|
|||||||
return null; // 返回 null
|
return null; // 返回 null
|
||||||
case CharNode charNode: // char字面量
|
case CharNode charNode: // char字面量
|
||||||
return charNode.Value; // 返回字符值
|
return charNode.Value; // 返回字符值
|
||||||
|
case RawStringNode rawStringNode:
|
||||||
|
return rawStringNode.Value; // 返回原始字符串值
|
||||||
case StringNode stringNode: // 字符串字面量
|
case StringNode stringNode: // 字符串字面量
|
||||||
return stringNode.Value; // 返回字符串值
|
return stringNode.Value; // 返回字符串值
|
||||||
case BooleanNode booleanNode: // 布尔值字面量
|
case BooleanNode booleanNode: // 布尔值字面量
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
namespace Serein.Script
|
using System.Data.Common;
|
||||||
|
using System.Numerics;
|
||||||
|
|
||||||
|
namespace Serein.Script
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Serein脚本词法分析器的Token类型
|
/// Serein脚本词法分析器的Token类型
|
||||||
@@ -38,6 +41,10 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
String,
|
String,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 原始字符串(多行字符串)
|
||||||
|
/// </summary>
|
||||||
|
RawString,
|
||||||
|
/// <summary>
|
||||||
/// Char字符
|
/// Char字符
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Char,
|
Char,
|
||||||
@@ -217,7 +224,7 @@
|
|||||||
if (_input[_index + 1] == '"'
|
if (_input[_index + 1] == '"'
|
||||||
&& _input[_index + 2] == '"')
|
&& _input[_index + 2] == '"')
|
||||||
{
|
{
|
||||||
var value = _input.Slice(_index, 4).ToString();
|
//var value = _input.Slice(_index, 4).ToString();
|
||||||
|
|
||||||
// 原始字符串
|
// 原始字符串
|
||||||
return ReadRawString();
|
return ReadRawString();
|
||||||
@@ -450,27 +457,38 @@
|
|||||||
|
|
||||||
private Token ReadRawString()
|
private Token ReadRawString()
|
||||||
{
|
{
|
||||||
// skip opening triple quotes
|
int startLine = _row;
|
||||||
_index += 3;
|
_index += 3; // 跳过开头 """
|
||||||
|
int index = _index;
|
||||||
var start = _index;
|
var contentStart = index;
|
||||||
while (_index + 2 < _input.Length)
|
while (index + 2 < _input.Length)
|
||||||
{
|
{
|
||||||
if (_input[_index] == '"' && _input[_index + 1] == '"' && _input[_index + 2] == '"')
|
char current = _input[index];
|
||||||
|
|
||||||
|
// 行号处理
|
||||||
|
if (current == '\n')
|
||||||
{
|
{
|
||||||
var value = _input.Slice(start, _index - start).ToString();
|
_row++;
|
||||||
_index += 3; // skip closing """
|
}
|
||||||
return CreateToken(TokenType.String, value);
|
|
||||||
|
// 检查是否是结束符 """
|
||||||
|
if (_input[index] != '"' || _input[index + 1] != '"' || _input[index + 2] != '"')
|
||||||
|
{
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var value = _input.Slice(contentStart, index - contentStart).ToString();
|
||||||
|
_index += 3;
|
||||||
|
// 构建带行号信息的 Token(假设 Token 有 StartLine 属性)
|
||||||
|
return CreateToken(TokenType.RawString, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
_index++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Exception("Unterminated raw string literal");
|
throw new Exception($"Unterminated raw string literal starting at line {startLine}");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 读取硬编码的文本
|
/// 读取硬编码的文本
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -112,9 +112,9 @@ namespace Serein.Script
|
|||||||
isAssignment = true;
|
isAssignment = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(peekCount > 19999)
|
if(peekCount > 3999)
|
||||||
{
|
{
|
||||||
throw new Exception("解析异常,peek次数过多,请减少脚本代码");
|
throw new Exception("解析异常,peek次数过多,可能是解析器出了bug");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -122,16 +122,19 @@ namespace Serein.Script
|
|||||||
#region 生成赋值语句/一般语句的ASTNode
|
#region 生成赋值语句/一般语句的ASTNode
|
||||||
if (isAssignment)
|
if (isAssignment)
|
||||||
{
|
{
|
||||||
|
|
||||||
// 以赋值语句的形式进行处理
|
// 以赋值语句的形式进行处理
|
||||||
var assignmentNode = ParseAssignmentNode(); // 解析复制表达式
|
var assignmentNode = ParseAssignmentNode(); // 解析复制表达式
|
||||||
NextToken();// 消耗 ";"
|
//if(_currentToken.Type == TokenType.Semicolon)
|
||||||
|
NextToken();// 消耗 ";"
|
||||||
return assignmentNode;
|
return assignmentNode;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 以一般语句的形式进行处理,可当作表达式进行解析
|
// 以一般语句的形式进行处理,可当作表达式进行解析
|
||||||
var targetNode = ParserExpression();
|
var targetNode = ParserExpression();
|
||||||
NextToken();// 消耗 ";"
|
//if (_currentToken.Type == TokenType.Semicolon)
|
||||||
|
NextToken();// 消耗 ";"
|
||||||
return targetNode;
|
return targetNode;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@@ -308,6 +311,7 @@ namespace Serein.Script
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
var c = _currentToken;
|
||||||
// 反转赋值。
|
// 反转赋值。
|
||||||
NextToken(); // 消耗 "=" 并获取赋值语句的右值表达式。
|
NextToken(); // 消耗 "=" 并获取赋值语句的右值表达式。
|
||||||
ASTNode valueNode = ParserExpression();
|
ASTNode valueNode = ParserExpression();
|
||||||
@@ -515,6 +519,13 @@ namespace Serein.Script
|
|||||||
fieldTypeName = $"{fieldTypeName}.{_currentToken.Value}"; // 向后扩充
|
fieldTypeName = $"{fieldTypeName}.{_currentToken.Value}"; // 向后扩充
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if (peekToken.Type == TokenType.SquareBracketsLeft)
|
||||||
|
{
|
||||||
|
NextToken(); // 消耗数组类型定义的 "["
|
||||||
|
NextToken(); // 消耗数组类型定义的 "]"
|
||||||
|
fieldTypeName += "[]";
|
||||||
|
continue;
|
||||||
|
}
|
||||||
else if (peekToken.Type == TokenType.Identifier)
|
else if (peekToken.Type == TokenType.Identifier)
|
||||||
{
|
{
|
||||||
// 尝试解析变量名称
|
// 尝试解析变量名称
|
||||||
@@ -677,7 +688,7 @@ namespace Serein.Script
|
|||||||
}
|
}
|
||||||
else if (_currentToken.Type == TokenType.BraceRight)
|
else if (_currentToken.Type == TokenType.BraceRight)
|
||||||
{
|
{
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1009,6 +1020,7 @@ namespace Serein.Script
|
|||||||
if(peekToken.Type == TokenType.ParenthesisRight // 可能解析完了方法参数
|
if(peekToken.Type == TokenType.ParenthesisRight // 可能解析完了方法参数
|
||||||
|| peekToken.Type == TokenType.Comma // 可能解析完了方法参数
|
|| peekToken.Type == TokenType.Comma // 可能解析完了方法参数
|
||||||
|| peekToken.Type == TokenType.Operator // 可能解析完了方法参数
|
|| peekToken.Type == TokenType.Operator // 可能解析完了方法参数
|
||||||
|
|| peekToken.Type == TokenType.BraceRight // 可能解析完了方法参数
|
||||||
|| peekToken.Type == TokenType.ParenthesisRight) // 可能解析完了下标索引
|
|| peekToken.Type == TokenType.ParenthesisRight) // 可能解析完了下标索引
|
||||||
{
|
{
|
||||||
return source;
|
return source;
|
||||||
@@ -1065,6 +1077,13 @@ namespace Serein.Script
|
|||||||
NextToken(); // 消耗布尔量
|
NextToken(); // 消耗布尔量
|
||||||
return new BooleanNode(value).SetTokenInfo(factorToken);
|
return new BooleanNode(value).SetTokenInfo(factorToken);
|
||||||
}
|
}
|
||||||
|
else if (_currentToken.Type == TokenType.RawString)
|
||||||
|
{
|
||||||
|
var value = _currentToken.Value;
|
||||||
|
NextToken(); // 消耗字符串
|
||||||
|
var node = new RawStringNode(value).SetTokenInfo(factorToken);
|
||||||
|
return node;
|
||||||
|
}
|
||||||
else if (_currentToken.Type == TokenType.String)
|
else if (_currentToken.Type == TokenType.String)
|
||||||
{
|
{
|
||||||
var value = _currentToken.Value;
|
var value = _currentToken.Value;
|
||||||
@@ -1076,7 +1095,8 @@ namespace Serein.Script
|
|||||||
{
|
{
|
||||||
var value = _currentToken.Value;
|
var value = _currentToken.Value;
|
||||||
NextToken(); ; // 消耗Char
|
NextToken(); ; // 消耗Char
|
||||||
return new CharNode(value).SetTokenInfo(factorToken);
|
var @char = char.Parse(value);
|
||||||
|
return new CharNode(@char).SetTokenInfo(factorToken);
|
||||||
}
|
}
|
||||||
else if (_currentToken.Type == TokenType.InterpolatedString)
|
else if (_currentToken.Type == TokenType.InterpolatedString)
|
||||||
{
|
{
|
||||||
@@ -1186,4 +1206,6 @@ namespace Serein.Script
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,6 +198,12 @@ namespace Serein.Script
|
|||||||
case CharNode charNode: // char字面量
|
case CharNode charNode: // char字面量
|
||||||
Append($"'{charNode.Value}'");
|
Append($"'{charNode.Value}'");
|
||||||
break;
|
break;
|
||||||
|
case RawStringNode rawStringNode: // 原始字符串
|
||||||
|
AppendLine("");
|
||||||
|
Append("\"\"\"");
|
||||||
|
Append(rawStringNode.Value);
|
||||||
|
Append("\"\"\"");
|
||||||
|
break;
|
||||||
case StringNode stringNode: // 字符串字面量
|
case StringNode stringNode: // 字符串字面量
|
||||||
Append($"\"{stringNode.Value}\"");
|
Append($"\"{stringNode.Value}\"");
|
||||||
break;
|
break;
|
||||||
@@ -502,9 +508,9 @@ namespace Serein.Script
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -128,6 +128,9 @@ namespace Serein.Script
|
|||||||
case CharNode charNode: // char字面量
|
case CharNode charNode: // char字面量
|
||||||
NodeSymbolInfos[charNode] = typeof(char);
|
NodeSymbolInfos[charNode] = typeof(char);
|
||||||
return typeof(char);
|
return typeof(char);
|
||||||
|
case RawStringNode rawStringNode: // 原始字符串字面量(多行字符串)
|
||||||
|
NodeSymbolInfos[rawStringNode] = typeof(string);
|
||||||
|
return typeof(string);
|
||||||
case StringNode stringNode: // 字符串字面量
|
case StringNode stringNode: // 字符串字面量
|
||||||
NodeSymbolInfos[stringNode] = typeof(string);
|
NodeSymbolInfos[stringNode] = typeof(string);
|
||||||
return typeof(string);
|
return typeof(string);
|
||||||
@@ -507,6 +510,7 @@ namespace Serein.Script
|
|||||||
break;
|
break;
|
||||||
case NullNode nullNode: // null
|
case NullNode nullNode: // null
|
||||||
case CharNode charNode: // char字面量
|
case CharNode charNode: // char字面量
|
||||||
|
case RawStringNode rawStringNode:
|
||||||
case StringNode stringNode: // 字符串字面量
|
case StringNode stringNode: // 字符串字面量
|
||||||
case BooleanNode booleanNode: // 布尔值字面量
|
case BooleanNode booleanNode: // 布尔值字面量
|
||||||
case NumberIntNode numberIntNode: // int整型数值字面量
|
case NumberIntNode numberIntNode: // int整型数值字面量
|
||||||
@@ -558,6 +562,20 @@ namespace Serein.Script
|
|||||||
}
|
}
|
||||||
AnalysisCollectionIndexNode(collectionIndexNode);
|
AnalysisCollectionIndexNode(collectionIndexNode);
|
||||||
break;
|
break;
|
||||||
|
case CollectionAssignmentNode collectionAssignmentNode: // 集合赋值操作
|
||||||
|
void AnalysisCollectionAssignmentNode(CollectionAssignmentNode collectionAssignmentNode)
|
||||||
|
{
|
||||||
|
Analysis(collectionAssignmentNode);
|
||||||
|
}
|
||||||
|
AnalysisCollectionAssignmentNode(collectionAssignmentNode);
|
||||||
|
break;
|
||||||
|
case ArrayDefintionNode arrayDefintionNode:
|
||||||
|
void AnalysisArrayDefintionNode(ArrayDefintionNode arrayDefintionNode)
|
||||||
|
{
|
||||||
|
Analysis(arrayDefintionNode);
|
||||||
|
}
|
||||||
|
AnalysisArrayDefintionNode(arrayDefintionNode);
|
||||||
|
break;
|
||||||
case ClassTypeDefinitionNode classTypeDefinitionNode: // 类型定义
|
case ClassTypeDefinitionNode classTypeDefinitionNode: // 类型定义
|
||||||
Analysis(classTypeDefinitionNode);
|
Analysis(classTypeDefinitionNode);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Serein.Workbench
|
|
||||||
{
|
|
||||||
internal class Test
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user