! Copyright (C) 2003, 2005 Slava Pestov. ! See http://factor.sf.net/license.txt for BSD license. IN: prettyprint USING: generic hashtables io kernel lists 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 ; : comment. ( comment -- ) H{ { font-style italic } } text ; : stack-picture% ( seq -- string ) dup integer? [ object ] when [ word-name % " " % ] each ; : effect>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 [ effect>string ] when ] ?if ; : stack-effect. ( string -- ) [ "(" swap ")" append3 comment. ] when* ; : in. ( word -- ) r pprint-word pprint-word r>