2009-09-11 21:45:03 -04:00
|
|
|
! Copyright (C) 2009 Keith Lazuka.
|
2009-09-08 12:43:47 -04:00
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2009-09-21 15:38:55 -04:00
|
|
|
USING: assocs colors colors.constants combinators
|
2009-09-11 21:45:03 -04:00
|
|
|
combinators.short-circuit hashtables io.styles kernel literals
|
|
|
|
namespaces sequences words words.symbol ;
|
2009-09-08 12:43:47 -04:00
|
|
|
IN: prettyprint.stylesheet
|
|
|
|
|
2009-09-09 15:27:49 -04:00
|
|
|
<PRIVATE
|
|
|
|
|
2009-09-10 09:48:20 -04:00
|
|
|
CONSTANT: dim-color COLOR: gray35
|
2009-09-09 15:27:49 -04:00
|
|
|
|
2009-09-11 21:45:03 -04:00
|
|
|
{ POSTPONE: USING: POSTPONE: USE: POSTPONE: IN: }
|
|
|
|
[
|
|
|
|
{ { foreground $ dim-color } }
|
|
|
|
"word-style" set-word-prop
|
|
|
|
] each
|
2009-09-09 15:27:49 -04:00
|
|
|
|
2009-09-11 21:45:03 -04:00
|
|
|
PREDICATE: highlighted-word < word [ parsing-word? ] [ delimiter? ] bi or ;
|
2009-09-09 15:27:49 -04:00
|
|
|
|
|
|
|
PRIVATE>
|
|
|
|
|
2009-09-11 21:45:03 -04:00
|
|
|
GENERIC: word-style ( word -- style )
|
|
|
|
|
|
|
|
M: word word-style
|
|
|
|
[ presented associate ]
|
|
|
|
[ "word-style" word-prop >hashtable ] bi assoc-union ;
|
|
|
|
|
|
|
|
M: highlighted-word word-style
|
|
|
|
call-next-method COLOR: DarkSlateGray foreground associate
|
|
|
|
swap assoc-union ;
|
|
|
|
|
|
|
|
<PRIVATE
|
|
|
|
|
|
|
|
: colored-presentation-style ( obj color -- style )
|
|
|
|
[ presented associate ] [ foreground associate ] bi* assoc-union ;
|
|
|
|
|
|
|
|
PRIVATE>
|
2009-09-08 12:43:47 -04:00
|
|
|
|
2009-09-09 16:46:05 -04:00
|
|
|
: string-style ( str -- style )
|
2009-09-11 21:45:03 -04:00
|
|
|
COLOR: LightSalmon4 colored-presentation-style ;
|
2009-09-08 12:43:47 -04:00
|
|
|
|
|
|
|
: vocab-style ( vocab -- style )
|
2009-09-11 21:45:03 -04:00
|
|
|
dim-color colored-presentation-style ;
|
2009-09-08 12:43:47 -04:00
|
|
|
|
2010-02-15 10:04:09 -05:00
|
|
|
SYMBOL: stack-effect-style
|
|
|
|
|
|
|
|
H{
|
|
|
|
{ foreground COLOR: FactorDarkGreen }
|
|
|
|
{ font-style plain }
|
|
|
|
} stack-effect-style set-global
|
|
|
|
|
2009-09-08 12:43:47 -04:00
|
|
|
: effect-style ( effect -- style )
|
2009-09-28 08:47:03 -04:00
|
|
|
presented associate stack-effect-style get assoc-union ;
|