Add the new refusal to the error-code appendix
Some checks failed
akbasic CI Build / cmake_build (push) Failing after 3m11s
akbasic CI Build / sanitizers (push) Failing after 3m59s
akbasic CI Build / coverage (push) Failing after 3m26s
akbasic CI Build / akgl_build (push) Failing after 20s
akbasic CI Build / mutation_test (push) Failing after 3m16s

512 gains its new cause: a branch by number to a line the program did not
number. PARSE ERROR is what the prescans report as, since they run before
any statement does, so the class table says so.

514 claimed a branch to a line that does not exist raises it. Nothing does
-- AKBASIC_ERR_UNDEFINED comes from label, variable, field and host-struct
lookups only, and GOTO 500 with no line 500 walks to the end and stops.
That was already wrong before this work; it is more visible now that a
branch to a line that does exist can be refused.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-01 16:52:47 -04:00
parent 86669aee38
commit 8a50d07eef

View File

@@ -27,7 +27,7 @@ you get says *when* the interpreter gave up rather than what was wrong:
| Class | Raised when |
|---|---|
| `PARSE ERROR` | The line could not be turned into a statement. Nothing on it ran. |
| `PARSE ERROR` | The line could not be turned into a statement. Nothing on it ran. Also what the four prescans report as, since they run before any statement does. |
| `SYNTAX ERROR` | A statement was well-formed but not a legal one here. |
| `RUNTIME ERROR` | A statement ran and failed. The commonest by a wide margin. |
| `IO ERROR` | Reading the program itself failed — not a file a program opened, which is a `RUNTIME ERROR` like any other. |
@@ -80,9 +80,9 @@ owns the block 512 to 767 and uses the first eight of it.
| Code | `ERR()` text | What raises it |
|---|---|---|
| 512 | `Syntax Error` | A line that will not parse, a verb given the wrong shape of arguments, a keyword where a value belongs. The commonest code and the only one that can arrive before a statement runs. |
| 512 | `Syntax Error` | A line that will not parse, a verb given the wrong shape of arguments, a keyword where a value belongs, or a branch by number to a line the program did not number. The commonest code and the only one that can arrive before a statement runs. |
| 513 | `Type Error` | A string where a number belongs or the reverse — `LEFT(1, 2)`, `A$ = 1 + "X"` used as a number, a non-integer array subscript. |
| 514 | `Undefined Reference` | A branch to a label or line that does not exist, or a call to a function that was never defined. |
| 514 | `Undefined Reference` | A branch to a label that does not exist, or a call to a function that was never defined. A branch to a *line* that does not exist raises nothing at all: `GOTO 500` with no line 500 walks to the end of the program and stops, which is the same answer `RENUMBER` gives such a branch. |
| 515 | `Out Of Bounds` | An array subscript past the end, a colour index outside 1 to 16, a sprite number outside 1 to 8, a `RGR` or `RSPRITE` field number that is not a field. |
| 516 | `Environment Error` | The scope pool is exhausted — 32 nested `GOSUB`, `FOR` or `DEF` bodies. **See below: this is the one code you cannot usefully trap.** |
| 517 | `Value Error` | A number that is the wrong number: division by zero, a negative `SCALE` maximum, a string longer than 255 characters, a `GSHAPE` handed a string that did not come from `SSHAPE`. |