(self, ins, varname)
return endforpos, nextpos
Helper function for FOR: find matching NEXT.
Helper function for FOR: find matching NEXT.
Helper function for FOR : find matching NEXT .
def _find_next(self, ins, varname):
        """Helper function for FOR: find matching NEXT."""
        endforpos = ins.tell()
        ins.skip_block(tk.FOR, tk.NEXT, allow_comma=True)
        if ins.skip_blank() not in (tk.NEXT, b','):
            # FOR without NEXT marked with FOR line number
            ins.seek(endforpos)
            raise error.BASICError(error.FOR_WITHOUT_NEXT)
        comma = (ins.read(1) == b',')
        # check var name for NEXT
        # no-var only allowed in standalone NEXT
        if ins.skip_blank() not in tk.END_STATEMENT:
            varname2 = self._memory.complete_name(self.parser.parse_name(ins))
        else:
            varname2 = None
        # get position and line number just after the matching variable in NEXT
        nextpos = ins.tell()
        if (comma or varname2) and varname2 != varname:
            # NEXT without FOR marked with NEXT line number, while we're only at FOR
            raise error.BASICError(error.NEXT_WITHOUT_FOR)
        ins.seek(endforpos)
        return endforpos, nextpos
def _find_next ( self , ins , varname ) : endforpos = ins . tell ( ) ins . skip_block ( tk . FOR , tk . NEXT , allow_comma = True ) if ins . skip_blank ( ) not in ( tk . NEXT , b',' ) : # FOR without NEXT marked with FOR line number ins . seek ( endforpos ) raise error . BASICError ( error . FOR_WITHOUT_NEXT ) comma = ( ins . read ( 1 ) == b',' ) # check var name for NEXT # no-var only allowed in standalone NEXT if ins . skip_blank ( ) not in tk . END_STATEMENT : varname2 = self . _memory . complete_name ( self . parser . parse_name ( ins ) ) else : varname2 = None # get position and line number just after the matching variable in NEXT nextpos = ins . tell ( ) if ( comma or varname2 ) and varname2 != varname : # NEXT without FOR marked with NEXT line number, while we're only at FOR raise error . BASICError ( error . NEXT_WITHOUT_FOR ) ins . seek ( endforpos ) return endforpos , nextpos