]> gitweb.factorcode.org Git - factor.git/commitdiff
vocabs.parser: make a with-words combinator that cleans up.
authorJohn Benediktsson <mrjbq7@gmail.com>
Tue, 15 Dec 2020 03:17:33 +0000 (19:17 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 15 Dec 2020 03:17:33 +0000 (19:17 -0800)
Some places where we use-words / unuse-words could leave the manifest
with extra-words if not cleaned up properly.

core/vocabs/parser/parser.factor

index 7993e10c21bdaf644a4d06bf6c68208b0531be61..2cbd038c358e6461bc51a164559ef2af507fbb32 100644 (file)
@@ -175,6 +175,9 @@ TUPLE: rename word vocab words ;
 : unuse-words ( assoc -- )
     <extra-words> qualified-vocabs remove! drop ;
 
+: with-words ( assoc quot -- )
+    [ use-words ] prepose [ ] pick '[ _ unuse-words ] cleanup ; inline
+
 TUPLE: ambiguous-use-error name words ;
 
 : <ambiguous-use-error> ( name words -- error restarts )