]> gitweb.factorcode.org Git - factor.git/commitdiff
vocabs.parser: all USE: vocabs are also QUALIFIED:.
authorJohn Benediktsson <mrjbq7@gmail.com>
Tue, 29 Mar 2016 16:59:58 +0000 (09:59 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 29 Mar 2016 17:20:16 +0000 (10:20 -0700)
basis/debugger/debugger.factor
core/vocabs/parser/parser.factor

index 866a5685d3022a411e1e2c4ca0865c14ba228feb..3621132a131dde762288e4ea3d82e5d0e646e63b 100755 (executable)
@@ -310,8 +310,8 @@ M: no-word-in-vocab summary
 M: no-word-in-vocab error. summary print ;
 
 M: ambiguous-use-error summary
-    words>> first name>>
-    "More than one vocabulary defines a word named “" "”" surround ;
+    name>>
+    "The name “" "” resolves to more than one word." surround ;
 
 M: ambiguous-use-error error. summary print ;
 
index 91827f9f5687bb9dfcd3f9ce2a2be5e1facabe35..4249fe3c270ee8a959a298f213eaf41da9609ac4 100644 (file)
@@ -175,20 +175,26 @@ TUPLE: rename word vocab words ;
 : unuse-words ( assoc -- )
     <extra-words> qualified-vocabs remove! drop ;
 
-TUPLE: ambiguous-use-error words ;
+TUPLE: ambiguous-use-error name words ;
 
-: <ambiguous-use-error> ( words -- error restarts )
+: <ambiguous-use-error> ( name words -- error restarts )
     [ ambiguous-use-error boa ] [ word-restarts ] bi ;
 
 <PRIVATE
 
-: (vocab-search) ( name assocs -- words n )
-    [ words>> (lookup) ] with map sift dup length ;
+: (vocab-search) ( name assocs -- words )
+    [ words>> (lookup) ] with map sift ;
+
+: (vocab-search-qualified) ( name assocs -- words )
+    [ ":" split1 swap ] dip [ name>> = ] with filter (vocab-search) ;
+
+: (vocab-search-full) ( name assocs -- words )
+    [ (vocab-search-qualified) ] [ (vocab-search) ] 2bi append ;
 
 : vocab-search ( name manifest -- word/f )
-    search-vocabs>> (vocab-search) {
-        { 0 [ drop f ] }
-        { 1 [ first ] }
+    dupd search-vocabs>> (vocab-search-full) dup length {
+        { 0 [ 2drop f ] }
+        { 1 [ first nip ] }
         [
             drop <ambiguous-use-error> throw-restarts
             dup [ vocabulary>> ] [ name>> 1array ] bi add-words-from
@@ -196,8 +202,7 @@ TUPLE: ambiguous-use-error words ;
     } case ;
 
 : qualified-search ( name manifest -- word/f )
-    qualified-vocabs>>
-    (vocab-search) 0 = [ drop f ] [ last ] if ;
+    qualified-vocabs>> (vocab-search) ?last ;
 
 PRIVATE>