From 8a50d07eef01e652a8532cc79e8d2fbd8cb7c0be Mon Sep 17 00:00:00 2001 From: Andrew Kesterson Date: Sat, 1 Aug 2026 16:52:47 -0400 Subject: [PATCH] Add the new refusal to the error-code appendix 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) --- docs/15-error-codes.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/15-error-codes.md b/docs/15-error-codes.md index 57d3339..11067e9 100644 --- a/docs/15-error-codes.md +++ b/docs/15-error-codes.md @@ -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`. |