2013-04-25 16:26:36 -04:00
|
|
|
! Copyright (C) 2009 Keith Lazuka, Slava Pestov.
|
2009-09-08 12:43:47 -04:00
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2016-05-03 13:27:03 -04:00
|
|
|
USING: assocs colors combinators
|
2009-09-11 21:45:03 -04:00
|
|
|
combinators.short-circuit hashtables io.styles kernel literals
|
2016-05-08 04:09:44 -04:00
|
|
|
namespaces sequences ui.theme 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-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 ]
|
2016-05-04 15:57:04 -04:00
|
|
|
[ "word-style" word-prop ] bi assoc-union!
|
|
|
|
text-color foreground pick set-at ;
|
2009-09-11 21:45:03 -04:00
|
|
|
|
|
|
|
M: highlighted-word word-style
|
2015-07-10 15:37:31 -04:00
|
|
|
call-next-method
|
2016-05-03 13:27:03 -04:00
|
|
|
highlighted-word-color foreground pick set-at ;
|
2009-09-11 21:45:03 -04:00
|
|
|
|
|
|
|
<PRIVATE
|
|
|
|
|
|
|
|
: colored-presentation-style ( obj color -- style )
|
2015-07-18 02:05:19 -04:00
|
|
|
2 <hashtable> [
|
2015-07-10 15:37:31 -04:00
|
|
|
[ presented foreground ] dip
|
|
|
|
[ set-at ] curry bi-curry@ bi*
|
|
|
|
] keep ;
|
2009-09-11 21:45:03 -04:00
|
|
|
|
|
|
|
PRIVATE>
|
2009-09-08 12:43:47 -04:00
|
|
|
|
2009-09-09 16:46:05 -04:00
|
|
|
: string-style ( str -- style )
|
2016-05-03 13:27:03 -04:00
|
|
|
string-color 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{
|
2016-05-03 13:27:03 -04:00
|
|
|
{ foreground $ stack-effect-color }
|
2010-02-15 10:04:09 -05:00
|
|
|
{ font-style plain }
|
|
|
|
} stack-effect-style set-global
|
|
|
|
|
2009-09-08 12:43:47 -04:00
|
|
|
: effect-style ( effect -- style )
|
2015-07-18 02:05:19 -04:00
|
|
|
presented associate stack-effect-style get assoc-union! ;
|