(self, from_line, to_line)
return lines
List line range.
List line range.
List line range .
def list_lines(self, from_line, to_line):
        """List line range."""
        from_line, to_line = self.explicit_lines(from_line, to_line)
        if self.protected:
            # don't list protected files
            raise error.BASICError(error.IFC)
        # 65529 is max insertable line number for GW-BASIC 3.23.
        # however, 65530-65535 are executed if present in tokenised form.
        # in GW-BASIC, 65530 appears in LIST, 65531 and above are hidden
        if to_line is None:
            to_line = self.max_list_line
        numbers = [
            num for num in self.line_numbers
            if (from_line is None or num >= from_line) and num <= to_line
        ]
        # sort by positions, not line numbers!
        listable = sorted([self.line_numbers[num] for num in numbers])
        if numbers:
            self.last_stored = max(numbers)
        lines = []
        for pos in listable:
            self.bytecode.seek(pos + 1)
            _, line, _ = self.lister.detokenise_line(self.bytecode)
            lines.append(bytes(line))
        return lines
def list_lines ( self , from_line , to_line ) : from_line , to_line = self . explicit_lines ( from_line , to_line ) if self . protected : # don't list protected files raise error . BASICError ( error . IFC ) # 65529 is max insertable line number for GW-BASIC 3.23. # however, 65530-65535 are executed if present in tokenised form. # in GW-BASIC, 65530 appears in LIST, 65531 and above are hidden if to_line is None : to_line = self . max_list_line numbers = [ num for num in self . line_numbers if ( from_line is None or num >= from_line ) and num <= to_line ] # sort by positions, not line numbers! listable = sorted ( [ self . line_numbers [ num ] for num in numbers ] ) if numbers : self . last_stored = max ( numbers ) lines = [ ] for pos in listable : self . bytecode . seek ( pos + 1 ) _ , line , _ = self . lister . detokenise_line ( self . bytecode ) lines . append ( bytes ( line ) ) return lines