Tobias Schlüter wrote:
Of course, life is not as simple as one would hope: in order to
determine if a branch is valid we have to know if the branch target is
an END {DO,SELECT,IF} statement (can someone point me to the relevant
quote in the standard, I couldn't seem to find it.
Quoting the 2003 Standard:
IF statement (page 156-157):
An ELSE IF statement or an ELSE statement shall not be a branch target
statement. It is permissible to branch to an END IF statement only from
with its IF construct.
CASE statement (page 159):
A CASE statement shall not be a branch target statement. It is
permissible to branch to an [END SELECT statement] only from within its
CASE construct.
DO statement (page 167):
In a block DO construct, a transfer of control to the [END DO statement]
has the same effect as execution of a CYCLE statement belonging to that
construct.
(page 168):
(4) Transfer of control from a statement within the range of a DO
construct to a statement that is neither the [END DO statement]
nor within the range of the same DO construct [terminates the
loop].
I think I've got them all ...