Exemplo n.º 1
0
 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
Exemplo n.º 2
0
 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
Exemplo n.º 3
0
 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
Exemplo n.º 4
0
    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
Exemplo n.º 5
0
    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
Exemplo n.º 6
0
    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
Exemplo n.º 7
0
    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