]> gitweb.factorcode.org Git - factor.git/commitdiff
updated modules.util to use manifests
authorSam Anklesaria <sam@Tintin.local>
Mon, 25 May 2009 03:10:56 +0000 (22:10 -0500)
committerSam Anklesaria <sam@Tintin.local>
Mon, 25 May 2009 03:20:33 +0000 (22:20 -0500)
42 files changed:
extra/file-trees/file-trees.factor
extra/modules/remote-loading/authors.txt [deleted file]
extra/modules/remote-loading/remote-loading.factor [deleted file]
extra/modules/remote-loading/summary.txt [deleted file]
extra/modules/rpc-server/authors.txt [deleted file]
extra/modules/rpc-server/rpc-server.factor [deleted file]
extra/modules/rpc-server/summary.txt [deleted file]
extra/modules/rpc/authors.txt [deleted file]
extra/modules/rpc/rpc-docs.factor [deleted file]
extra/modules/rpc/rpc.factor [deleted file]
extra/modules/rpc/summary.txt [deleted file]
extra/modules/uploads/authors.txt [deleted file]
extra/modules/uploads/summary.txt [deleted file]
extra/modules/uploads/uploads.factor [deleted file]
extra/modules/using/authors.txt [deleted file]
extra/modules/using/summary.txt [deleted file]
extra/modules/using/tests/tags.txt [deleted file]
extra/modules/using/tests/test-server.factor [deleted file]
extra/modules/using/tests/tests.factor [deleted file]
extra/modules/using/using-docs.factor [deleted file]
extra/modules/using/using.factor [deleted file]
extra/modules/util/util.factor
unmaintained/modules/remote-loading/authors.txt [new file with mode: 0644]
unmaintained/modules/remote-loading/remote-loading.factor [new file with mode: 0644]
unmaintained/modules/remote-loading/summary.txt [new file with mode: 0644]
unmaintained/modules/rpc-server/authors.txt [new file with mode: 0644]
unmaintained/modules/rpc-server/rpc-server.factor [new file with mode: 0644]
unmaintained/modules/rpc-server/summary.txt [new file with mode: 0644]
unmaintained/modules/rpc/authors.txt [new file with mode: 0644]
unmaintained/modules/rpc/rpc-docs.factor [new file with mode: 0644]
unmaintained/modules/rpc/rpc.factor [new file with mode: 0644]
unmaintained/modules/rpc/summary.txt [new file with mode: 0644]
unmaintained/modules/uploads/authors.txt [new file with mode: 0644]
unmaintained/modules/uploads/summary.txt [new file with mode: 0644]
unmaintained/modules/uploads/uploads.factor [new file with mode: 0644]
unmaintained/modules/using/authors.txt [new file with mode: 0644]
unmaintained/modules/using/summary.txt [new file with mode: 0644]
unmaintained/modules/using/tests/tags.txt [new file with mode: 0644]
unmaintained/modules/using/tests/test-server.factor [new file with mode: 0644]
unmaintained/modules/using/tests/tests.factor [new file with mode: 0644]
unmaintained/modules/using/using-docs.factor [new file with mode: 0644]
unmaintained/modules/using/using.factor [new file with mode: 0644]

index d92309ca7744538ebe0fe25f9bb0a41575f474a2..a3108aa92290420b010de796ba9d93c18d9d4490 100644 (file)
@@ -1,6 +1,7 @@
 USING: accessors arrays delegate delegate.protocols
 io.pathnames kernel locals sequences
-ui.frp vectors make strings ;
+vectors make strings ;
+EXCLUDE: ui.frp => , ;
 IN: file-trees
 
 TUPLE: walkable-vector vector father ;
diff --git a/extra/modules/remote-loading/authors.txt b/extra/modules/remote-loading/authors.txt
deleted file mode 100644 (file)
index 2300f69..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Sam Anklesaria
diff --git a/extra/modules/remote-loading/remote-loading.factor b/extra/modules/remote-loading/remote-loading.factor
deleted file mode 100644 (file)
index 7a51f24..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-USING: modules.rpc-server vocabs ;
-IN: modules.remote-loading mem-service
-
-: get-vocab ( vocabstr -- vocab ) vocab ;
\ No newline at end of file
diff --git a/extra/modules/remote-loading/summary.txt b/extra/modules/remote-loading/summary.txt
deleted file mode 100644 (file)
index 304f855..0000000
+++ /dev/null
@@ -1 +0,0 @@
-required for listeners allowing remote loading of modules
\ No newline at end of file
diff --git a/extra/modules/rpc-server/authors.txt b/extra/modules/rpc-server/authors.txt
deleted file mode 100644 (file)
index 2300f69..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Sam Anklesaria
diff --git a/extra/modules/rpc-server/rpc-server.factor b/extra/modules/rpc-server/rpc-server.factor
deleted file mode 100644 (file)
index 525ff35..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-USING: accessors assocs continuations effects io
-io.encodings.binary io.servers.connection kernel
-memoize namespaces parser sets sequences serialize
-threads vocabs vocabs.parser words ;
-
-IN: modules.rpc-server
-
-SYMBOL: serving-vocabs V{ } clone serving-vocabs set-global
-
-: do-rpc ( args word -- bytes )
-   [ execute ] curry with-datastack object>bytes ; inline
-
-MEMO: mem-do-rpc ( args word -- bytes ) do-rpc ; inline
-
-: process ( vocabspec -- ) vocab-words [ deserialize ] dip deserialize
-   swap at "executer" get execute( args word -- bytes ) write flush ;
-
-: (serve) ( -- ) deserialize dup serving-vocabs get-global index
-   [ process ] [ drop ] if ;
-
-: start-serving-vocabs ( -- ) [
-   <threaded-server> 5000 >>insecure binary >>encoding [ (serve) ] >>handler
-   start-server ] in-thread ;
-
-: (service) ( -- ) serving-vocabs get-global empty? [ start-serving-vocabs ] when
-   current-vocab serving-vocabs get-global adjoin
-   "get-words" create-in
-   in get [ vocab vocab-words [ stack-effect ] { } assoc-map-as ] curry
-   (( -- words )) define-inline ;
-
-SYNTAX: service \ do-rpc  "executer" set (service) ;
-SYNTAX: mem-service \ mem-do-rpc "executer" set (service) ;
-
-load-vocab-hook [
-   [ dup words>> values
-   \ mem-do-rpc "memoize" word-prop [ delete-at ] curry each ]
-append ] change-global
\ No newline at end of file
diff --git a/extra/modules/rpc-server/summary.txt b/extra/modules/rpc-server/summary.txt
deleted file mode 100644 (file)
index 396a1c8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-remote procedure call server
\ No newline at end of file
diff --git a/extra/modules/rpc/authors.txt b/extra/modules/rpc/authors.txt
deleted file mode 100644 (file)
index 2300f69..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Sam Anklesaria
diff --git a/extra/modules/rpc/rpc-docs.factor b/extra/modules/rpc/rpc-docs.factor
deleted file mode 100644 (file)
index af99d21..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-USING: help.syntax help.markup ;
-IN: modules.rpc
-ARTICLE: { "modules" "protocol" } "RPC Protocol"
-{ $list
-   "Send vocab as string"
-   "Send arglist"
-   "Send word as string"
-   "Receive result list"
-} ;
\ No newline at end of file
diff --git a/extra/modules/rpc/rpc.factor b/extra/modules/rpc/rpc.factor
deleted file mode 100644 (file)
index c6b00ef..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-USING: accessors compiler.units combinators fry generalizations io
-io.encodings.binary io.sockets kernel namespaces
-parser sequences serialize vocabs vocabs.parser words ;
-IN: modules.rpc
-
-DEFER: get-words
-
-: with-in-vocab ( vocab quot -- vocab ) over
-  [ '[ _ set-in @ ] in get swap dip set-in ] dip vocab ; inline
-
-: remote-quot ( addrspec vocabspec effect str -- quot )
-   '[ _ 5000 <inet> binary
-      [
-         _ serialize _ in>> length narray serialize _ serialize flush deserialize dup length firstn
-      ] with-client
-    ] ;
-
-: define-remote ( addrspec vocabspec effect str -- ) [
-      [ remote-quot ] 2keep create-in -rot define-declared word make-inline
-   ] with-compilation-unit ;
-
-: remote-vocab ( addrspec vocabspec -- vocab )
-   dup "-remote" append [ 
-      [ (( -- words )) [ "get-words" remote-quot ] keep call-effect ] 2keep
-      [ rot first2 swap define-remote ] 2curry each
-   ] with-in-vocab ;
\ No newline at end of file
diff --git a/extra/modules/rpc/summary.txt b/extra/modules/rpc/summary.txt
deleted file mode 100644 (file)
index cc1501f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-remote procedure call client
\ No newline at end of file
diff --git a/extra/modules/uploads/authors.txt b/extra/modules/uploads/authors.txt
deleted file mode 100644 (file)
index 2300f69..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Sam Anklesaria
diff --git a/extra/modules/uploads/summary.txt b/extra/modules/uploads/summary.txt
deleted file mode 100644 (file)
index 1ba8ffe..0000000
+++ /dev/null
@@ -1 +0,0 @@
-module pushing in remote-loading listeners
\ No newline at end of file
diff --git a/extra/modules/uploads/uploads.factor b/extra/modules/uploads/uploads.factor
deleted file mode 100644 (file)
index 137a2c9..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-USING: assocs modules.rpc-server vocabs
-modules.remote-loading words ;
-IN: modules.uploads service
-
-: upload-vocab ( word binary -- ) \ get-vocab "memoize" word-prop set-at ;
\ No newline at end of file
diff --git a/extra/modules/using/authors.txt b/extra/modules/using/authors.txt
deleted file mode 100644 (file)
index 2300f69..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Sam Anklesaria
diff --git a/extra/modules/using/summary.txt b/extra/modules/using/summary.txt
deleted file mode 100644 (file)
index 6bafda7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-improved module import syntax
\ No newline at end of file
diff --git a/extra/modules/using/tests/tags.txt b/extra/modules/using/tests/tags.txt
deleted file mode 100644 (file)
index 6bf6830..0000000
+++ /dev/null
@@ -1 +0,0 @@
-unportable
diff --git a/extra/modules/using/tests/test-server.factor b/extra/modules/using/tests/test-server.factor
deleted file mode 100644 (file)
index 3e6b736..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-USING: modules.rpc-server io.servers.connection ;
-IN: modules.test-server service
-: rpc-hello ( -- str ) "hello world" stop-this-server ;
\ No newline at end of file
diff --git a/extra/modules/using/tests/tests.factor b/extra/modules/using/tests/tests.factor
deleted file mode 100644 (file)
index 894075a..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-USING: modules.using ;
-IN: modules.using.tests
-USING: tools.test localhost::modules.test-server ;
-[ "hello world" ] [ rpc-hello ] unit-test
\ No newline at end of file
diff --git a/extra/modules/using/using-docs.factor b/extra/modules/using/using-docs.factor
deleted file mode 100644 (file)
index c78e546..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-USING: modules.using modules.rpc-server help.syntax help.markup strings ;
-IN: modules
-
-HELP: service
-{ $syntax "IN: module service" }
-{ $description "Starts a server for requests for remote procedure calls." } ;
-
-ARTICLE: { "modules" "remote-loading" } "Using the remote-loading vocabulary"
-"If loaded, starts serving vocabularies, accessable through a " { $link POSTPONE: USING: } " form" ;
-
-HELP: USING:
-{ $syntax "USING: rpc-server::module fetch-sever::module { module qualified-name } { module => word ... } ... ;" }
-{ $description "Adds vocabularies to the front of the search path.  Vocabularies can be fetched remotely, if preceded by a valid hostname.  Name pairs facilitate imports like in the "
-{ $link POSTPONE: QUALIFIED: } " or " { $link POSTPONE: FROM: } " forms." } ;
\ No newline at end of file
diff --git a/extra/modules/using/using.factor b/extra/modules/using/using.factor
deleted file mode 100644 (file)
index b0891aa..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-USING: assocs kernel modules.remote-loading modules.rpc
-namespaces peg peg.ebnf peg-lexer sequences vocabs vocabs.parser
-strings ;
-IN: modules.using
-
-: >qualified ( vocab prefix -- assoc )
-    [ vocab-words ] [ 58 suffix ] bi* [ swap [ prepend ] dip ] curry assoc-map ;
-
-: >partial-vocab ( words assoc -- assoc )
-    [ dupd at [ no-word-error ] unless* ] curry { } map>assoc ;
-
-: remote-load ( addr vocabspec -- voab ) [ "modules.remote-loading" remote-vocab (use+) ] dip get-vocab ;
-
-: load'em ( vocab words/? -- ) [ swap >partial-vocab ] when* use get push ;
-
-EBNF: modulize
-tokenpart = (!(':').)+ => [[ >string ]]
-s = ':' => [[ drop ignore ]]
-rpc = tokenpart s s tokenpart => [[ first2 remote-vocab ]]
-remote = tokenpart s tokenpart => [[ first2 remote-load ]]
-plain = tokenpart => [[ load-vocab ]]
-module = rpc | remote | plain
-;EBNF
-
-ON-BNF: USING:
-tokenizer = <foreign factor>
-sym = !(";"|"}"|"=>").
-modspec = sym => [[ modulize ]]
-qualified = modspec sym => [[ first2 >qualified ]]
-unqualified = modspec => [[ vocab-words ]]
-words = ("=>" sym+ )? => [[ [ f ] [ second ] if-empty ]]
-long = "{" ( qualified | unqualified ) words "}" => [[ rest first2 load'em ignore ]]
-short = modspec => [[ use+ ignore ]]
-wordSpec = long | short
-using = wordSpec+ ";" => [[ drop ignore ]]
-;ON-BNF
\ No newline at end of file
index ef5a3f3e7685b96c4ed03567d0b735670d4285e0..4e92d4139f02abbd99494342503fea0eec9937ff 100644 (file)
@@ -1,7 +1,7 @@
 USING: accessors assocs kernel lexer locals namespaces sequences
 vocabs vocabs.parser ;
 IN: modules.util
-SYNTAX: EXPORT-FROM: [let | v [ in get ] |
-   v vocab words>> ";" parse-tokens
-   [ load-vocab vocab-words [ clone v >>vocabulary ] assoc-map ] map
+SYNTAX: EXPORT-FROM: [let | v [ current-vocab ] |
+   v words>> ";" parse-tokens
+   [ load-vocab vocab-words [ clone v name>> >>vocabulary ] assoc-map ] map
    assoc-combine update ] ;
\ No newline at end of file
diff --git a/unmaintained/modules/remote-loading/authors.txt b/unmaintained/modules/remote-loading/authors.txt
new file mode 100644 (file)
index 0000000..2300f69
--- /dev/null
@@ -0,0 +1 @@
+Sam Anklesaria
diff --git a/unmaintained/modules/remote-loading/remote-loading.factor b/unmaintained/modules/remote-loading/remote-loading.factor
new file mode 100644 (file)
index 0000000..7a51f24
--- /dev/null
@@ -0,0 +1,4 @@
+USING: modules.rpc-server vocabs ;
+IN: modules.remote-loading mem-service
+
+: get-vocab ( vocabstr -- vocab ) vocab ;
\ No newline at end of file
diff --git a/unmaintained/modules/remote-loading/summary.txt b/unmaintained/modules/remote-loading/summary.txt
new file mode 100644 (file)
index 0000000..304f855
--- /dev/null
@@ -0,0 +1 @@
+required for listeners allowing remote loading of modules
\ No newline at end of file
diff --git a/unmaintained/modules/rpc-server/authors.txt b/unmaintained/modules/rpc-server/authors.txt
new file mode 100644 (file)
index 0000000..2300f69
--- /dev/null
@@ -0,0 +1 @@
+Sam Anklesaria
diff --git a/unmaintained/modules/rpc-server/rpc-server.factor b/unmaintained/modules/rpc-server/rpc-server.factor
new file mode 100644 (file)
index 0000000..d818170
--- /dev/null
@@ -0,0 +1,37 @@
+USING: accessors assocs continuations effects io
+io.encodings.binary io.servers.connection kernel
+memoize namespaces parser sets sequences serialize
+threads vocabs vocabs.parser words ;
+
+IN: modules.rpc-server
+
+SYMBOL: serving-vocabs V{ } clone serving-vocabs set-global
+
+: do-rpc ( args word -- bytes )
+   [ execute ] curry with-datastack object>bytes ; inline
+
+MEMO: mem-do-rpc ( args word -- bytes ) do-rpc ; inline
+
+: process ( vocabspec -- ) vocab-words [ deserialize ] dip deserialize
+   swap at "executer" get execute( args word -- bytes ) write flush ;
+
+: (serve) ( -- ) deserialize dup serving-vocabs get-global index
+   [ process ] [ drop ] if ;
+
+: start-serving-vocabs ( -- ) [
+   <threaded-server> 5000 >>insecure binary >>encoding [ (serve) ] >>handler
+   start-server ] in-thread ;
+
+: (service) ( -- ) serving-vocabs get-global empty? [ start-serving-vocabs ] when
+   current-vocab serving-vocabs get-global adjoin
+   "get-words" create-in
+   current-vocab name>> [ vocab vocab-words [ stack-effect ] { } assoc-map-as ] curry
+   (( -- words )) define-inline ;
+
+SYNTAX: service \ do-rpc  "executer" set (service) ;
+SYNTAX: mem-service \ mem-do-rpc "executer" set (service) ;
+
+load-vocab-hook [
+   [ dup words>> values
+   \ mem-do-rpc "memoize" word-prop [ delete-at ] curry each ]
+append ] change-global
\ No newline at end of file
diff --git a/unmaintained/modules/rpc-server/summary.txt b/unmaintained/modules/rpc-server/summary.txt
new file mode 100644 (file)
index 0000000..396a1c8
--- /dev/null
@@ -0,0 +1 @@
+remote procedure call server
\ No newline at end of file
diff --git a/unmaintained/modules/rpc/authors.txt b/unmaintained/modules/rpc/authors.txt
new file mode 100644 (file)
index 0000000..2300f69
--- /dev/null
@@ -0,0 +1 @@
+Sam Anklesaria
diff --git a/unmaintained/modules/rpc/rpc-docs.factor b/unmaintained/modules/rpc/rpc-docs.factor
new file mode 100644 (file)
index 0000000..af99d21
--- /dev/null
@@ -0,0 +1,9 @@
+USING: help.syntax help.markup ;
+IN: modules.rpc
+ARTICLE: { "modules" "protocol" } "RPC Protocol"
+{ $list
+   "Send vocab as string"
+   "Send arglist"
+   "Send word as string"
+   "Receive result list"
+} ;
\ No newline at end of file
diff --git a/unmaintained/modules/rpc/rpc.factor b/unmaintained/modules/rpc/rpc.factor
new file mode 100644 (file)
index 0000000..fe65c9c
--- /dev/null
@@ -0,0 +1,26 @@
+USING: accessors compiler.units combinators fry generalizations io
+io.encodings.binary io.sockets kernel
+parser sequences serialize vocabs vocabs.parser words ;
+IN: modules.rpc
+
+DEFER: get-words
+
+: with-in-vocab ( vocab quot -- vocab ) over
+  [ '[ _ set-current-vocab @ ] current-vocab name>> swap dip set-current-vocab ] dip vocab ; inline
+
+: remote-quot ( addrspec vocabspec effect str -- quot )
+   '[ _ 5000 <inet> binary
+      [
+         _ serialize _ in>> length narray serialize _ serialize flush deserialize dup length firstn
+      ] with-client
+    ] ;
+
+: define-remote ( addrspec vocabspec effect str -- ) [
+      [ remote-quot ] 2keep create-in -rot define-declared word make-inline
+   ] with-compilation-unit ;
+
+: remote-vocab ( addrspec vocabspec -- vocab )
+   dup "-remote" append [ 
+      [ (( -- words )) [ "get-words" remote-quot ] keep call-effect ] 2keep
+      [ rot first2 swap define-remote ] 2curry each
+   ] with-in-vocab ;
\ No newline at end of file
diff --git a/unmaintained/modules/rpc/summary.txt b/unmaintained/modules/rpc/summary.txt
new file mode 100644 (file)
index 0000000..cc1501f
--- /dev/null
@@ -0,0 +1 @@
+remote procedure call client
\ No newline at end of file
diff --git a/unmaintained/modules/uploads/authors.txt b/unmaintained/modules/uploads/authors.txt
new file mode 100644 (file)
index 0000000..2300f69
--- /dev/null
@@ -0,0 +1 @@
+Sam Anklesaria
diff --git a/unmaintained/modules/uploads/summary.txt b/unmaintained/modules/uploads/summary.txt
new file mode 100644 (file)
index 0000000..1ba8ffe
--- /dev/null
@@ -0,0 +1 @@
+module pushing in remote-loading listeners
\ No newline at end of file
diff --git a/unmaintained/modules/uploads/uploads.factor b/unmaintained/modules/uploads/uploads.factor
new file mode 100644 (file)
index 0000000..137a2c9
--- /dev/null
@@ -0,0 +1,5 @@
+USING: assocs modules.rpc-server vocabs
+modules.remote-loading words ;
+IN: modules.uploads service
+
+: upload-vocab ( word binary -- ) \ get-vocab "memoize" word-prop set-at ;
\ No newline at end of file
diff --git a/unmaintained/modules/using/authors.txt b/unmaintained/modules/using/authors.txt
new file mode 100644 (file)
index 0000000..2300f69
--- /dev/null
@@ -0,0 +1 @@
+Sam Anklesaria
diff --git a/unmaintained/modules/using/summary.txt b/unmaintained/modules/using/summary.txt
new file mode 100644 (file)
index 0000000..6bafda7
--- /dev/null
@@ -0,0 +1 @@
+improved module import syntax
\ No newline at end of file
diff --git a/unmaintained/modules/using/tests/tags.txt b/unmaintained/modules/using/tests/tags.txt
new file mode 100644 (file)
index 0000000..6bf6830
--- /dev/null
@@ -0,0 +1 @@
+unportable
diff --git a/unmaintained/modules/using/tests/test-server.factor b/unmaintained/modules/using/tests/test-server.factor
new file mode 100644 (file)
index 0000000..3e6b736
--- /dev/null
@@ -0,0 +1,3 @@
+USING: modules.rpc-server io.servers.connection ;
+IN: modules.test-server service
+: rpc-hello ( -- str ) "hello world" stop-this-server ;
\ No newline at end of file
diff --git a/unmaintained/modules/using/tests/tests.factor b/unmaintained/modules/using/tests/tests.factor
new file mode 100644 (file)
index 0000000..a0adca2
--- /dev/null
@@ -0,0 +1,4 @@
+QUALIFIED-WITH: modules.using m
+IN: modules.using.tests
+m:USING: tools.test localhost::modules.test-server ;
+[ "hello world" ] [ rpc-hello ] unit-test
\ No newline at end of file
diff --git a/unmaintained/modules/using/using-docs.factor b/unmaintained/modules/using/using-docs.factor
new file mode 100644 (file)
index 0000000..15f9996
--- /dev/null
@@ -0,0 +1,15 @@
+USING: modules.rpc-server help.syntax help.markup strings ;
+QUALIFIED-WITH: modules.using m
+IN: modules
+
+HELP: service
+{ $syntax "IN: module service" }
+{ $description "Starts a server for requests for remote procedure calls." } ;
+
+ARTICLE: { "modules" "remote-loading" } "Using the remote-loading vocabulary"
+"If loaded, starts serving vocabularies, accessable through a " { $link POSTPONE: m:USING: } " form" ;
+
+HELP: USING:
+{ $syntax "USING: rpc-server::module fetch-sever::module { module qualified-name } { module => word ... } ... ;" }
+{ $description "Adds vocabularies to the front of the search path.  Vocabularies can be fetched remotely, if preceded by a valid hostname.  Name pairs facilitate imports like in the "
+{ $link POSTPONE: QUALIFIED: } " or " { $link POSTPONE: FROM: } " forms." } ;
\ No newline at end of file
diff --git a/unmaintained/modules/using/using.factor b/unmaintained/modules/using/using.factor
new file mode 100644 (file)
index 0000000..57bf3c6
--- /dev/null
@@ -0,0 +1,36 @@
+USING: accessors assocs kernel modules.remote-loading modules.rpc
+namespaces peg peg.ebnf peg-lexer sequences vocabs vocabs.parser
+strings ;
+IN: modules.using
+
+: >qualified ( vocab prefix -- assoc )
+    [ vocab-words ] [ 58 suffix ] bi* [ swap [ prepend ] dip ] curry assoc-map ;
+
+: >partial-vocab ( words assoc -- assoc )
+    [ dupd at [ no-word-error ] unless* ] curry { } map>assoc ;
+
+: remote-load ( addr vocabspec -- voab ) [ "modules.remote-loading" remote-vocab use-vocab ] dip get-vocab ;
+
+: load'em ( vocab words/? -- ) [ swap >partial-vocab ] when* manifest get qualified-vocabs>> push ;
+
+EBNF: modulize
+tokenpart = (!(':').)+ => [[ >string ]]
+s = ':' => [[ drop ignore ]]
+rpc = tokenpart s s tokenpart => [[ first2 remote-vocab ]]
+remote = tokenpart s tokenpart => [[ first2 remote-load ]]
+plain = tokenpart => [[ load-vocab ]]
+module = rpc | remote | plain
+;EBNF
+
+ON-BNF: USING:
+tokenizer = <foreign factor>
+sym = !(";"|"}"|"=>").
+modspec = sym => [[ modulize ]]
+qualified = modspec sym => [[ first2 >qualified ]]
+unqualified = modspec => [[ vocab-words ]]
+words = ("=>" sym+ )? => [[ [ f ] [ second ] if-empty ]]
+long = "{" ( qualified | unqualified ) words "}" => [[ rest first2 load'em ignore ]]
+short = modspec => [[ use-vocab ignore ]]
+wordSpec = long | short
+using = wordSpec+ ";" => [[ drop ignore ]]
+;ON-BNF
\ No newline at end of file