! Copyright (C) 2003, 2006 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. IN: prettyprint USING: arrays generic hashtables io kernel math namespaces sequences strings styles words ; : declaration. ( word prop -- ) tuck word-name word-prop [ pprint-word ] [ drop ] if ; : declarations. ( word -- ) { POSTPONE: parsing POSTPONE: inline POSTPONE: foldable POSTPONE: flushable } [ declaration. ] each-with ; : in. ( word -- ) string ( effect -- string ) [ "( " % dup first stack-picture % "-- " % second stack-picture % ")" % ] "" make ; : stack-effect ( word -- string ) dup "stack-effect" word-prop [ ] [ "infer-effect" word-prop dup [ [ dup integer? [ object ] when [ word-name ] map ] map effect>string ] when ] ?if ; : synopsis ( word -- string ) [ 0 margin set [ dup (synopsis) stack-effect comment. ] with-pprint ] string-out ; GENERIC: (see) ( word -- ) M: word (see) drop ; : pprint-; \ ; pprint-word ; : see-body ( quot word -- ) r pprint-word pprint-word r>