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