PageRenderTime 23ms CodeModel.GetById 14ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/unmaintained/sandbox/sandbox.factor

http://github.com/abeaumont/factor
Unknown | 23 lines | 15 code | 8 blank | 0 comment | 0 complexity | 46ea91c0880de94f1187a914a829b69d MD5 | raw file
 1! Copyright (C) 2009 Maxim Savchenko.
 2! See http://factorcode.org/license.txt for BSD license.
 3
 4USING: kernel sequences vectors assocs namespaces parser lexer vocabs
 5       combinators.short-circuit vocabs.parser ;
 6
 7IN: sandbox
 8
 9SYMBOL: whitelist
10
11: with-sandbox-vocabs ( quot -- )
12    "sandbox.syntax" load-vocab vocab-words 1vector
13    use [ auto-use? off call ] with-variable ; inline
14
15: parse-sandbox ( lines assoc -- quot )
16    whitelist [ [ parse-lines ] with-sandbox-vocabs ] with-variable ;
17
18: reveal-in ( name -- )
19    [ { [ search ] [ no-word ] } 1|| ] keep current-vocab vocab-words set-at ;
20
21SYNTAX: REVEAL: scan reveal-in ;
22
23SYNTAX: REVEALING: ";" parse-tokens [ reveal-in ] each ;