def save_frame(self, _parent=None): _context = self.Context(_parent, self._scanner, self._pos, 'save_frame', []) save_heading = self._scan('save_heading') savehead = save_heading[5:] savebc = StarFile() savebc.NewBlock(savehead, StarBlock(overwrite=False)) while self._peek( 'save_end', 'save_heading', 'LBLOCK', 'data_name', 'END', 'data_heading') in ['save_heading', 'LBLOCK', 'data_name']: _token = self._peek('save_heading', 'LBLOCK', 'data_name') if _token != 'save_heading': dataseq = self.dataseq(savebc[savehead], _context) else: # == 'save_heading' save_frame = self.save_frame(_context) savebc.merge_fast(save_frame, parent=savehead) if self._peek() not in [ 'save_end', 'save_heading', 'LBLOCK', 'data_name', 'END', 'data_heading' ]: raise yappsrt.SyntaxError( charpos=self._scanner.get_prev_char_pos(), context=_context, msg='Need one of ' + ', '.join([ 'save_end', 'save_heading', 'LBLOCK', 'data_name', 'END', 'data_heading' ])) save_end = self._scan('save_end') return monitor('save_frame', savebc)
def dblock(self, prepared, _parent=None): _context = self.Context(_parent, self._scanner, self._pos, 'dblock', [prepared]) data_heading = self._scan('data_heading') heading = data_heading[5:] thisbc = StarFile(characterset='unicode', standard=prepared.standard) thisbc.NewBlock(heading, StarBlock(overwrite=False)) while self._peek( 'save_heading', 'LBLOCK', 'data_name', 'save_end', 'END', 'data_heading') in ['save_heading', 'LBLOCK', 'data_name']: _token = self._peek('save_heading', 'LBLOCK', 'data_name') if _token != 'save_heading': dataseq = self.dataseq(thisbc[heading], _context) else: # == 'save_heading' save_frame = self.save_frame(_context) thisbc.merge_fast(save_frame, parent=heading) if self._peek() not in [ 'save_heading', 'LBLOCK', 'data_name', 'save_end', 'END', 'data_heading' ]: raise yappsrt.SyntaxError( charpos=self._scanner.get_prev_char_pos(), context=_context, msg='Need one of ' + ', '.join([ 'save_heading', 'LBLOCK', 'data_name', 'save_end', 'END', 'data_heading' ])) thisbc[heading].setmaxnamelength(thisbc[heading].maxnamelength) return (monitor('dblock', thisbc))