Based on Frédéric's suggestion, I downloaded the System.Dynamic.Linq file and changed it for '&' and '|' operatiors:
// +, -, &, | operators
Expression ParseAdditive()
{
Expression left = ParseMultiplicative();
while (token.id == TokenId.Plus || token.id == TokenId.Minus ||
token.id == TokenId.Amphersand || token.id == TokenId.Bar)
{
Token op = token;
NextToken();
Expression right = ParseMultiplicative();
switch (op.id)
{
case TokenId.Plus:
if (left.Type == typeof(string) || right.Type == typeof(string))
goto case TokenId.Amphersand;
CheckAndPromoteOperands(typeof(IAddSignatures), op.text, ref left, ref right, op.pos);
left = GenerateAdd(left, right);
break;
case TokenId.Minus:
CheckAndPromoteOperands(typeof(ISubtractSignatures), op.text, ref left, ref right, op.pos);
left = GenerateSubtract(left, right);
break;
case TokenId.Amphersand:
if (IsNumericType(left.Type) && IsNumericType(right.Type))
{
left = GenerateBinaryAnd(left, right);
}
else{
left = GenerateStringConcat(left, right);
}
break;
case TokenId.Bar:
if (IsNumericType(left.Type) && IsNumericType(right.Type))
{
left = GenerateBinaryOr(left, right);
}
else
{
left = GenerateStringConcat(left, right);
}
break;
}
}
return left;
}
Expression GenerateBinaryAnd(Expression left, Expression right)
{
return Expression.MakeBinary(ExpressionType.And, left, right);
}
Expression GenerateBinaryOr(Expression left, Expression right)
{
return Expression.MakeBinary(ExpressionType.Or, left, right);
}
I replaced the ParseAdditive function and created two new funtions that make a binary operation. So things like .Where("(a & B) > 0") now wioll work!!!!
It is not a final version because there are missing error checks and the name of the function 'ParseAdditive' maybe is not the right place or name, but it works.