Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
vocabs.platforms: Add <LINUX LINUX> sections that ignore code for the…
… wrong platform.
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Doug Coleman |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
! Copyright (C) 2018 Doug Coleman. | ||
! See http://factorcode.org/license.txt for BSD license. | ||
USING: accessors compiler.units kernel multiline parser | ||
sequences splitting system vocabs.parser ; | ||
IN: vocabs.platforms | ||
|
||
: with-vocabulary ( quot suffix -- ) | ||
[ | ||
[ [ current-vocab name>> ] dip ?tail drop ] | ||
[ append ] bi set-current-vocab | ||
call | ||
] [ | ||
[ current-vocab name>> ] dip ?tail drop set-current-vocab | ||
] bi ; inline | ||
|
||
: parse-platform-section ( string suffix -- ) | ||
[ | ||
[ [ string-lines parse-lines ] curry with-nested-compilation-unit ] | ||
curry | ||
] dip with-vocabulary drop ; inline | ||
|
||
SYNTAX: <UNIX | ||
"UNIX>" parse-multiline-string | ||
os unix? [ ".unix" parse-platform-section ] [ drop ] if ; | ||
|
||
SYNTAX: <MACOSX | ||
"MACOSX>" parse-multiline-string | ||
os macosx? [ ".macosx" parse-platform-section ] [ drop ] if ; | ||
|
||
SYNTAX: <LINUX | ||
"LINUX>" parse-multiline-string | ||
os linux? [ ".linux" parse-platform-section ] [ drop ] if ; | ||
|
||
SYNTAX: <WINDOWS | ||
"WINDOWS>" parse-multiline-string | ||
os windows? [ ".windows" parse-platform-section ] [ drop ] if ; |