[ fake-quotations> first ] append! ;
: parse-declared* ( accum -- accum )
- complete-effect
+ scan-effect
[ parse-definition* ] dip
suffix! ;
FUNCTOR-SYNTAX: C:
scan-param suffix!
scan-param suffix!
- complete-effect
+ scan-effect
[ [ [ boa ] curry ] append! ] dip suffix!
\ define-declared* suffix! ;
FUNCTOR-SYNTAX: GENERIC:
scan-param suffix!
- complete-effect suffix!
+ scan-effect suffix!
\ define-simple-generic* suffix! ;
FUNCTOR-SYNTAX: MACRO:
H{ } clone (parse-lambda) <let> ?rewrite-closures ;
: parse-locals ( -- effect vars assoc )
- complete-effect
+ scan-effect
dup
in>> [ dup pair? [ first ] when ] map make-locals ;
SYNTAX: ROMAN-OP:
scan-word [ name>> "roman" prepend create-in ] keep
1quotation '[ _ binary-roman-op ]
- complete-effect define-declared ;
+ scan-effect define-declared ;
>>
--- /dev/null
+Doug Coleman
--- /dev/null
+! Copyright (C) 2011 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: combinators.short-circuit io.directories.search io.files
+io.files.info io.pathnames kernel sequences ;
+IN: tools.rename
+
+ERROR: directory-contains-files-error path ;
+
+: directory-contains-files? ( path -- ? )
+ qualified-directory-files [ link-info directory? ] all? not ;
+
+: check-new-vocab-path ( old new -- old new )
+ 2dup [ vocab-path parent-directory ] dip append-path
+ { [ exists? ] [ directory-contains-files? ] } 1&&
+ [ directory-contains-files-error ] unless ;
+
+: rename-vocab ( old new -- )
+ check-new-vocab-path 2drop ;
PRIVATE>
SYNTAX: TAGS:
- scan-new-word complete-effect
+ scan-new-word scan-effect
[ drop H{ } clone "xtable" set-word-prop ]
[ define-tags ]
2bi ;
[ "--" parse-effect-tokens ] dip parse-effect-tokens
<variable-effect> ;
-: complete-effect ( -- effect )
+: scan-effect ( -- effect )
"(" expect ")" parse-effect ;
: parse-call( ( accum word -- accum )
: (:) ( -- word def effect )
scan-new-word
- complete-effect
+ scan-effect
parse-definition swap ;
: scan-new-generic ( -- word ) scan-new dup reset-word ;
: (GENERIC:) ( quot -- )
- [ scan-new-generic ] dip call complete-effect define-generic ; inline
+ [ scan-new-generic ] dip call scan-effect define-generic ; inline
: create-method-in ( class generic -- method )
create-method dup set-word dup save-location ;
] if ;
! Syntax
-SYNTAX: GENERIC: scan-new-word complete-effect define-generic ;
+SYNTAX: GENERIC: scan-new-word scan-effect define-generic ;
: parse-method ( -- quot classes generic )
parse-definition [ 2 tail ] [ second ] [ first ] tri ;
[ drop make-pair-generic ] 2tri ;
: (PAIR-GENERIC:) ( -- )
- scan-new-generic complete-effect define-pair-generic ;
+ scan-new-generic scan-effect define-pair-generic ;
SYNTAX: PAIR-GENERIC: (PAIR-GENERIC:) ;