Merge branch 'master' of git://factorcode.org/git/factor

db4
Doug Coleman 2008-11-19 16:29:20 -06:00
commit c286d24d14
1 changed files with 15 additions and 13 deletions

View File

@ -69,20 +69,21 @@ TUPLE: no-current-vocab ;
: CREATE-WORD ( -- word ) CREATE dup reset-generic ; : CREATE-WORD ( -- word ) CREATE dup reset-generic ;
: word-restarts ( possibilities name -- restarts ) : word-restarts ( name possibilities -- restarts )
[
natural-sort natural-sort
[ [ [ "Use the " swap vocabulary>> " vocabulary" 3append ] keep ] { } map>assoc
[ "Use the " swap vocabulary>> " vocabulary" 3append ] keep swap "Defer word in current vocabulary" swap 2array
] { } map>assoc
]
[ "Defer word in current vocabulary" swap 2array ] bi*
suffix ; suffix ;
ERROR: no-word-error name ; ERROR: no-word-error name ;
: <no-word-error> ( name possibilities -- error restarts )
[ drop \ no-word-error boa ] [ word-restarts ] 2bi ;
SYMBOL: amended-use? SYMBOL: amended-use?
SYMBOL: do-what-i-mean?
: no-word-restarted ( restart-value -- word ) : no-word-restarted ( restart-value -- word )
dup word? dup word?
[ amended-use? on dup vocabulary>> (use+) ] [ amended-use? on dup vocabulary>> (use+) ]
@ -90,10 +91,11 @@ SYMBOL: amended-use?
if ; if ;
: no-word ( name -- newword ) : no-word ( name -- newword )
dup \ no-word-error boa dup words-named [ forward-reference? not ] filter
swap [ words-named [ forward-reference? not ] filter ] keep dup length 1 = do-what-i-mean? get and
word-restarts throw-restarts [ nip first no-word-restarted ]
no-word-restarted ; [ <no-word-error> throw-restarts no-word-restarted ]
if ;
: check-forward ( str word -- word/f ) : check-forward ( str word -- word/f )
dup forward-reference? [ dup forward-reference? [
@ -226,7 +228,7 @@ SYMBOL: interactive-vocabs
SYMBOL: print-use-hook SYMBOL: print-use-hook
[ ] print-use-hook set-global print-use-hook global [ [ ] or ] change-at
: parse-fresh ( lines -- quot ) : parse-fresh ( lines -- quot )
[ [