prettyprint: cleanup using.
parent
17386d0608
commit
e2fc9f003a
|
@ -1,10 +1,9 @@
|
||||||
! Copyright (C) 2005, 2010 Slava Pestov.
|
! Copyright (C) 2005, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors arrays generic hashtables io kernel assocs math
|
USING: accessors assocs continuations debugger fry hashtables io
|
||||||
namespaces prettyprint prettyprint.custom prettyprint.sections
|
io.styles kernel math mirrors namespaces prettyprint
|
||||||
sequences strings io.styles vectors words quotations mirrors
|
prettyprint.custom prettyprint.sections sequences sets sorting
|
||||||
splitting math.parser classes vocabs sets sorting summary
|
summary ;
|
||||||
debugger continuations fry combinators ;
|
|
||||||
FROM: namespaces => set ;
|
FROM: namespaces => set ;
|
||||||
IN: inspector
|
IN: inspector
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
! Copyright (C) 2003, 2009 Slava Pestov.
|
! Copyright (C) 2003, 2009 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors arrays assocs byte-arrays byte-vectors classes
|
USING: accessors arrays assocs byte-arrays byte-vectors classes
|
||||||
classes.algebra.private classes.intersection classes.maybe
|
classes.algebra.private classes.maybe classes.private
|
||||||
classes.tuple classes.tuple.private classes.union colors
|
classes.tuple combinators continuations effects generic
|
||||||
colors.constants combinators continuations effects generic
|
hash-sets hashtables io.pathnames io.styles kernel make math
|
||||||
hash-sets hashtables io io.pathnames io.styles kernel
|
math.order math.parser namespaces prettyprint.config
|
||||||
make math math.order math.parser namespaces prettyprint.config
|
|
||||||
prettyprint.custom prettyprint.sections prettyprint.stylesheet
|
prettyprint.custom prettyprint.sections prettyprint.stylesheet
|
||||||
quotations sbufs sequences strings vectors words words.symbol
|
quotations sbufs sequences strings vectors words ;
|
||||||
classes.private ;
|
|
||||||
FROM: sets => members ;
|
FROM: sets => members ;
|
||||||
IN: prettyprint.backend
|
IN: prettyprint.backend
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
! Copyright (C) 2003, 2010 Slava Pestov.
|
! Copyright (C) 2003, 2010 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: arrays generic hashtables io kernel math assocs
|
USING: accessors classes.maybe combinators
|
||||||
namespaces make sequences strings io.styles vectors words
|
combinators.short-circuit continuations hashtables io io.styles
|
||||||
prettyprint.config splitting classes continuations
|
kernel make math namespaces prettyprint.config sequences sets
|
||||||
accessors sets vocabs.parser combinators vocabs
|
splitting strings vocabs vocabs.parser words ;
|
||||||
classes.maybe combinators.short-circuit ;
|
|
||||||
FROM: sets => members ;
|
FROM: sets => members ;
|
||||||
FROM: namespaces => set ;
|
FROM: namespaces => set ;
|
||||||
IN: prettyprint.sections
|
IN: prettyprint.sections
|
||||||
|
@ -48,20 +47,23 @@ M: maybe vocabulary-name
|
||||||
: do-indent ( -- ) pprinter get indent>> CHAR: \s <string> write ;
|
: do-indent ( -- ) pprinter get indent>> CHAR: \s <string> write ;
|
||||||
|
|
||||||
: fresh-line ( n -- )
|
: fresh-line ( n -- )
|
||||||
dup pprinter get last-newline>> = [
|
pprinter get 2dup last-newline>> = [
|
||||||
drop
|
2drop
|
||||||
] [
|
] [
|
||||||
pprinter get last-newline<<
|
swap >>last-newline
|
||||||
line-limit? [
|
line-limit? [
|
||||||
"..." write pprinter get return
|
"..." write return
|
||||||
] when
|
] when
|
||||||
pprinter get [ 1 + ] change-line-count drop
|
[ 1 + ] change-line-count drop
|
||||||
nl do-indent
|
nl do-indent
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
: text-fits? ( len -- ? )
|
: text-fits? ( len -- ? )
|
||||||
margin get
|
margin get [
|
||||||
[ drop t ] [ [ pprinter get indent>> + ] dip <= ] if-zero ;
|
drop t
|
||||||
|
] [
|
||||||
|
[ pprinter get indent>> + ] dip <=
|
||||||
|
] if-zero ;
|
||||||
|
|
||||||
! Section protocol
|
! Section protocol
|
||||||
GENERIC: section-fits? ( section -- ? )
|
GENERIC: section-fits? ( section -- ? )
|
||||||
|
@ -213,7 +215,7 @@ M: block short-section ( block -- )
|
||||||
TUPLE: text-section < section string ;
|
TUPLE: text-section < section string ;
|
||||||
|
|
||||||
: <text> ( string style -- text )
|
: <text> ( string style -- text )
|
||||||
over length 1 + \ text-section new-section
|
over length 1 + text-section new-section
|
||||||
swap >>style
|
swap >>style
|
||||||
swap >>string ;
|
swap >>string ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue