(self, args)
READ: read values from DATA statement.
READ: read values from DATA statement.
READ : read values from DATA statement .
def read_(self, args):
        """READ: read values from DATA statement."""
        data_error = False
        for name, indices in args:
            name = self._memory.complete_name(name)
            current = self._program_code.tell()
            self._program_code.seek(self.data_pos)
            if self._program_code.peek() in tk.END_STATEMENT:
                # initialise - find first DATA
                self._program_code.skip_to_token(tk.DATA,)
            if self._program_code.read(1) not in (tk.DATA, b','):
                self._program_code.seek(current)
                raise error.BASICError(error.OUT_OF_DATA)
            self._program_code.skip_blank()
            if name[-1:] == values.STR:
                # for unquoted strings, payload starts at the first non-empty character
                address = self._program_code.tell_address()
                word = self._program_code.read_to((b',', b'"',) + tk.END_STATEMENT)
                if self._program_code.peek() == b'"':
                    if word == b'':
                        # nothing before the quotes, so this is a quoted string literal
                        # string payload starts after quote
                        address = self._program_code.tell_address() + 1
                        word = self._program_code.read_string().strip(b'"')
                    else:
                        # complete unquoted string literal
                        word += self._program_code.read_string()
                    if (self._program_code.skip_blank() not in (tk.END_STATEMENT + (b',',))):
                        raise error.BASICError(error.STX)
                else:
                    word = word.strip(self._program_code.blanks)
                value = self._values.from_str_at(word, address)
            else:
                word = self._program_code.read_number()
                value = self._values.from_repr(word, allow_nonnum=False)
                # anything after the number is a syntax error, but assignment has taken place)
                if (self._program_code.skip_blank() not in (tk.END_STATEMENT + (b',',))):
                    data_error = True
            # restore to current program location
            # to ensure any other errors in set_variable get the correct line number
            data_pos = self._program_code.tell()
            self._program_code.seek(current)
            self._memory.set_variable(name, indices, value=value)
            if data_error:
                self._program_code.seek(self.data_pos)
                raise error.BASICError(error.STX)
            else:
                self.data_pos = data_pos
def read_ ( self , args ) : data_error = False for name , indices in args : name = self . _memory . complete_name ( name ) current = self . _program_code . tell ( ) self . _program_code . seek ( self . data_pos ) if self . _program_code . peek ( ) in tk . END_STATEMENT : # initialise - find first DATA self . _program_code . skip_to_token ( tk . DATA , ) if self . _program_code . read ( 1 ) not in ( tk . DATA , b',' ) : self . _program_code . seek ( current ) raise error . BASICError ( error . OUT_OF_DATA ) self . _program_code . skip_blank ( ) if name [ - 1 : ] == values . STR : # for unquoted strings, payload starts at the first non-empty character address = self . _program_code . tell_address ( ) word = self . _program_code . read_to ( ( b',' , b'"' , ) + tk . END_STATEMENT ) if self . _program_code . peek ( ) == b'"' : if word == b'' : # nothing before the quotes, so this is a quoted string literal # string payload starts after quote address = self . _program_code . tell_address ( ) + 1 word = self . _program_code . read_string ( ) . strip ( b'"' ) else : # complete unquoted string literal word += self . _program_code . read_string ( ) if ( self . _program_code . skip_blank ( ) not in ( tk . END_STATEMENT + ( b',' , ) ) ) : raise error . BASICError ( error . STX ) else : word = word . strip ( self . _program_code . blanks ) value = self . _values . from_str_at ( word , address ) else : word = self . _program_code . read_number ( ) value = self . _values . from_repr ( word , allow_nonnum = False ) # anything after the number is a syntax error, but assignment has taken place) if ( self . _program_code . skip_blank ( ) not in ( tk . END_STATEMENT + ( b',' , ) ) ) : data_error = True # restore to current program location # to ensure any other errors in set_variable get the correct line number data_pos = self . _program_code . tell ( ) self . _program_code . seek ( current ) self . _memory . set_variable ( name , indices , value = value ) if data_error : self . _program_code . seek ( self . data_pos ) raise error . BASICError ( error . STX ) else : self . data_pos = data_pos