(self, ins)
Parse OPEN second ('new') syntax.
Parse OPEN second ('new') syntax.
Parse OPEN second ( new ) syntax .
def _parse_open_second(self, ins):
        """Parse OPEN second ('new') syntax."""
        # mode clause
        if ins.skip_blank_read_if((tk.FOR,)):
            # read mode word
            if ins.skip_blank_read_if((tk.INPUT,)):
                yield b'I'
            else:
                mode_dict = {tk.W_OUTPUT: b'O', tk.W_RANDOM: b'R', tk.W_APPEND: b'A'}
                word = ins.skip_blank_read_if(mode_dict, 6)
                if word is not None:
                    yield mode_dict[word]
                else:
                    raise error.BASICError(error.STX)
        else:
            yield None
        # ACCESS clause
        if ins.skip_blank_read_if((tk.W_ACCESS,), 6):
            yield self._parse_read_write(ins)
        else:
            yield None
        # LOCK clause
        if ins.skip_blank_read_if((tk.LOCK,), 2):
            yield self._parse_read_write(ins)
        else:
            yield ins.skip_blank_read_if((tk.W_SHARED,), 6)
        # AS file number clause
        ins.require_read((tk.W_AS,))
        ins.skip_blank_read_if((b'#',))
        yield self.parse_expression(ins)
        # LEN clause
        if ins.skip_blank_read_if((tk.LEN,), 2):
            ins.require_read((tk.O_EQ,))
            yield self.parse_expression(ins)
        else:
            yield None
def _parse_open_second ( self , ins ) : # mode clause if ins . skip_blank_read_if ( ( tk . FOR , ) ) : # read mode word if ins . skip_blank_read_if ( ( tk . INPUT , ) ) : yield b'I' else : mode_dict = { tk . W_OUTPUT : b'O' , tk . W_RANDOM : b'R' , tk . W_APPEND : b'A' } word = ins . skip_blank_read_if ( mode_dict , 6 ) if word is not None : yield mode_dict [ word ] else : raise error . BASICError ( error . STX ) else : yield None # ACCESS clause if ins . skip_blank_read_if ( ( tk . W_ACCESS , ) , 6 ) : yield self . _parse_read_write ( ins ) else : yield None # LOCK clause if ins . skip_blank_read_if ( ( tk . LOCK , ) , 2 ) : yield self . _parse_read_write ( ins ) else : yield ins . skip_blank_read_if ( ( tk . W_SHARED , ) , 6 ) # AS file number clause ins . require_read ( ( tk . W_AS , ) ) ins . skip_blank_read_if ( ( b'#' , ) ) yield self . parse_expression ( ins ) # LEN clause if ins . skip_blank_read_if ( ( tk . LEN , ) , 2 ) : ins . require_read ( ( tk . O_EQ , ) ) yield self . parse_expression ( ins ) else : yield None