1 ! Copyright (C) 2018 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors compiler.units kernel multiline parser
4 sequences splitting system vocabs.parser ;
7 : with-vocabulary ( quot suffix -- )
9 [ [ current-vocab name>> ] dip ?tail drop ]
10 [ append ] bi set-current-vocab
13 [ current-vocab name>> ] dip ?tail drop set-current-vocab
16 : parse-platform-section ( string suffix -- )
18 [ [ lines parse-lines ] curry with-nested-compilation-unit ]
20 ] dip with-vocabulary drop ; inline
23 "UNIX>" parse-multiline-string
24 os unix? [ ".unix" parse-platform-section ] [ drop ] if ;
27 "MACOSX>" parse-multiline-string
28 os macosx? [ ".macosx" parse-platform-section ] [ drop ] if ;
31 "LINUX>" parse-multiline-string
32 os linux? [ ".linux" parse-platform-section ] [ drop ] if ;
35 "WINDOWS>" parse-multiline-string
36 os windows? [ ".windows" parse-platform-section ] [ drop ] if ;