-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Link operations to operators problem. #54
Comments
The masking system is a little complicated. I can think of 2 possible reasons for this problem:
@astlin can you provide the code you use to declare all your operations as well as the hex numeral of |
Well, actually there is a declaration of '=%' for ANY_TYPE on ANY_TYPE right before the last one 'ANY ANY ANY'.
|
This The // Resolve the operation:
result = exec_operation(p_left, p_right, &data, data.op);
if (!result) {
// ANY_OP will only run if no other match is found:
result = exec_operation(p_left, p_right, &data, ANY_OP);
} This could probably be better explained in the docs. In any case I suggest you group your // The order is important between 2 operations with the same operator
// So ARR "=%" ANY will have precedence over ANY "=%" ANY
opMap.add({ARR, "=%", ANY_TYPE}, &ArrayOnAnyOperation);
opMap.add({ANY_TYPE, "=%", ANY_TYPE}, &AnyLike);
// Likewise {ARR ANY_OP ANY} will have precedence over {ANY ANY_OP ANY}
// But ANY_OP will always have less precedence than specific operations so they should
// be put in last to make it clear.
opMap.add({ARR, ANY_OP, ANY_TYPE}, &ArrayOnAnyOperation);
opMap.add({ANY_TYPE, ANY_OP, ANY_TYPE}, &AnyOnAny); I will add this example to the docs and then, if it works for you, close this issue. |
I have updated the doc section on this, and it should be clearer now. Let me know if this helps. |
Ok. Thanx for explanation. |
I've defined non-strict comparison operator '=%':
opp.add("==", 9); opp.add("!=", 9); opp.add("=%", 9);
But it won't match 'ANY_OP' pattern, so this do not work:
opMap.add({ARR, ANY_OP, ANY_TYPE}, &ArrayOnAnyOperation);
And I have to define it explicitly:
The text was updated successfully, but these errors were encountered: