feat(core): QUIT
The CORE word was missing. QUIT empties the return stack, enters interpretation state, restores SOURCE-ID to the user input device and returns to the interpreter without a message, leaving the data stack untouched -- that last part is the whole difference to ABORT, which the standard defines as 'empty the data stack, then QUIT'. Implemented on the throw plumbing with the standard code -56, so nested EVALUATE / INCLUDE frames unwind and are abandoned on the way out. Two places treat -56 specially: CATCH lets it through (QUIT is a return to the prompt, not an exception) and evaluate() turns it into a silent Ok after the compile-state wipe it already performs. Semantics checked against gforth 0.7.3 and SwiftForth sf64, which agree: the data stack survives, nothing is printed, the rest of the input is abandoned, and '1 2 ' QUIT CATCH .' prints nothing while leaving 1 2. Six tests in outer.rs pin it. Deliberately NOT added to the cross-engine corpus: what QUIT abandons is the input source, and the three engines are fed differently there, so a comparison would measure the harness. The gap survived because the Forth 2012 suite skips QUIT by its own admission, and HELP's coverage lint compares dictionary against docs -- a word missing from both looks complete. docs/wafer-anki.txt had been documenting QUIT as if it existed. ABORT itself was already correct: executed while a definition is open it clears both stacks and returns to interpretation state. Ships as v0.2.5.
This commit is contained in:
@@ -468,6 +468,11 @@ fn programs() -> Vec<Program> {
|
||||
expected: "-1 \n-1 \n42 \n-1 \n",
|
||||
category: Category::Definitions,
|
||||
},
|
||||
// QUIT is deliberately absent from this corpus: what it abandons is
|
||||
// "the input source", and each engine here is fed differently (wafer
|
||||
// line by line, gforth from a file, sf64 from a prompting stdin), so
|
||||
// a comparison would measure the harness. Its semantics are pinned by
|
||||
// the QUIT tests in outer.rs, checked by hand against both engines.
|
||||
// -- Strings --
|
||||
Program {
|
||||
name: "s-quote-type",
|
||||
|
||||
Reference in New Issue
Block a user