def logical_and(self): expr = self.equality() while self.match(TokenType.AND_AND): op = self.peek(-1) right = self.equality() expr = Expr.Logical(expr, op, right) return expr
def _logical_and(self) -> ex.Expr: expr = self._equality() while self._match(TokenType.OR): op = self._previous right = self._equality() expr = ex.Logical(expr, op, right) return expr
def logical_or(self): expr = self.logical_and() while self.match(TokenType.OR_OR): op = self.peek(-1) right = self.logical_and() expr = Expr.Logical(expr, op, right) return expr
def _and(self) -> e.Expr: expr: e.Expr = self.equality() while self.match(TokenType.AND): operator: Token = self.previous() right: e.Expr = self.equality() expr = e.Logical(expr, operator, right) return expr
def _or(self) -> e.Expr: expr: e.Expr = self._and() while self.match(TokenType.OR): operator: Token = self.previous() right: e.Expr = self._and() expr = e.Logical(expr, operator, right) return expr
def _and(self): expr = self.equality() while self.match(TokenType.AND): operator = self.previous() right = self.equality() expr = Expr.Logical(expr, operator, right) return expr
def _or(self): expr = self._and() while self.match(TokenType.OR): operator = self.previous() right = self._and() expr = Expr.Logical(expr, operator, right) return expr