Rename vocab to lookup-vocab

db4
Doug Coleman 2011-10-24 05:37:47 -05:00
parent 3d65fbf1c7
commit 26872ffe4d
26 changed files with 59 additions and 59 deletions

View File

@ -9,7 +9,7 @@ IN: bootstrap.help
t load-help? set-global
[ dup vocab [ ] [ no-vocab ] ?if ] load-vocab-hook [
[ dup lookup-vocab [ ] [ no-vocab ] ?if ] load-vocab-hook [
dictionary get values
[ docs-loaded?>> not ] filter
[ load-docs ] each

View File

@ -1,7 +1,7 @@
USING: kernel vocabs vocabs.loader sequences system ;
{ "ui" "help" "tools" }
[ "bootstrap." prepend vocab ] all? [
[ "bootstrap." prepend lookup-vocab ] all? [
"ui.tools" require
{ "ui.backend.cocoa" } "ui.backend.cocoa.tools" require-when

View File

@ -47,7 +47,7 @@ M: object edit
M: link edit name>> edit ;
M: string edit
dup vocab [ edit ] [ cannot-find-source ] ?if ;
dup lookup-vocab [ edit ] [ cannot-find-source ] ?if ;
: edit-error ( error -- )
[ error-file ] [ error-line ] bi

View File

@ -108,7 +108,7 @@ SYMBOL: vocab-articles
] each ;
: vocab-exists? ( name -- ? )
[ vocab ] [ all-vocabs get member? ] bi or ;
[ lookup-vocab ] [ all-vocabs get member? ] bi or ;
: check-modules ( element -- )
\ $vocab-link swap elements [

View File

@ -269,7 +269,7 @@ PRIVATE>
[ [ ($link) ] textual-list ] ($span) ;
: $vocab-links ( vocabs -- )
[ vocab ] map $links ;
[ lookup-vocab ] map $links ;
: $breadcrumbs ( topics -- )
[ [ ($link) ] " > " (textual-list) ] ($span) ;

View File

@ -12,7 +12,7 @@ FROM: vocabs.hierarchy => child-vocabs ;
IN: help.vocabs
: about ( vocab -- )
[ require ] [ vocab help ] bi ;
[ require ] [ lookup-vocab help ] bi ;
: vocab-row ( vocab -- row )
[ <$pretty-link> ] [ vocab-summary ] bi 2array ;
@ -226,7 +226,7 @@ C: <vocab-author> vocab-author
: describe-words ( vocab -- )
{
{ [ dup vocab ] [ words $words ] }
{ [ dup lookup-vocab ] [ words $words ] }
{ [ dup find-vocab-root ] [ vocab-is-not-loaded ] }
[ drop ]
} cond ;

View File

@ -190,9 +190,9 @@ SYMBOL: interactive-vocabs
: only-use-vocabs ( vocabs -- )
clear-manifest
[ vocab ] filter
[ lookup-vocab ] filter
[
vocab
lookup-vocab
[ find-vocab-root not ]
[ source-loaded?>> +done+ eq? ] bi or
] filter

View File

@ -47,7 +47,7 @@ M: word print-stack-effect? drop t ;
<PRIVATE
: seeing-word ( word -- )
vocabulary>> dup [ vocab ] when pprinter-in set ;
vocabulary>> dup [ lookup-vocab ] when pprinter-in set ;
: word-synopsis ( word -- )
{

View File

@ -56,7 +56,7 @@ IN: tools.profiler
: vocab-profile. ( vocab -- )
"Call counts for words in the " write
dup dup vocab write-object
dup dup lookup-vocab write-object
" vocabulary:" print
words counters counters. ;

View File

@ -136,7 +136,7 @@ SYMBOL: forget-tests?
[ [ [ forget-source ] each ] with-compilation-unit ] [ drop ] if ;
: test-vocab ( vocab -- )
vocab dup [
lookup-vocab dup [
dup source-loaded?>> [
vocab-tests
[ [ run-test-file ] each ]

View File

@ -79,7 +79,7 @@ M: browser-gadget handle-gesture
{
[ key? ]
[ [ dup word-link? [ name>> ] when ] dip key? ]
[ [ dup vocab-link? [ vocab ] when ] dip key? ]
[ [ dup vocab-link? [ lookup-vocab ] when ] dip key? ]
} 2|| ;
M: browser-gadget definitions-changed ( assoc browser -- )

View File

@ -50,7 +50,7 @@ M: interactor manifest>>
] if ;
: vocab-exists? ( name -- ? )
'[ _ { [ vocab ] [ find-vocab-root ] } 1|| ] [ drop f ] recover ;
'[ _ { [ lookup-vocab ] [ find-vocab-root ] } 1|| ] [ drop f ] recover ;
GENERIC: (word-at-caret) ( token completion-mode -- obj )

View File

@ -95,7 +95,7 @@ M: method-renderer column-titles drop { "" "Method" "Count" } ;
[ <model> ] dip <profiler-model> [ f prefix ] <arrow> ;
: <vocabs-model> ( profiler -- model )
[ vocab-counters [ [ vocab ] dip ] assoc-map ] dip
[ vocab-counters [ [ lookup-vocab ] dip ] assoc-map ] dip
<profiler-filter-model> ;
: <generic-model> ( profiler -- model )

View File

@ -9,7 +9,7 @@ IN: vocabs.errors
: vocab-heading. ( vocab -- )
nl
"==== " write
[ vocab-name ] [ vocab write-object ] bi ":" print
[ vocab-name ] [ lookup-vocab write-object ] bi ":" print
nl ;
: load-error. ( triple -- )
@ -32,4 +32,4 @@ PRIVATE>
recover
] each
failures get
] with-scope ;
] with-scope ;

View File

@ -3,7 +3,7 @@ USING: tools.test vocabs.files vocabs arrays grouping ;
[ t ] [
"kernel" vocab-files
"kernel" vocab vocab-files
"kernel" lookup-vocab vocab-files
"kernel" <vocab-link> vocab-files
3array all-equal?
] unit-test
] unit-test

View File

@ -4,7 +4,7 @@ USING: compiler.units continuations fry kernel vocabs vocabs.parser ;
IN: vocabs.generated
: generate-vocab ( vocab-name quot -- vocab )
[ dup vocab [ ] ] dip '[
[ dup lookup-vocab [ ] ] dip '[
[
[
[ _ with-current-vocab ] [ ] [ forget-vocab ] cleanup

View File

@ -87,7 +87,7 @@ PRIVATE>
: child-vocabs ( prefix -- assoc )
[ [ vocab-roots get ] dip '[ dup _ (child-vocabs) ] { } map>assoc ]
[ unrooted-child-vocabs [ vocab ] map f swap 2array ]
[ unrooted-child-vocabs [ lookup-vocab ] map f swap 2array ]
bi suffix ;
: all-vocabs ( -- assoc )
@ -95,7 +95,7 @@ PRIVATE>
: child-vocabs-recursive ( prefix -- assoc )
[ [ vocab-roots get ] dip '[ dup _ (child-vocabs-recursive) ] { } map>assoc ]
[ unrooted-child-vocabs-recursive [ vocab ] map f swap 2array ]
[ unrooted-child-vocabs-recursive [ lookup-vocab ] map f swap 2array ]
bi suffix ;
MEMO: all-vocabs-recursive ( -- assoc )

View File

@ -8,7 +8,7 @@ FROM: io.styles => inset ;
IN: vocabs.prettyprint
: pprint-vocab ( vocab -- )
[ vocab-name ] [ vocab vocab-style ] bi styled-text ;
[ vocab-name ] [ lookup-vocab vocab-style ] bi styled-text ;
: pprint-in ( vocab -- )
[ \ IN: pprint-word pprint-vocab ] with-pprint ;
@ -19,7 +19,7 @@ IN: vocabs.prettyprint
[ vocab-name ] sort-with ;
: pprint-using ( seq -- )
[ "syntax" vocab = not ] filter
[ "syntax" lookup-vocab = not ] filter
sort-vocabs [
\ USING: pprint-word
[ pprint-vocab ] each
@ -96,4 +96,4 @@ PRIVATE>
{ inset { 5 5 } }
} [ manifest get pprint-manifest ] with-nesting
nl nl
] print-use-hook set-global
] print-use-hook set-global

View File

@ -22,7 +22,7 @@ IN: vocabs.refresh
SYMBOL: changed-vocabs
: changed-vocab ( vocab -- )
dup vocab changed-vocabs get and
dup lookup-vocab changed-vocabs get and
[ dup changed-vocabs get set-at ] [ drop ] if ;
: unchanged-vocab ( vocab -- )
@ -58,12 +58,12 @@ SYMBOL: modified-docs
[
[
[ modified-sources ]
[ vocab source-loaded?>> ]
[ lookup-vocab source-loaded?>> ]
[ vocab-source-path ]
tri (to-refresh)
] [
[ modified-docs ]
[ vocab docs-loaded?>> ]
[ lookup-vocab docs-loaded?>> ]
[ vocab-docs-path ]
tri (to-refresh)
] bi
@ -78,8 +78,8 @@ SYMBOL: modified-docs
: do-refresh ( modified-sources modified-docs unchanged -- )
unchanged-vocabs
[
[ [ vocab f >>source-loaded? drop ] each ]
[ [ vocab f >>docs-loaded? drop ] each ] bi*
[ [ lookup-vocab f >>source-loaded? drop ] each ]
[ [ lookup-vocab f >>docs-loaded? drop ] each ] bi*
]
[
union

View File

@ -32,7 +32,7 @@ architecture get {
! Now we have ( syntax-quot arch-quot layouts-quot ) on the stack
! Bring up a bare cross-compiling vocabulary.
"syntax" vocab vocab-words bootstrap-syntax set
"syntax" lookup-vocab vocab-words bootstrap-syntax set
H{ } clone dictionary set
H{ } clone root-cache set

View File

@ -116,7 +116,7 @@ M: object always-bump-effect-counter? drop f ;
: changed-vocabs ( assoc -- vocabs )
[ drop word? ] assoc-filter
[ drop vocabulary>> dup [ vocab ] when dup ] assoc-map ;
[ drop vocabulary>> dup [ lookup-vocab ] when dup ] assoc-map ;
: updated-definitions ( -- assoc )
H{ } clone

View File

@ -16,7 +16,7 @@ IN: vocabs.loader.tests
[ "vocabs.loader.test" >vocab-link ] unit-test
[ t ]
[ "kernel" >vocab-link "kernel" vocab = ] unit-test
[ "kernel" >vocab-link "kernel" lookup-vocab = ] unit-test
IN: vocabs.loader.test.2
@ -28,7 +28,7 @@ IN: vocabs.loader.tests
[ ] [
"vocabs.loader.test.2" run
"vocabs.loader.test.2" vocab run
"vocabs.loader.test.2" lookup-vocab run
"vocabs.loader.test.2" <vocab-link> run
] unit-test
@ -42,7 +42,7 @@ IN: vocabs.loader.tests
2 [
[ "vocabs.loader.test.a" require ] must-fail
[ f ] [ "vocabs.loader.test.a" vocab source-loaded?>> ] unit-test
[ f ] [ "vocabs.loader.test.a" lookup-vocab source-loaded?>> ] unit-test
[ t ] [
"resource:core/vocabs/loader/test/a/a.factor"
@ -111,7 +111,7 @@ IN: vocabs.loader.tests
[ "kernel" <vocab-link> where ] unit-test
[ { "resource:core/kernel/kernel.factor" 1 } ]
[ "kernel" vocab where ] unit-test
[ "kernel" lookup-vocab where ] unit-test
[ ] [
[
@ -122,7 +122,7 @@ IN: vocabs.loader.tests
[ +done+ ] [
[ "vocabs.loader.test.d" require ] [ :1 ] recover
"vocabs.loader.test.d" vocab source-loaded?>>
"vocabs.loader.test.d" lookup-vocab source-loaded?>>
] unit-test
: forget-junk ( -- )
@ -172,18 +172,18 @@ forget-junk
[ ] [ [ "vocabs.loader.test.j" require ] [ drop :1 ] recover ] unit-test
[ ] [ "vocabs.loader.test.m" require ] unit-test
[ f ] [ "vocabs.loader.test.n" vocab ] unit-test
[ f ] [ "vocabs.loader.test.n" lookup-vocab ] unit-test
[ ] [ "vocabs.loader.test.o" require ] unit-test
[ t ] [ "vocabs.loader.test.n" vocab >boolean ] unit-test
[ t ] [ "vocabs.loader.test.n" lookup-vocab >boolean ] unit-test
[
"mno" [ "vocabs.loader.test." swap suffix forget-vocab ] each
] with-compilation-unit
[ ] [ "vocabs.loader.test.o" require ] unit-test
[ f ] [ "vocabs.loader.test.n" vocab ] unit-test
[ f ] [ "vocabs.loader.test.n" lookup-vocab ] unit-test
[ ] [ "vocabs.loader.test.m" require ] unit-test
[ t ] [ "vocabs.loader.test.n" vocab >boolean ] unit-test
[ t ] [ "vocabs.loader.test.n" lookup-vocab >boolean ] unit-test
[
"mno" [ "vocabs.loader.test." swap suffix forget-vocab ] each

View File

@ -88,7 +88,7 @@ require-when-table [ V{ } clone ] initialize
: load-conditional-requires ( vocab -- )
vocab-name require-when-vocabs get in? [
require-when-table get [
[ [ vocab dup [ source-loaded?>> +done+ = ] when ] all? ] dip
[ [ lookup-vocab dup [ source-loaded?>> +done+ = ] when ] all? ] dip
[ require ] curry when
] assoc-each
] when ;
@ -119,7 +119,7 @@ PRIVATE>
load-vocab drop ;
: require-when ( if then -- )
over [ vocab ] all? [
over [ lookup-vocab ] all? [
require drop
] [
[ drop [ require-when-vocabs get adjoin ] each ]
@ -127,7 +127,7 @@ PRIVATE>
] if ;
: reload ( name -- )
dup vocab
dup lookup-vocab
[ [ load-source ] [ load-docs ] bi ]
[ require ]
?if ;
@ -168,7 +168,7 @@ PRIVATE>
[
dup vocab-name blacklist get at* [ rethrow ] [
drop dup find-vocab-root
[ (load-vocab) ] [ dup vocab [ ] [ no-vocab ] ?if ] if
[ (load-vocab) ] [ dup lookup-vocab [ ] [ no-vocab ] ?if ] if
] if
] load-vocab-hook set-global

View File

@ -221,17 +221,17 @@ M: extra-words update trim-forgotten ;
M: exclude update trim-forgotten ;
M: qualified update
dup vocab>> vocab [
dup vocab>> lookup-vocab [
dup [ prefix>> ] [ vocab>> load-vocab ] bi qualified-words
>>words
] [ drop f ] if ;
M: vocab update dup name>> vocab eq? ;
M: vocab update dup name>> lookup-vocab eq? ;
: update-manifest ( manifest -- )
[ dup [ name>> vocab ] when ] change-current-vocab
[ [ drop vocab ] assoc-filter ] change-search-vocab-names
dup search-vocab-names>> keys [ vocab ] V{ } map-as >>search-vocabs
[ dup [ name>> lookup-vocab ] when ] change-current-vocab
[ [ drop lookup-vocab ] assoc-filter ] change-search-vocab-names
dup search-vocab-names>> keys [ lookup-vocab ] V{ } map-as >>search-vocabs
qualified-vocabs>> [ update ] filter! drop ;
M: manifest definitions-changed ( assoc manifest -- )

View File

@ -26,7 +26,7 @@ $nl
}
"Looking up existing vocabularies and creating new vocabularies:"
{ $subsections
vocab
lookup-vocab
child-vocabs
create-vocab
}
@ -50,7 +50,7 @@ HELP: vocabs
{ $values { "seq" "a sequence of strings" } }
{ $description "Outputs a sequence of all defined vocabulary names." } ;
HELP: vocab
HELP: lookup-vocab
{ $values { "vocab-spec" "a vocabulary specifier" } { "vocab" vocab } }
{ $description "Outputs a named vocabulary, or " { $link f } " if no vocabulary with this name exists." }
{ $class-description "Instances represent vocabularies." } ;

View File

@ -35,17 +35,17 @@ M: vocab-link vocab-name name>> ;
M: string vocab-name ;
GENERIC: vocab ( vocab-spec -- vocab )
GENERIC: lookup-vocab ( vocab-spec -- vocab )
M: vocab vocab ;
M: vocab lookup-vocab ;
M: object vocab ( name -- vocab ) vocab-name dictionary get at ;
M: object lookup-vocab ( name -- vocab ) vocab-name dictionary get at ;
GENERIC: vocab-words ( vocab-spec -- words )
M: vocab vocab-words words>> ;
M: object vocab-words vocab vocab-words ;
M: object vocab-words lookup-vocab vocab-words ;
M: f vocab-words ;
@ -53,7 +53,7 @@ GENERIC: vocab-help ( vocab-spec -- help )
M: vocab vocab-help help>> ;
M: object vocab-help vocab vocab-help ;
M: object vocab-help lookup-vocab vocab-help ;
M: f vocab-help ;
@ -61,7 +61,7 @@ GENERIC: vocab-main ( vocab-spec -- main )
M: vocab vocab-main main>> ;
M: object vocab-main vocab vocab-main ;
M: object vocab-main lookup-vocab vocab-main ;
M: f vocab-main ;
@ -115,7 +115,7 @@ GENERIC: >vocab-link ( name -- vocab )
M: vocab-spec >vocab-link ;
M: string >vocab-link dup vocab [ ] [ <vocab-link> ] ?if ;
M: string >vocab-link dup lookup-vocab [ ] [ <vocab-link> ] ?if ;
: forget-vocab ( vocab -- )
[ words forget-all ]