Skip to content

Commit 5618e1f

Browse files
author
linzhijun
committed
fix
1 parent f7646c0 commit 5618e1f

3 files changed

Lines changed: 18 additions & 22 deletions

File tree

csharp/ToolGood.Algorithm.Test/AlgorithmEngineHelper/AlgorithmEngineHelperTest.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,15 @@ public void Test()
2727

2828
DiyNameInfo p7 = AlgorithmEngineHelper.GetDiyNames("ddd+2");
2929
Assert.AreEqual("ddd", p7.Parameters[0].ToString());
30-
}
3130

32-
[Test]
31+
32+
DiyNameInfo p8 = AlgorithmEngineHelper.GetDiyNames(@"{""A"": 0.6,""B"": 0.4,""C"": 0.6,""E"": 0.33,""F"": 0.29,""Z"": 0.15
33+
,""EB"": 0.7,""EE"": 0.65,""EA"": 0.85,""AB"": 1.0,""BC"": 1.0,""AA"":1.0
34+
,""EBC"": 1.15,""BAB"": 1.25,""BCB"": 1.25,""BBC"": 1.25,""CBB"": 1.25,""EBA"": 1.2,""AAA"": 1.4}[瓦楞]");
35+
Assert.AreEqual("瓦楞", p8.Parameters[0].ToString());
36+
}
37+
38+
[Test]
3339
public void Test2()
3440
{
3541
var b = AlgorithmEngineHelper.IsKeywords("false");

csharp/ToolGood.Algorithm/Internals/DiyNameVisitor.cs

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,16 @@ public object VisitPARAMETER_fun(mathParser.PARAMETER_funContext context)
1515
if(node != null) {
1616
diy.Parameters.Add(new ParameterInfo(node.GetText(), node.Symbol.StartIndex, node.Symbol.StopIndex));
1717
}
18-
//node = context.PARAMETER2();
19-
//if (node != null) {
20-
// string str = node.GetText();
21-
// if (str.StartsWith('@')) {
22-
// diy.Parameters.Add(new ParameterInfo(str.AsSpan(1).ToString(), node.Symbol.StartIndex, node.Symbol.StopIndex));
23-
// } else if ((str.StartsWith('【') && str.EndsWith('】'))
24-
// || (str.StartsWith('[') && str.EndsWith(']'))
25-
// || (str.StartsWith('#') && str.EndsWith('#'))) {
26-
// diy.Parameters.Add(new ParameterInfo(str.AsSpan(1, str.Length - 2).ToString(), node.Symbol.StartIndex, node.Symbol.StopIndex));
27-
// } else {
28-
// diy.Parameters.Add(new ParameterInfo(str, node.Symbol.StartIndex, node.Symbol.StopIndex));
29-
// }
30-
//}
31-
3218
return VisitChildren(context);
3319
}
34-
20+
public object VisitGetJsonValue_fun(mathParser.GetJsonValue_funContext context)
21+
{
22+
ITerminalNode node = context.PARAMETER();
23+
if (node != null) {
24+
diy.Parameters.Add(new ParameterInfo(node.GetText(), node.Symbol.StartIndex, node.Symbol.StopIndex));
25+
}
26+
return VisitChildren(context);
27+
}
3528
public object VisitDiyFunction_fun(mathParser.DiyFunction_funContext context)
3629
{
3730
diy.Functions.Add(context.PARAMETER().GetText());
@@ -383,10 +376,7 @@ public object VisitGEOMEAN_fun(mathParser.GEOMEAN_funContext context)
383376
return VisitChildren(context);
384377
}
385378

386-
public object VisitGetJsonValue_fun(mathParser.GetJsonValue_funContext context)
387-
{
388-
return VisitChildren(context);
389-
}
379+
390380

391381
public object VisitGUID_fun(mathParser.GUID_funContext context)
392382
{

csharp/ToolGood.Algorithm/ToolGood.Algorithm.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<Product>ToolGood.Algorithm</Product>
2020
<PackageLicenseFile>LICENSE</PackageLicenseFile>
2121
<SignAssembly>true</SignAssembly>
22-
<Version>6.0.0.2</Version>
22+
<Version>6.0.0.3</Version>
2323
<AssemblyOriginatorKeyFile>ToolGood.Algorithm.snk</AssemblyOriginatorKeyFile>
2424
<DelaySign>false</DelaySign>
2525
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\ToolGood.Algorithm.xml</DocumentationFile>

0 commit comments

Comments
 (0)