Skip to content
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

Support xor (^) #285

Merged
merged 2 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ridlbe/base/config/expression.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def operation_to_idl_s(exp, scope = nil)
s = '-' + expression_to_idl_s(op[0], scope)
when Expression::Operation::UnaryNot
s = '~' + expression_to_idl_s(op[0], scope)
when Expression::Operation::Xor
s = expression_to_idl_s(op[0], scope) + ' ^ ' + expression_to_idl_s(op[1], scope)
when Expression::Operation::Or
s = expression_to_idl_s(op[0], scope) + ' | ' + expression_to_idl_s(op[1], scope)
when Expression::Operation::And
Expand Down
2 changes: 2 additions & 0 deletions ridlbe/c++11/config/expression.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ def operation_to_s(exp, scope = nil)
s = '-' + expression_to_s(op[0], scope)
when Expression::Operation::UnaryNot
s = '~' + expression_to_s(op[0], scope)
when Expression::Operation::Xor
s = expression_to_s(op[0], scope) + ' ^ ' + expression_to_s(op[1], scope)
when Expression::Operation::Or
s = expression_to_s(op[0], scope) + ' | ' + expression_to_s(op[1], scope)
when Expression::Operation::And
Expand Down
15 changes: 15 additions & 0 deletions tests/const/const.idl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ module Test
const TCounter double_count = count * 2;
const long ALG_NONE = 0;
const long ALG_LPC = ALG_NONE + 3;

const long long_e1 = 2;
const long long_e2 = long_e1 + 2;
const long long_e3 = long_e2 * 3;
const long long_e4 = long_e3 / 4;
const long long_e5 = long_e4 | 5;
const long long_e6 = long_e5 ^ 6;
const long long_e7 = long_e6 & 7;
const long long_e8 = long_e7 << 4;
const long long_e9 = long_e8 >> 1;
const long long_e10 = long_e9 % 5;
const long long_e11 = long_e10 - 5;
const long long_e12 = +long_e11;
const long long_e13 = -long_e12;
const long long_e14 = ~long_e13;
};

interface A
Expand Down