Skip to content

Commit eec4dd6

Browse files
Fixed check for XOR keyword
1 parent dd4d384 commit eec4dd6

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

src/sttp/data/filterexpressionparser.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -885,20 +885,24 @@ def exitValueExpression(self, ctx: ExpressionParser.ValueExpressionContext):
885885
bitwise_operator: ExpressionParser.BitwiseOperatorContext = ctx.bitwiseOperator()
886886

887887
if bitwise_operator is not None:
888-
operatorsymbol = bitwise_operator.getText()
889-
890-
if operatorsymbol == "&":
891-
operatortype = ExpressionOperatorType.BITWISEAND
892-
elif operatorsymbol == "|":
893-
operatortype = ExpressionOperatorType.BITWISEOR
894-
elif operatorsymbol == "^":
895-
operatortype = ExpressionOperatorType.BITWISEXOR
896-
elif operatorsymbol == "<<":
897-
operatortype = ExpressionOperatorType.BITSHIFTLEFT
898-
elif operatorsymbol == ">>":
899-
operatortype = ExpressionOperatorType.BITSHIFTRIGHT
888+
# Check for bitwise operators
889+
if bitwise_operator.K_XOR() is None:
890+
operatorsymbol = bitwise_operator.getText()
891+
892+
if operatorsymbol == "&":
893+
operatortype = ExpressionOperatorType.BITWISEAND
894+
elif operatorsymbol == "|":
895+
operatortype = ExpressionOperatorType.BITWISEOR
896+
elif operatorsymbol == "^":
897+
operatortype = ExpressionOperatorType.BITWISEXOR
898+
elif operatorsymbol == "<<":
899+
operatortype = ExpressionOperatorType.BITSHIFTLEFT
900+
elif operatorsymbol == ">>":
901+
operatortype = ExpressionOperatorType.BITSHIFTRIGHT
902+
else:
903+
raise EvaluateError(f"unexpected bitwise operator \"{operatorsymbol}\"")
900904
else:
901-
raise EvaluateError(f"unexpected bitwise operator \"{operatorsymbol}\"")
905+
operatortype = ExpressionOperatorType.BITWISEXOR
902906

903907
self._add_expr(ctx, OperatorExpression(operatortype, left, right))
904908
return

0 commit comments

Comments
 (0)