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

Method __execute

PyBasic/program.py:281–320  ·  view source on GitHub ↗

Execute the statement with the specified line number :param line_number: The line number :return: The FlowSignal to indicate to the program how to branch if necessary, None otherwise

(self, line_number, infile,tmpfile)

Source from the content-addressed store, hash-verified

279 return statement
280
281 def __execute(self, line_number, infile,tmpfile):
282 """Execute the statement with the
283 specified line number
284
285 :param line_number: The line number
286
287 :return: The FlowSignal to indicate to the program
288 how to branch if necessary, None otherwise
289
290 """
291 if line_number not in self.__program.keys():
292 raise RuntimeError("Line number " + line_number +
293 " does not exist")
294
295 statement = self.getprogram(line_number,infile,tmpfile)
296
297 number_of_stmts = 1
298 for e in statement:
299 if e.category == Token.COLON:
300 number_of_stmts += 1
301 elif e.category == Token.IF:
302 # any colons after an IF statement are seperators for the THEN or ELSE clause
303 # and will be processed by the recursive call to PARSE within the PARSE method
304 break
305
306 for cstmt_number in range(0,number_of_stmts):
307 try:
308 #if True:
309 tmp_flow = self.__parser.parse(statement, line_number, cstmt_number, infile, tmpfile, self.__data)
310
311 except RuntimeError as err:
312 raise RuntimeError(str(err))
313
314 except KeyboardInterrupt:
315 return FlowSignal(ftype=FlowSignal.STOP)
316
317 if tmp_flow:
318 break
319
320 return tmp_flow
321
322
323 def execute(self,infile,tmpfile):

Callers 1

executeMethod · 0.95

Calls 4

getprogramMethod · 0.95
FlowSignalClass · 0.90
keysMethod · 0.80
parseMethod · 0.80

Tested by

no test coverage detected