 USING: assocs io.files hashtables kernel namespaces sequences
 vocabs.loader io combinators io.encodings.utf8 calendar accessors
 math.parser io.streams.string ui.tools.operations quotations
-strings arrays prettyprint words vocabs sorting combinators.lib ;
+strings arrays prettyprint words vocabs sorting combinators.lib
+sets cords ;
 IN: tools.scaffold
 
 SYMBOL: developer-name
+SYMBOL: using
 
 ERROR: not-a-vocab-root string ;
 


: help-file-string ( str1 -- str2 )
    [
        scaffold-copyright
        [
            "USING: help.markup help.syntax ;" print
            "IN: " write print nl
        ]
        [ words natural-sort [ help. nl ] each ]
        [ "ARTICLE: " write unparse dup write bl print ";" print nl ]
        [ "ABOUT: " write unparse print ] quad
    ] with-string-writer ;

: set-scaffold-help-file ( path vocab -- )
    help-file-string swap utf8 set-file-contents ;

: check-scaffold ( vocab-root str -- vocab-root str )
    [ check-root ] [ check-vocab-name ] bi* ;

: check-vocab-name ( str -- str )
    dup dup [ CHAR: . = ] trim [ length ] bi@ =
    [ vocab-name-contains-dot ] unless
    ".." over subseq? [ vocab-name-contains-dot ] when
    dup [ path-separator? ] contains?
    [ vocab-name-contains-separator ] when ;

