Esempio n. 1
0
    def ParseExpr(self):
        # type: () -> expr_t

        #log('ParseExpr')
        node = self.ParseTerm()

        while self.tok_type == tok_e.Op1:
            op = self.tok_val
            self.Next()
            n2 = self.ParseTerm()
            node = expr__Binary(op, node, n2)
        return node
Esempio n. 2
0
    def ParseTerm(self):
        # type: () -> expr_t

        #log('ParseTerm')
        node = self.ParseFactor()

        # TODO: Iterate and create nodes
        while self.tok_type == tok_e.Op2:
            op = self.tok_val
            self.Next()
            n2 = self.ParseFactor()
            node = expr__Binary(op, node, n2)
        return node