Skip to content

Commit 2997069

Browse files
committed
修改 算法
1 parent 7390c4b commit 2997069

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

ToolGood.Algorithm/AlgorithmEngine.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ private List<object> parse(string exp)
179179

180180
while (curPos < texts.Count) {
181181
//获取 当前操作数
182-
curOpd = getOperand(texts,ref curPos);
182+
curOpd = getOperand(texts, ref curPos);
183183
if (curOpd != "") {
184184
if (operators.Count > 0 && hasPoint) {
185185
Operator op = operators.Pop();
@@ -307,7 +307,7 @@ private int getFunctionCount(List<string> texts, int curPos)
307307
}
308308
return count + hasCount;
309309
}
310-
private string getOperand(List<string> texts,ref int curPos)
310+
private string getOperand(List<string> texts, ref int curPos)
311311
{
312312
var t = texts[curPos];
313313
if (t.StartsWith("[")) {
@@ -322,7 +322,7 @@ private string getOperand(List<string> texts,ref int curPos)
322322
if (curPos > 0 && t == "-" && curPos + 1 < texts.Count) {
323323
if (m_Operators2.Contains(texts[curPos - 1])) {
324324
curPos++;
325-
return t + texts[curPos ];
325+
return t + texts[curPos];
326326
}
327327
}
328328

@@ -1136,7 +1136,9 @@ private Operand getChild(List<Operand> ops)
11361136
}
11371137
} else {
11381138
var v = json[op];
1139-
if (v.IsString) {
1139+
if (v == null) {
1140+
return new Operand(OperandType.JSON, v);
1141+
} else if (v.IsString) {
11401142
return new Operand(v.ToString());
11411143
} else if (v.IsBoolean) {
11421144
return new Operand(OperandType.BOOLEAN, bool.Parse(v.ToString()));
@@ -1148,6 +1150,8 @@ private Operand getChild(List<Operand> ops)
11481150
return new Operand(OperandType.NUMBER, double.Parse(v.ToString()));
11491151
} else if (v.IsObject) {
11501152
return new Operand(OperandType.JSON, v);
1153+
} else if (v.IsArray) {
1154+
return new Operand(OperandType.JSON, v);
11511155
}
11521156
}
11531157
}

0 commit comments

Comments
 (0)