1 ! Copyright (C) 2009 Keith Lazuka, Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: assocs colors io.styles kernel namespaces sequences words ;
4 IN: prettyprint.stylesheet
8 { POSTPONE: USING: POSTPONE: USE: POSTPONE: IN: }
10 { { foreground COLOR: gray35 } }
11 "word-style" set-word-prop
14 PREDICATE: highlighted-word < word [ parsing-word? ] [ delimiter? ] bi or ;
18 SYMBOL: base-word-style
19 H{ } base-word-style set-global
21 GENERIC: word-style ( word -- style )
24 [ presented base-word-style get clone [ set-at ] keep ]
25 [ "word-style" word-prop ] bi assoc-union! ;
27 SYMBOL: highlighted-word-style
29 { foreground COLOR: DarkSlateGray }
30 } highlighted-word-style set-global
32 M: highlighted-word word-style
33 call-next-method highlighted-word-style get assoc-union! ;
35 SYMBOL: base-string-style
37 { foreground COLOR: LightSalmon4 }
38 } base-string-style set-global
40 : string-style ( str -- style )
41 presented base-string-style get clone [ set-at ] keep ;
43 SYMBOL: base-vocab-style
45 { foreground COLOR: gray35 }
46 } base-vocab-style set-global
48 : vocab-style ( vocab -- style )
49 presented base-vocab-style get clone [ set-at ] keep ;
51 SYMBOL: base-effect-style
53 { foreground COLOR: FactorDarkSlateBlue }
55 } base-effect-style set-global
57 : effect-style ( effect -- style )
58 presented base-effect-style get clone [ set-at ] keep ;