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

Method __nextstmt

PyBasic/basicparser.py:1284–1303  ·  view source on GitHub ↗

Processes a NEXT statement that terminates a loop :return: A FlowSignal indicating that a loop has been processed

(self)

Source from the content-addressed store, hash-verified

1282 return FlowSignal(ftype=FlowSignal.LOOP_BEGIN,floop_var=loop_variable)
1283
1284 def __nextstmt(self):
1285 """Processes a NEXT statement that terminates
1286 a loop
1287
1288 :return: A FlowSignal indicating that a loop
1289 has been processed
1290
1291 """
1292
1293 self.__advance() # Advance past NEXT token
1294
1295 # Process the loop variable initialisation
1296 loop_variable = self.__token.lexeme # Save lexeme of
1297 # the current token
1298
1299 if loop_variable.endswith('$'):
1300 raise SyntaxError('Syntax error: Loop variable is not numeric' +
1301 ' in line ' + str(self.__line_number))
1302
1303 return FlowSignal(ftype=FlowSignal.LOOP_REPEAT,floop_var=loop_variable)
1304
1305 def __ongosubstmt(self):
1306 """Process the ON-GOSUB/GOTO statement

Callers 1

__compoundstmtMethod · 0.95

Calls 2

__advanceMethod · 0.95
FlowSignalClass · 0.90

Tested by

no test coverage detected