MCPcopy Create free account
hub / github.com/RetiredWizard/PyDOS / __closestmt

Method __closestmt

PyBasic/basicparser.py:705–724  ·  view source on GitHub ↗

Parses a close, closes the file and removes the file handle from the handle table

(self)

Source from the content-addressed store, hash-verified

703 return None
704
705 def __closestmt(self):
706 """Parses a close, closes the file and removes
707 the file handle from the handle table
708
709 """
710
711 self.__advance() # Advance past CLOSE token
712
713 # Process the # keyword
714 self.__consume(Token.HASH)
715
716 # Acquire the file number
717 self.__expr()
718 filenum = self.__operand_stack.pop()
719
720 if self.__file_handles.get(filenum) == None:
721 raise RuntimeError("CLOSE: file #"+str(filenum)+" not opened in line " + str(self.__line_number))
722
723 self.__file_handles[filenum].close()
724 self.__file_handles.pop(filenum)
725
726 def __fseekstmt(self):
727 """Parses an fseek statement, seeks the indicated file position

Callers 1

__simplestmtMethod · 0.95

Calls 5

__advanceMethod · 0.95
__consumeMethod · 0.95
__exprMethod · 0.95
getMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected