Case Mismatch: Able to create Evaluable but actual evaluate fails
praveentiru opened this issue · 4 comments
Hi,
I am using gval to build an excel formula parser. Repo name is efp. Check efp_test.go. You can change case in expression to see behavior.
In excel, all function names are capitalized so, I have created Functions with Capital names. Language allows creation of non-null Evaluable even when case does not match. But, when Eval* function is called on Evaluable the results are incorrect.
The function mapped to keyword is called correctly and the value returned from the function is accurate but, it seems this value is lost after evaluation. Any thoughts?
Ideally Parse should fail in this scenario so that users get feedback when expression is built improperly.
I have done more testing and please find below info regarding the same. The expression being passed.
find("l", "Hello") - Does not work
Find("l", "Hello") - Works
EvalString function of Evaluable is returning error: could not call function: unknown parameter find. Ideally this should fail at the time of parsing rather than Evaluation. If you give me some pointers on how to make this change. I can work on a PR.
Hi,
this cant fail a parsing because you could give it a parameter line map[string]{"find": func(string)string{return "ok"}
Is there a way to restrict functions to ones that are available in language?
Only if you change out the module that parses funtions and variables.