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

Class FlowSignal

PyBasic/flowsignal.py:34–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32
33
34class FlowSignal:
35
36 # Jump categories
37
38 # Indicates a simple jump as the result
39 # of a GOTO or conditional branch. The
40 # ftarget value should be the jump target, i.e.
41 # the line number being jumped to
42 SIMPLE_JUMP = 0
43
44 # Indicates a subroutine call where the
45 # return address must be the line number of the instruction
46 # of the following the call.
47 # The ftarget value should be the line number of the first line
48 # of the subroutine
49 GOSUB = 1
50
51 # Indicates the start of a FOR loop where loop
52 # variable has not reached the end value, and therefore the loop
53 # must be repeated. There should be therefore be
54 # no ftarget value associated with it
55 LOOP_BEGIN = 2
56
57 # An indication from a processed NEXT statement that the loop is to
58 # be repeated. Since the return address is already on the stack,
59 # there does not need to be an ftarget value associated with the signal.
60 LOOP_REPEAT = 3
61
62 # An indication from a FOR statement that the loop should be skipped because
63 # loop variable has reached its end value. The ftarget should be
64 # the loop variable to look for in the terminating NEXT statement
65 LOOP_SKIP = 4
66
67 # Indicates a subroutine return has been processed, where the return
68 # address is on the return stack. There should be therefore
69 # be no ftarget value specified
70 RETURN = 5
71
72 # Indicates that execution should cease because a stop statement has
73 # been processed. There should be therefore be no ftarget value specified
74 STOP = 6
75
76 # Indicates that a conditional result block should be executed
77 EXECUTE = 7
78
79 def __init__(self, ftarget=None, ftype=SIMPLE_JUMP, floop_var=None):
80 """Creates a new FlowSignal for a branch. If the jump
81 target is supplied, then the branch is assumed to be
82 either a GOTO or conditional branch and the type is assigned as
83 SIMPLE_JUMP. If no jump_target is supplied, then a jump_type must be
84 supplied, which must either be GOSUB, RETURN, LOOP_BEGIN,
85 LOOP_REPEAT, LOOP_SKIP or STOP. In the latter cases
86 the jump target is assigned an arbitrary value of None.
87
88 :param ftarget: The associated value
89 :param ftype: Either GOSUB, SIMPLE_JUMP, RETURN, LOOP_BEGIN,
90 LOOP_SKIP or STOP
91 """

Callers 10

__executeMethod · 0.90
__gotostmtMethod · 0.90
__gosubstmtMethod · 0.90
__returnstmtMethod · 0.90
__stopstmtMethod · 0.90
__openstmtMethod · 0.90
__ifstmtMethod · 0.90
__forstmtMethod · 0.90
__nextstmtMethod · 0.90
__ongosubstmtMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected