Better prettyprinting of method-body instances

db4
Slava Pestov 2009-04-24 00:20:33 -05:00
parent 00b6107d3b
commit 2e115dc5c3
2 changed files with 9 additions and 8 deletions

View File

@ -54,7 +54,7 @@ M: word article-title
dup [ parsing-word? ] [ symbol? ] bi or [ dup [ parsing-word? ] [ symbol? ] bi or [
name>> name>>
] [ ] [
[ name>> ] [ unparse ]
[ stack-effect [ effect>string " " prepend ] [ "" ] if* ] bi [ stack-effect [ effect>string " " prepend ] [ "" ] if* ] bi
append append
] if ; ] if ;

View File

@ -35,8 +35,8 @@ M: effect pprint* effect>string "(" ")" surround text ;
name>> "( no name )" or ; name>> "( no name )" or ;
: pprint-word ( word -- ) : pprint-word ( word -- )
dup record-vocab [ record-vocab ]
dup word-name* swap word-style styled-text ; [ [ word-name* ] [ word-style ] bi styled-text ] bi ;
: pprint-prefix ( word quot -- ) : pprint-prefix ( word quot -- )
<block swap pprint-word call block> ; inline <block swap pprint-word call block> ; inline
@ -48,11 +48,12 @@ M: word pprint*
[ pprint-word ] [ ?start-group ] [ ?end-group ] tri ; [ pprint-word ] [ ?start-group ] [ ?end-group ] tri ;
M: method-body pprint* M: method-body pprint*
<block [
\ M\ pprint-word [
[ "method-class" word-prop pprint-word ] [ "M\\ " % "method-class" word-prop word-name* % ]
[ "method-generic" word-prop pprint-word ] bi [ " " % "method-generic" word-prop word-name* % ] bi
block> ; ] "" make
] [ word-style ] bi styled-text ;
M: real pprint* number>string text ; M: real pprint* number>string text ;