Commit edee20ff authored by Luke Plant's avatar Luke Plant
Browse files

Reverted part of 169b1a40 which was mistakenly applied to a non-iterator class.

Doing next(IfParser()) works for Python 2.7, because it calls
IfParser.next(), but in Python 3 will call IfParser.__next__() which does
not work since it is not an iterator and does not have that method.
parent 023b7041
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -165,7 +165,7 @@ class IfParser(object):

        self.tokens = mapped_tokens
        self.pos = 0
        self.current_token = next(self)
        self.current_token = self.next()

    def translate_token(self, token):
        try:
@@ -193,11 +193,11 @@ class IfParser(object):

    def expression(self, rbp=0):
        t = self.current_token
        self.current_token = next(self)
        self.current_token = self.next()
        left = t.nud(self)
        while rbp < self.current_token.lbp:
            t = self.current_token
            self.current_token = next(self)
            self.current_token = self.next()
            left = t.led(left, self)
        return left