! Copyright (C) 2008, 2010 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
-USING: arrays combinators continuations effects kernel lexer
-make parser sequences sets splitting vocabs.parser words ;
+USING: accessors arrays combinators continuations effects kernel
+lexer make namespaces parser sequences sets splitting
+vocabs.parser words ;
IN: effects.parser
DEFER: parse-effect
ERROR: can't-nest-definitions word ;
: set-in-definition ( -- )
- current-vocab in-definition ?adjoin
+ manifest get current-vocab>> t or in-definition ?adjoin
[ last-word can't-nest-definitions ] unless ;
: unset-in-definition ( -- )
- current-vocab in-definition delete ;
+ manifest get current-vocab>> t or in-definition delete ;
: with-definition ( quot -- )
[ set-in-definition ] prepose [ unset-in-definition ] [ ] cleanup ; inline
] unit-test
{ } [
- "IN: azz2 USE: azz M: my-class a-generic ;"
+ "USE: azz M: my-class a-generic ;"
<string-reader> "azz-2" parse-stream drop
] unit-test
] unit-test
{ } [
- "IN: azz-2 USE: azz USE: math M: integer a-generic ;"
+ "USE: azz USE: math M: integer a-generic ;"
<string-reader> "azz-2" parse-stream drop
] unit-test