(self, varname=None)
return not loop_ends
Iterate a loop (NEXT).
Iterate a loop (NEXT).
Iterate a loop ( NEXT ) .
def iterate_loop(self, varname=None):
        """Iterate a loop (NEXT)."""
        ins = self.get_codestream()
        # record the location after the variable
        pos = ins.tell()
        # find the matching NEXT record
        num = len(self.for_stack)
        for depth in range(num):
            varname2, stop, step, sgn, forpos, nextpos = self.for_stack[-depth-1]
            if pos == nextpos:
                if varname is not None and varname2 != self._memory.complete_name(varname):
                    # check once more for matches
                    # it has been checked at FOR, but DEFtypes may have changed.
                    raise error.BASICError(error.NEXT_WITHOUT_FOR)
                # only drop NEXT record if we've found a matching one
                self.for_stack = self.for_stack[:len(self.for_stack)-depth]
                break
        else:
            raise error.BASICError(error.NEXT_WITHOUT_FOR)
        # increment counter
        counter_view = self._scalars.view(varname2)
        counter_view.iadd(step)
        # check condition
        loop_ends = counter_view.gt(stop) if sgn > 0 else stop.gt(counter_view)
        if loop_ends:
            self.for_stack.pop()
        else:
            ins.seek(forpos)
        return not loop_ends
def iterate_loop ( self , varname = None ) : ins = self . get_codestream ( ) # record the location after the variable pos = ins . tell ( ) # find the matching NEXT record num = len ( self . for_stack ) for depth in range ( num ) : varname2 , stop , step , sgn , forpos , nextpos = self . for_stack [ - depth - 1 ] if pos == nextpos : if varname is not None and varname2 != self . _memory . complete_name ( varname ) : # check once more for matches # it has been checked at FOR, but DEFtypes may have changed. raise error . BASICError ( error . NEXT_WITHOUT_FOR ) # only drop NEXT record if we've found a matching one self . for_stack = self . for_stack [ : len ( self . for_stack ) - depth ] break else : raise error . BASICError ( error . NEXT_WITHOUT_FOR ) # increment counter counter_view = self . _scalars . view ( varname2 ) counter_view . iadd ( step ) # check condition loop_ends = counter_view . gt ( stop ) if sgn > 0 else stop . gt ( counter_view ) if loop_ends : self . for_stack . pop ( ) else : ins . seek ( forpos ) return not loop_ends