1 ! Copyright (C) 2021 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors assocs continuations formatting kernel
4 sequences ui.tools.debugger vocabs vocabs.parser ;
7 CONSTANT: vocab-renames {
8 { "math.intervals" { "intervals" "0.99" } }
9 { "math.ranges" { "ranges" "0.99" } }
10 { "asdfasdf" { "asdfasdf2" "0.99" } }
13 CONSTANT: word-renames {
14 { "lines" { "io:read-lines" "0.99" } }
15 { "lines" { "splitting:split-lines" "0.99" } }
16 { "words" { "splitting:split-words" "0.99" } }
17 { "contents" { "io:read-contents" "0.99" } }
18 { "exists?" { "io.files:file-exists?" "0.99" } }
19 { "string-lines" { "splitting:split-lines" "0.99" } }
20 { "split-lines" { "documents.private:?split-lines" "0.99" } }
21 { "[-inf,a)" { "math.intervals:[-inf,b)" "0.99" } }
22 { "[-inf,a]" { "math.intervals:[-inf,b]" "0.99" } }
23 { "(a,b)" { "math.ranges:(a..b)" "0.99" } }
24 { "(a,b]" { "math.ranges:(a..b]" "0.99" } }
25 { "[a,b)" { "math.ranges:[a..b)" "0.99" } }
26 { "[a,b]" { "math.ranges:[a..b]" "0.99" } }
27 { "assoc-merge" { "assocs.extras:assoc-collect" "0.99" } }
28 { "assoc-merge!" { "assocs.extras:assoc-collect!" "0.99" } }
29 { "peek-from" { "modern.html:peek1-from" "0.99" } }
30 { "in?" { "interval-sets:interval-in?" "0.99" } }
31 { "substitute" { "regexp.classes:(substitute)" "0.99" } }
32 { "combine" { "sets:union-all" "0.99" } }
33 { "refine" { "sets:intersect-all" "0.99" } }
34 { "read-json-objects" { "json.reader:read-json" "0.99" } }
35 { "iota" { "sequences:<iota>" ".98" } }
38 : compute-assoc-fixups ( continuation name assoc -- seq )
39 swap '[ drop _ = ] assoc-filter [
43 first2 dupd first2 "Fixup: %s renamed to %s in Factor %s" sprintf
44 swap drop no-op-action
49 GENERIC: compute-fixups ( continuation error -- seq )
51 M: object compute-fixups
52 [ error>> compute-fixups ] [ 3drop { } ] recover ;
54 M: f compute-fixups 2drop { } ;
56 M: no-vocab compute-fixups
57 name>> vocab-renames compute-assoc-fixups ;
59 M: no-word-error compute-fixups
60 name>> word-renames compute-assoc-fixups ;