refactor(interp): move control-flow signals and label search out of Interpreter
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Thu, 3 Sep 2026 20:55:40 +0000 (23:55 +0300)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Thu, 3 Sep 2026 20:55:40 +0000 (23:55 +0300)
commitd78fea147c5502bd6dd35d97f2bb81388d05ea9d
tree68a4aa3350853d9ff9f356eff9dce20be2baf080
parentc9b7951a734fb0a23bfcbd8cf0f290d384adb417
refactor(interp): move control-flow signals and label search out of Interpreter

The GOTO/GOSUB plumbing (jump exception types, the GosubFrame chain,
nested-label search) sat inline in Interpreter between the variable
cell model and the statement dispatch, where it read as noise around
statement semantics.

- Jumps.java groups the seven stackless control-flow signals
  (ExitJump, GotoJump, GosubJump, GosubReturnJump, ResumeJump,
  ProgramEnd, GosubFrame) with their semantics documented once, up
  front
- LabelSearch.java holds the pure Ast utilities (findNestedLabel,
  childListsOf, indexOfIdentity) — no interpreter state involved

resumeNestedLabel/resumeChain/continueLoopAfterResume stay in
Interpreter: they are interlocked with execBlockFrom's pc loop and
the GOSUB rebuild state, and moving them would distort rather than
clarify. Also fixes a doubled/orphan javadoc above the old GosubFrame.

Verification: 93/93 tests green (the suite covers nested-label GOTO
and cross-block GOSUB/RETURN); EDPAT (EXIT DO) and BAR re-run
pixel-identical.
src/main/java/eu/svjatoslav/crtbasic/interp/Interpreter.java
src/main/java/eu/svjatoslav/crtbasic/interp/Jumps.java [new file with mode: 0644]
src/main/java/eu/svjatoslav/crtbasic/interp/LabelSearch.java [new file with mode: 0644]