refactor lint, add lint-vocab/lint-word
parent
304aa98fe7
commit
11dcb41546
|
@ -121,7 +121,7 @@ M: word lint ( word -- seq )
|
|||
: word-path. ( word -- )
|
||||
[ word-vocabulary ":" ] keep unparse 3append write nl ;
|
||||
|
||||
: lint. ( array -- )
|
||||
: (lint.) ( pair -- )
|
||||
first2 >r word-path. r> [
|
||||
bl bl bl bl
|
||||
dup .
|
||||
|
@ -129,6 +129,9 @@ M: word lint ( word -- seq )
|
|||
def-hash get at [ bl bl bl bl word-path. ] each
|
||||
nl
|
||||
] each nl nl ;
|
||||
|
||||
: lint. ( alist -- )
|
||||
[ (lint.) ] each ;
|
||||
|
||||
|
||||
GENERIC: run-lint ( obj -- obj )
|
||||
|
@ -143,21 +146,29 @@ GENERIC: run-lint ( obj -- obj )
|
|||
: trim-self ( seq -- newseq )
|
||||
[ [ (trim-self) ] subset ] assoc-map ;
|
||||
|
||||
: filter-symbols ( alist -- alist )
|
||||
[
|
||||
nip first dup def-hash get at
|
||||
[ first ] 2apply literalize = not
|
||||
] assoc-subset ;
|
||||
|
||||
M: sequence run-lint ( seq -- seq )
|
||||
[
|
||||
global [ dup . flush ] bind
|
||||
dup lint
|
||||
] { } map>assoc
|
||||
trim-self
|
||||
[ second empty? not ] subset ;
|
||||
[ second empty? not ] subset
|
||||
filter-symbols ;
|
||||
|
||||
M: word run-lint ( word -- seq )
|
||||
1array run-lint ;
|
||||
|
||||
: lint-all ( -- seq )
|
||||
all-words run-lint
|
||||
[
|
||||
nip first dup def-hash get at
|
||||
[ first ] 2apply literalize = not
|
||||
] assoc-subset
|
||||
dup [ lint. ] each ;
|
||||
all-words run-lint dup lint. ;
|
||||
|
||||
: lint-vocab ( vocab -- seq )
|
||||
words run-lint dup lint. ;
|
||||
|
||||
: lint-word ( word -- seq )
|
||||
1array run-lint dup lint. ;
|
||||
|
|
Loading…
Reference in New Issue