mirror of
https://gitee.com/langsisi_admin/serein-flow
synced 2026-03-03 00:00:49 +08:00
2. Script脚本添加了原始字符串的实现 3. 修复了Script中无法对 \" 双引号转义的问题 4. 新增了对于集合嵌套取值的支持(目前仅是集合取值) 5. 重新设计了FlowWorkManagement任务启动的逻辑,修复了触发器无法正常运行的问题 6. 在ScriptBaseFunc中新增了 json() 本地函数,支持将字符串转为IJsonToken进行取值。 7. EmitHelper对于集合取值时,反射获取“get_item”委托时存在看你多个MethodInfo,现在可以传入子项类型,帮助匹配目标重载方法
71 lines
2.1 KiB
C#
71 lines
2.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Serein.Script.Node
|
|
{
|
|
/// <summary>
|
|
/// 字符串字面量节点
|
|
/// </summary>
|
|
public class StringNode : ASTNode
|
|
{
|
|
public string Value { get; }
|
|
|
|
public StringNode(string input)
|
|
{
|
|
// 使用 StringBuilder 来构建输出
|
|
StringBuilder output = new StringBuilder(input.Length);
|
|
|
|
for (int i = 0; i < input.Length; i++)
|
|
{
|
|
if (i < input.Length - 1 && input[i] == '\\') // 找到反斜杠
|
|
{
|
|
char nextChar = input[i + 1];
|
|
|
|
// 处理转义符
|
|
switch (nextChar)
|
|
{
|
|
case 'r':
|
|
output.Append('\r');
|
|
i++; // 跳过 'r'
|
|
break;
|
|
case 'n':
|
|
output.Append('\n');
|
|
i++; // 跳过 'n'
|
|
break;
|
|
case 't':
|
|
output.Append('\t');
|
|
i++; // 跳过 't'
|
|
break;
|
|
case '\\': // 字面量反斜杠
|
|
output.Append('\\');
|
|
i++; // 跳过第二个 '\\'
|
|
break;
|
|
case '"': // 字符串反斜杠
|
|
output.Append('"');
|
|
i++; // 跳过第二个 '"'
|
|
break;
|
|
default:
|
|
output.Append(input[i]); // 不是转义符,保留反斜杠
|
|
break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
output.Append(input[i]); // 其他字符直接添加
|
|
}
|
|
}
|
|
Value = output.ToString();
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"\"{Value}\"";
|
|
}
|
|
}
|
|
|
|
|
|
}
|