You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an awesome library to help in this very complex topic!
I tried to expand the Sprache/samles/LinqyCalculator/ExpressionParser.cs to provide more functions than contained in System.Math. I was somehow unable to achieve that:
Functions could have no parameters.
Functions would accept strings, so that e.g. customFunc("Hello", "World") could be parsed (I was able to add "customFunc", but only with double values as parameters)
Can you maybe explain and show how I could achieve this?
The text was updated successfully, but these errors were encountered:
Hello! Sorry for being a bit late to reply here, I think I can help a bit.
In order to get functions without parameters, you'll need to make the expr parser within the Function parser optional. This has a consequence when you pass the expressions into CallFunction since you'll need to handle the case where there are no parameters. This is how I rewrote the Function parser with that:
In order to support strings, you'll need to add a new parser for string constants, and the interesting work would be how to integrate that constant. I'm assuming that you don't want the strings to be able to be added as part of an arithmetic expression, but rather just that they can be used as an argument in a function. In order to do that, you should be able to update the Function parser to derive its argument-expressions either from Expror your new string constant parser. Here's my implementation of that:
This is an awesome library to help in this very complex topic!
I tried to expand the Sprache/samles/LinqyCalculator/ExpressionParser.cs to provide more functions than contained in System.Math. I was somehow unable to achieve that:
Can you maybe explain and show how I could achieve this?
The text was updated successfully, but these errors were encountered: