diff --git a/core/parser/parser-docs.factor b/core/parser/parser-docs.factor index 4d200c17d2..cc4e2c0a42 100755 --- a/core/parser/parser-docs.factor +++ b/core/parser/parser-docs.factor @@ -333,12 +333,14 @@ HELP: CREATE { $errors "Throws an error if the end of the line is reached." } $parsing-note ; -HELP: no-word -{ $values { "name" string } { "newword" word } } -{ $description "Throws a " { $link no-word } " error." } +HELP: no-word-error { $error-description "Thrown if the parser encounters a token which does not name a word in the current vocabulary search path. If any words with this name exist in vocabularies not part of the search path, a number of restarts will offer to add those vocabularies to the search path and use the chosen word." } { $notes "Apart from a missing " { $link POSTPONE: USE: } ", this error can also indicate an ordering issue. In Factor, words must be defined before they can be called. Mutual recursion can be implemented via " { $link POSTPONE: DEFER: } "." } ; +HELP: no-word +{ $values { "name" string } { "newword" word } } +{ $description "Throws a " { $link no-word-error } "." } ; + HELP: search { $values { "str" string } { "word/f" "a word or " { $link f } } } { $description "Searches for a word by name in the current vocabulary search path. If no such word could be found, outputs " { $link f } "." } diff --git a/core/parser/parser.factor b/core/parser/parser.factor index 6bae4e95b4..6e5023f74a 100755 --- a/core/parser/parser.factor +++ b/core/parser/parser.factor @@ -252,13 +252,13 @@ PREDICATE: unexpected-eof < unexpected [ "Use the word " swap summary append ] keep ] { } map>assoc ; -TUPLE: no-word name ; +ERROR: no-word-error name ; -M: no-word summary +M: no-word-error summary drop "Word not found in current vocabulary search path" ; : no-word ( name -- newword ) - dup \ no-word construct-boa + dup no-word-error construct-boa swap words-named [ forward-reference? not ] subset word-restarts throw-restarts dup word-vocabulary (use+) ;