Paste: sandbox.factor
Author: | Maxim Savchenko |
Mode: | factor |
Date: | Wed, 1 Apr 2009 19:59:47 |
Plain Text |
USING: kernel sequences vectors assocs namespaces parser lexer vocabs
combinators.short-circuit vocabs.parser ;
IN: sandbox
SYMBOL: whitelist
: with-sandbox-vocabs ( quot -- )
"sandbox.syntax" load-vocab vocab-words 1vector
use [ call ] with-variable ; inline
: parse-sandbox ( lines assoc -- quot )
whitelist [ [ parse-lines ] with-sandbox-vocabs ] with-variable ;
: reveal-in ( name -- )
[ { [ search ] [ no-word ] } 1|| ] keep current-vocab vocab-words set-at ;
SYNTAX: REVEAL: scan reveal-in ;
SYNTAX: <REVEAL "REVEAL>" parse-tokens [ reveal-in ] each ;
New Annotation