]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/fixups/fixups.factor
factor: trim using lists
[factor.git] / basis / fixups / fixups.factor
index b73788d2ba0cd58ecbe40b257c3eecb674976806..6404add671bd43a7a949ac073c67dc98f2b44699 100644 (file)
@@ -1,37 +1,41 @@
 ! Copyright (C) 2021 Doug Coleman.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors assocs continuations formatting kernel
-sequences vocabs vocabs.parser ;
+USING: accessors assocs continuations kernel sequences
+vocabs vocabs.parser ;
 IN: fixups
 
 CONSTANT: vocab-renames {
-    { "math.intervals" { "intervals" ".99" } }
-    { "math.ranges" { "ranges" ".99" } }
-    { "asdfasdf" { "asdfasdf2" ".99" } }
+    { "math.intervals" { "intervals" "0.99" } }
+    { "math.ranges" { "ranges" "0.99" } }
+    { "unicode.collation" { "unicode" "0.99" } }
 }
 
 CONSTANT: word-renames {
-    { "lines" { "io:read-lines" ".99" } }
-    { "lines" { "splitting:split-lines" ".99" } }
-    { "words" { "splitting:split-words" ".99" } }
-    { "contents" { "io:read-contents" ".99" } }
-    { "exists?" { "io.files:file-exists?" ".99" } }
-    { "string-lines" { "splitting:split-lines" ".99" } }
-    { "split-lines" { "documents.private:?split-lines" ".99" } }
-    { "[-inf,a)" { "math.intervals:[-inf,b)" ".99" } }
-    { "[-inf,a]" { "math.intervals:[-inf,b]" ".99" } }
-    { "(a,b)" { "math.ranges:(a..b)" ".99" } }
-    { "(a,b]" { "math.ranges:(a..b]" ".99" } }
-    { "[a,b)" { "math.ranges:[a..b)" ".99" } }
-    { "[a,b]" { "math.ranges:[a..b]" ".99" } }
-    { "assoc-merge" { "assocs.extras:assoc-collect" ".99" } }
-    { "assoc-merge!" { "assocs.extras:assoc-collect!" ".99" } }
-    { "peek-from" { "modern.html:peek1-from" ".99" } }
-    { "in?" { "interval-sets:interval-in?" ".99" } }
-    { "substitute" { "regexp.classes:(substitute)" ".99" } }
-    { "combine" { "sets:union-all" ".99" } }
-    { "refine" { "sets:intersect-all" ".99" } }
-    { "read-json-objects" { "json.reader:read-json" ".99" } }
+    { "lines" { "io:read-lines" "0.99" } }
+    { "words" { "splitting:split-words" "0.99" } }
+    { "contents" { "io:read-contents" "0.99" } }
+    { "exists?" { "io.files:file-exists?" "0.99" } }
+    { "string-lines" { "splitting:split-lines" "0.99" } }
+    { "[-inf,a)" { "math.intervals:[-inf,b)" "0.99" } }
+    { "[-inf,a]" { "math.intervals:[-inf,b]" "0.99" } }
+    { "(a,b)" { "ranges:(a..b)" "0.99" } }
+    { "(a,b]" { "ranges:(a..b]" "0.99" } }
+    { "[a,b)" { "ranges:[a..b)" "0.99" } }
+    { "[a,b]" { "ranges:[a..b]" "0.99" } }
+    { "[0,b)" { "ranges:[0..b)" "0.99" } }
+    { "[0,b]" { "ranges:[0..b]" "0.99" } }
+    { "[1,b)" { "ranges:[1..b)" "0.99" } }
+    { "[1,b]" { "ranges:[1..b]" "0.99" } }
+    { "assoc-merge" { "assocs.extras:assoc-collect" "0.99" } }
+    { "assoc-merge!" { "assocs.extras:assoc-collect!" "0.99" } }
+    { "peek-from" { "modern.html:peek1-from" "0.99" } }
+    { "in?" { "interval-sets:interval-in?" "0.99" } }
+    { "substitute" { "regexp.classes:(substitute)" "0.99" } }
+    { "combine" { "sets:union-all" "0.99" } }
+    { "refine" { "sets:intersect-all" "0.99" } }
+    { "read-json-objects" { "json.reader:read-json" "0.99" } }
+    { "init-namespaces" { "namespaces:init-namestack" "0.99" } }
+    { "iota" { "sequences:<iota>" ".98" } }
 }
 
 : compute-assoc-fixups ( continuation name assoc -- seq )
@@ -39,8 +43,9 @@ CONSTANT: word-renames {
         drop { }
     ] [
         swap '[
-            first2 dupd first2 "Fixup: `%s` got renamed to `%s` in %s" sprintf
-            swap drop f
+            first2 dupd first2
+            " in Factor " glue " renamed to " glue "Fixup: " prepend
+            swap drop no-op-restart
             _ <restart>
         ] map
     ] if-empty ;
@@ -48,12 +53,12 @@ CONSTANT: word-renames {
 GENERIC: compute-fixups ( continuation error -- seq )
 
 M: object compute-fixups
-    error>> compute-fixups ;
+    [ error>> compute-fixups ] [ 3drop { } ] recover ;
 
 M: f compute-fixups 2drop { } ;
 
 M: no-vocab compute-fixups
-    name>> vocab-renames compute-assoc-fixups ;
+    [ name>> vocab-renames compute-assoc-fixups ] [ drop { } ] if* ;
 
 M: no-word-error compute-fixups
-    name>> word-renames compute-assoc-fixups ;
+    [ name>> word-renames compute-assoc-fixups ] [ drop { } ] if* ;