/unmaintained/sandbox/sandbox.factor

http://github.com/abeaumont/factor · Factor · 23 lines · 13 code · 8 blank · 2 comment · 1 complexity · 46ea91c0880de94f1187a914a829b69d MD5 · raw file

  1. ! Copyright (C) 2009 Maxim Savchenko.
  2. ! See http://factorcode.org/license.txt for BSD license.
  3. USING: kernel sequences vectors assocs namespaces parser lexer vocabs
  4. combinators.short-circuit vocabs.parser ;
  5. IN: sandbox
  6. SYMBOL: whitelist
  7. : with-sandbox-vocabs ( quot -- )
  8. "sandbox.syntax" load-vocab vocab-words 1vector
  9. use [ auto-use? off call ] with-variable ; inline
  10. : parse-sandbox ( lines assoc -- quot )
  11. whitelist [ [ parse-lines ] with-sandbox-vocabs ] with-variable ;
  12. : reveal-in ( name -- )
  13. [ { [ search ] [ no-word ] } 1|| ] keep current-vocab vocab-words set-at ;
  14. SYNTAX: REVEAL: scan reveal-in ;
  15. SYNTAX: REVEALING: ";" parse-tokens [ reveal-in ] each ;