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:
@@ -716,6 +716,11 @@ pub const WORD_DOCS: &[(&str, &str, &str)] = &[
|
||||
"Read a line of input (unsupported here).",
|
||||
),
|
||||
("ABORT", "( i*x -- )", "Empty the stacks and abort."),
|
||||
(
|
||||
"QUIT",
|
||||
"( -- ) ( R: i*x -- )",
|
||||
"Empty the return stack, return to the interpreter; data stack kept.",
|
||||
),
|
||||
(
|
||||
"ABORT\"",
|
||||
"( flag -- )",
|
||||
|
||||
Reference in New Issue
Block a user