Lines Matching refs:operator
93 # Simple lookup for operator precedence, used to avoid unnecessary
113 """Represents a binary operator in the parse tree."""
115 def __init__(self, operator: str, lhs: Union[int, float, Expression],
117 self.operator = operator
127 If ``other`` is an operator then a bracket is necessary when
128 this/self operator has higher precedence. Consider: '(a + b) * c',
137 other (Expression): is a lhs or rhs operator
145 if _PRECEDENCE.get(self.operator, -1) > _PRECEDENCE.get(
146 other.operator, -1):
148 if rhs and _PRECEDENCE.get(self.operator, -1) == _PRECEDENCE.get(
149 other.operator, -1):
154 return (f'{self.Bracket(self.lhs, self.lhs.ToPerfJson())} {self.operator} '
158 return (f'{self.Bracket(self.lhs, self.lhs.ToPython())} {self.operator} '
165 return Constant(ast.literal_eval(lhs + self.operator + rhs))
168 if self.operator in ('+', '|') and lhs.value == '0':
173 if self.operator == '*' and lhs.value == '0' and (
177 if self.operator == '*' and lhs.value == '1':
181 if self.operator in ('+', '|') and rhs.value == '0':
184 if self.operator == '*' and rhs.value == '0':
187 if self.operator == '*' and self.rhs.value == '1':
190 return Operator(self.operator, lhs, rhs)
194 return self.operator == other.operator and self.lhs.Equals(
205 return Operator(self.operator, lhs, rhs)
538 be handled via operator overloading. Finally the ast is evaluated.