Parses a close, closes the file and removes the file handle from the handle table
(self)
| 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 |