1 ! Copyright (C) 2009 Keith Lazuka, Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: assocs colors colors.constants combinators
4 combinators.short-circuit hashtables io.styles kernel literals
5 namespaces sequences words words.symbol ;
6 IN: prettyprint.stylesheet
10 CONSTANT: dim-color COLOR: gray35
12 { POSTPONE: USING: POSTPONE: USE: POSTPONE: IN: }
14 { { foreground $ dim-color } }
15 "word-style" set-word-prop
18 PREDICATE: highlighted-word < word [ parsing-word? ] [ delimiter? ] bi or ;
22 GENERIC: word-style ( word -- style )
25 [ presented associate ]
26 [ "word-style" word-prop ] bi assoc-union! ;
28 M: highlighted-word word-style
30 COLOR: DarkSlateGray foreground pick set-at ;
34 : colored-presentation-style ( obj color -- style )
36 [ presented foreground ] dip
37 [ set-at ] curry bi-curry@ bi*
42 : string-style ( str -- style )
43 COLOR: LightSalmon4 colored-presentation-style ;
45 : vocab-style ( vocab -- style )
46 dim-color colored-presentation-style ;
48 SYMBOL: stack-effect-style
51 { foreground COLOR: FactorDarkGreen }
53 } stack-effect-style set-global
55 : effect-style ( effect -- style )
56 presented associate stack-effect-style get assoc-union! ;