Skip to content

Commit f1bb59d

Browse files
support "or" "is" "and" operators in condtions, fix small bug
1 parent 5f9f7fc commit f1bb59d

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

Code/Helpers/NumericExpressionReslover.cs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,20 +77,36 @@ public static TryGet<CompiledExpression> CompileExpression(BaseToken[] tokens)
7777
AppendRaw(tmp);
7878
continue;
7979
}
80+
case { RawRep: "is" }:
81+
{
82+
AppendRaw("==");
83+
break;
84+
}
85+
case { RawRep: "and" }:
86+
{
87+
AppendRaw("&&");
88+
break;
89+
}
90+
case { RawRep: "or" }:
91+
{
92+
AppendRaw("||");
93+
break;
94+
}
8095
default:
96+
{
8197
AppendRaw(token.RawRep);
8298
break;
99+
}
83100
}
84101
}
85-
86-
var rawRep = sb.ToString();
87-
var expression = new Expression(rawRep, EvaluateOptions.None);
102+
103+
var expression = new Expression(sb.ToString(), EvaluateOptions.None);
88104

89105
// Now we have the expression string and a variables dictionary.
90106
return new CompiledExpression(
91107
expression,
92108
variables,
93-
rawRep
109+
initial
94110
);
95111

96112
string MakeTempName()

0 commit comments

Comments
 (0)