modern.out: Write core/ to disk in two ways.

modern-harvey2
Doug Coleman 2017-08-26 20:33:22 -05:00
parent 4ede4769e2
commit 8d2d8f99e9
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1 @@
Doug Coleman

View File

@ -0,0 +1,30 @@
! Copyright (C) 2017 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays assocs io.encodings.utf8 io.files kernel modern
modern.paths modern.slices prettyprint sequences
sequences.extras splitting ;
IN: modern.out
: strings-core-to-file ( -- )
core-bootstrap-vocabs
[ ".private" ?tail drop modern-source-path utf8 file-contents ] map-zip
[ "[========[" dup matching-delimiter-string surround ] assoc-map
[
first2 [ "VOCAB: " prepend ] dip " " glue
] map
[ " " prepend ] map "\n\n" join
"<VOCAB-ROOT: factorcode-core \"https://factorcode.org/git/factor.git\" \"core/\"\n"
"\n;VOCAB-ROOT>" surround "resource:core-strings.factor" utf8 set-file-contents ;
: parsed-core-to-file ( -- )
core-bootstrap-vocabs
[ vocab>literals ] map-zip
[
first2 [ "<VOCAB: " prepend ] dip
>strings
! [ 3 head ] [ 3 tail* ] bi [ >strings ] bi@ { "..." } glue
";VOCAB>" 3array
] map 1array
{ "<VOCAB-ROOT:" "factorcode-core" "https://factorcode.org/git/factor.git" "core/" }
{ ";VOCAB-ROOT>" } surround "resource:core-parsed.factor" utf8 [ ... ] with-file-writer ;