Rename (load-vocab) to (require), add tags.txt for "p" vocab loader test. Code formatting.
parent
69ffe6377a
commit
1eed9203bb
|
@ -9,7 +9,7 @@ IN: bootstrap.help
|
||||||
|
|
||||||
t load-help? set-global
|
t load-help? set-global
|
||||||
|
|
||||||
[ dup lookup-vocab [ ] [ no-vocab ] ?if drop ] require-hook [
|
[ dup lookup-vocab [ drop ] [ no-vocab ] if ] require-hook [
|
||||||
dictionary get values
|
dictionary get values
|
||||||
[ docs-loaded?>> not ] filter
|
[ docs-loaded?>> not ] filter
|
||||||
[ load-docs ] each
|
[ load-docs ] each
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
USING: vocabs.loader tools.test continuations vocabs math
|
USING: vocabs.loader tools.test continuations vocabs math
|
||||||
kernel arrays sequences namespaces io.streams.string
|
kernel arrays sequences namespaces io.streams.string
|
||||||
parser source-files words assocs classes.tuple definitions
|
parser source-files words assocs classes.tuple definitions
|
||||||
debugger compiler.units accessors eval
|
debugger compiler.units accessors eval vocabs.hierarchy
|
||||||
combinators vocabs.parser grouping vocabs.files vocabs.refresh ;
|
combinators vocabs.parser grouping vocabs.files vocabs.refresh ;
|
||||||
IN: vocabs.loader.tests
|
IN: vocabs.loader.tests
|
||||||
|
|
||||||
|
@ -185,6 +185,8 @@ forget-junk
|
||||||
[ ] [ "vocabs.loader.test.m" require ] unit-test
|
[ ] [ "vocabs.loader.test.m" require ] unit-test
|
||||||
[ t ] [ "vocabs.loader.test.n" lookup-vocab >boolean ] unit-test
|
[ t ] [ "vocabs.loader.test.n" lookup-vocab >boolean ] unit-test
|
||||||
|
|
||||||
|
[ ] [ "vocabs" load ] unit-test
|
||||||
|
[ f ] [ "vocabs.loader.test.p" lookup-vocab ] unit-test
|
||||||
[ ] [ "vocabs.loader.test.p.private" require ] unit-test
|
[ ] [ "vocabs.loader.test.p.private" require ] unit-test
|
||||||
[ { "foo" } ] [ "vocabs.loader.test.p" words [ name>> ] map ] unit-test
|
[ { "foo" } ] [ "vocabs.loader.test.p" words [ name>> ] map ] unit-test
|
||||||
|
|
||||||
|
|
|
@ -138,28 +138,29 @@ SYMBOL: blacklist
|
||||||
: add-to-blacklist ( error vocab -- )
|
: add-to-blacklist ( error vocab -- )
|
||||||
vocab-name blacklist get dup [ set-at ] [ 3drop ] if ;
|
vocab-name blacklist get dup [ set-at ] [ 3drop ] if ;
|
||||||
|
|
||||||
GENERIC: (load-vocab) ( name -- vocab )
|
GENERIC: (require) ( name -- )
|
||||||
|
|
||||||
M: vocab (load-vocab)
|
M: vocab (require)
|
||||||
[
|
[
|
||||||
dup source-loaded?>> +parsing+ eq? [
|
dup source-loaded?>> +parsing+ eq? [ drop ] [
|
||||||
dup source-loaded?>> [ dup load-source ] unless
|
dup source-loaded?>> [ dup load-source ] unless
|
||||||
dup docs-loaded?>> [ dup load-docs ] unless
|
dup docs-loaded?>> [ dup load-docs ] unless
|
||||||
] unless
|
drop
|
||||||
|
] if
|
||||||
] [ [ swap add-to-blacklist ] keep rethrow ] recover ;
|
] [ [ swap add-to-blacklist ] keep rethrow ] recover ;
|
||||||
|
|
||||||
M: vocab-link (load-vocab)
|
M: vocab-link (require)
|
||||||
vocab-name (load-vocab) ;
|
vocab-name (require) ;
|
||||||
|
|
||||||
M: string (load-vocab) create-vocab (load-vocab) ;
|
M: string (require) create-vocab (require) ;
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
[
|
[
|
||||||
dup vocab-name blacklist get at* [ rethrow ] [
|
dup vocab-name blacklist get at*
|
||||||
drop dup find-vocab-root
|
[ rethrow ]
|
||||||
[ (load-vocab) ] [ dup lookup-vocab [ ] [ no-vocab ] ?if ] if
|
[ drop dup find-vocab-root [ (require) ] [ drop ] if ]
|
||||||
] if drop
|
if
|
||||||
] require-hook set-global
|
] require-hook set-global
|
||||||
|
|
||||||
M: vocab-spec where vocab-source-path dup [ 1 2array ] when ;
|
M: vocab-spec where vocab-source-path dup [ 1 2array ] when ;
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
not loaded
|
|
@ -140,7 +140,7 @@ GENERIC: require ( object -- )
|
||||||
M: vocab require name>> require ;
|
M: vocab require name>> require ;
|
||||||
M: vocab-link require name>> require ;
|
M: vocab-link require name>> require ;
|
||||||
|
|
||||||
! When calling "foo.private" require, load "foo" instead, ! but only when
|
! When calling "foo.private" require, load "foo" instead, but only when
|
||||||
! "foo.private" does not exist. The reason for this is that stage1 bootstrap
|
! "foo.private" does not exist. The reason for this is that stage1 bootstrap
|
||||||
! starts out with some .private vocabs that contain primitives, and
|
! starts out with some .private vocabs that contain primitives, and
|
||||||
! loading the public vocabs would cause circularity issues.
|
! loading the public vocabs would cause circularity issues.
|
||||||
|
|
Loading…
Reference in New Issue