sebastienros / parlot

Fast and lightweight parser creation tools
BSD 3-Clause "New" or "Revised" License
369 stars 44 forks source link

Bg with if expressions? #129

Closed Beckdotan closed 3 months ago

Beckdotan commented 3 months ago

Hi, I'm using NCalc in my software and wanted to move to the version that supports you. But for some resone, in my software (using .NET framework 4.8) I seem to have issue with an expression: DP(5186)*if(DP(90)>0,CFP(90),0.49)/1000. Where DP and CFP are working costume functions.

the call stuck when arriving to it ends with some of Ncalc and parlot calls: Screenshot 2024-06-03 092342

in the logicalExpressionFactory (NCalc): Screenshot 2024-06-03 092424

in parlot Fluent Parser I have: Screenshot 2024-06-03 092833

and then in the parlot compiler parser I get: Screenshot 2024-06-03 092913

When deleting the .Compile() from the LogicalExpressionParser of Ncalc from the line that is beeing called if the .Net version is less than 6, it seems to not throw this error anymore, and I get this parsed expression, that looks allright. Screenshot 2024-06-09 141740

image

NCalc logical expression factory:

image

But, after this expression I might calculate few more, and then it seems like my calculation is getting into infinite loop somewhere that might be because of the deletion of the .compile with different expression?

sebastienros commented 3 months ago

Following up on the ncalc issue.