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-10 00:34:31 -04:00
|
|
|
USING: assocs colors colors.constants combinators
|
2009-09-11 21:45:03 -04:00
|
|
|
combinators.short-circuit hashtables io.styles kernel literals
|
2016-05-10 00:34:31 -04:00
|
|
|
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-11 21:45:03 -04:00
|
|
|
{ POSTPONE: USING: POSTPONE: USE: POSTPONE: IN: }
|
|
|
|
[
|
2016-05-10 00:34:31 -04:00
|
|
|
{ { foreground COLOR: gray35 } }
|
2009-09-11 21:45:03 -04:00
|
|
|
"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>
|
|
|
|
|
2016-05-10 00:34:31 -04:00
|
|
|
SYMBOL: base-word-style
|
|
|
|
H{ } base-word-style set-global
|
|
|
|
|
2009-09-11 21:45:03 -04:00
|
|
|
GENERIC: word-style ( word -- style )
|
|
|
|
|
|
|
|
M: word word-style
|
2016-05-10 00:34:31 -04:00
|
|
|
[ presented base-word-style get clone [ set-at ] keep ]
|
|
|
|
[ "word-style" word-prop ] bi assoc-union! ;
|
2009-09-11 21:45:03 -04:00
|
|
|
|
2016-05-10 00:34:31 -04:00
|
|
|
SYMBOL: highlighted-word-style
|
|
|
|
H{
|
|
|
|
{ foreground COLOR: DarkSlateGray }
|
|
|
|
} highlighted-word-style set-global
|
2009-09-11 21:45:03 -04:00
|
|
|
|
2016-05-10 00:34:31 -04:00
|
|
|
M: highlighted-word word-style
|
|
|
|
call-next-method highlighted-word-style get assoc-union! ;
|
2009-09-11 21:45:03 -04:00
|
|
|
|
2016-05-10 00:34:31 -04:00
|
|
|
SYMBOL: base-string-style
|
|
|
|
H{
|
|
|
|
{ foreground COLOR: LightSalmon4 }
|
|
|
|
} base-string-style set-global
|
2009-09-08 12:43:47 -04:00
|
|
|
|
2009-09-09 16:46:05 -04:00
|
|
|
: string-style ( str -- style )
|
2016-05-10 00:34:31 -04:00
|
|
|
presented base-string-style get clone [ set-at ] keep ;
|
|
|
|
|
|
|
|
SYMBOL: base-vocab-style
|
|
|
|
H{
|
|
|
|
{ foreground COLOR: gray35 }
|
|
|
|
} base-vocab-style set-global
|
2009-09-08 12:43:47 -04:00
|
|
|
|
|
|
|
: vocab-style ( vocab -- style )
|
2016-05-10 00:34:31 -04:00
|
|
|
presented base-vocab-style get clone [ set-at ] keep ;
|
2009-09-08 12:43:47 -04:00
|
|
|
|
2010-02-15 10:04:09 -05:00
|
|
|
SYMBOL: stack-effect-style
|
|
|
|
H{
|
2016-05-10 00:34:31 -04:00
|
|
|
{ foreground COLOR: FactorDarkGreen }
|
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 )
|
2016-05-10 00:34:31 -04:00
|
|
|
presented stack-effect-style get clone [ set-at ] keep ;
|