Closed udhos closed 5 years ago
This should be a simple fix, unfortunately it is a little harder than it might be.
runIF()
has the code to handle the comparison, and handle the execution of the "TRUE" or "FALSE" branches. Currently both actions result in a call to RunOnce()
- that can process any kind of instruction.
So to handle "IF 1 < 10 THEN 300 [ELSE 400]
" we'd need to add a special case before invoking RunOnce()
. Just looking ahead one-token for token.INT
should suffice. (On both branches.)
Probably best to add a boolean parameter :
RunOnce( int_is_goto bool )
That will change the behavior of the default
branch.
Then after that invoke runGOTOTarget(value)
which will handle the line-lookup, and change of control-flow. (Moving code from runGOTO()
into there.)
I left this for a week to see if a volunteer would handle it; since they didn't I'll do it this evening.
It occurred to me I can implement it in a slightly hacky way, while requiring fewer changes :)
Support for IF cond THEN line-number
Example:
210 IF D=2 THEN 260