This project has moved and is read-only. For the latest updates, please go here.

strange problem with scope compile

May 20, 2014 at 6:47 AM
please let me say first, that EXpression Evaluator is an awesome tool
and greatly simplifies my work ... Thank you very much for working on this tool.

i use EE to build logical expressions from bool functions like
"p.f1(data) || p.f2(data) || p.f3(data) || p.f4(data)"

in the above example f1, f2 and f3 return false, f4 returns true.
But the overall result is false (!) and f4 is not called,
only f1,f2,f3 are called, and return false.

When i changed the expression to
"p.f3(data) || p.f1(data) || p.f2(data) || p.f4(data)"
then - after calling f3 with result false - the expression processing ends
with result false.

when i changed the expression to
"(p.f1(data) || p.f2(data)) || (p.f3(data) || p.f4(data))"
then all four functions are called and overall result is true (!)

This example is simplified, because the logic is integrated in a bigger system.
I tried to reproduce in a simple test program, but i didn't succeed.

Any ideas on this issue?
May 20, 2014 at 12:47 PM
Hi. Is p a dynamic object? I may have a bug with the logical short circuit operators. I'll take a look at it, thanks!
May 20, 2014 at 1:05 PM
no, p is a registered type, a class with static functions f1, f2, ... of type Func<ScopeDataType, bool>.

In ScopeDataType class there is an instance property called 'data' implemented as 'return this'.
By this trick i have Access to the scope instance inside my f-functions
May 20, 2014 at 1:41 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
May 25, 2014 at 11:01 AM
To close this thread, the problem discovered was that there was an extra closing parenthesis after one of the function calls and this was causing ANTLR to exit early without throwing an exception due to the structure of the parse grammar for a single expression. This has now been fixed and the library should now throw an exception for parsing mismatches instead of early exit. Please get the latest AntlrParser branch.