2009-09-08 12:43:47 -04:00
|
|
|
! Copyright (C) 2009 Your name.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2009-09-09 15:27:49 -04:00
|
|
|
USING: colors.constants combinators combinators.short-circuit
|
|
|
|
hashtables io.styles kernel 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
|
|
|
|
|
|
|
|
CONSTANT: dim-color COLOR: cornsilk4
|
|
|
|
|
|
|
|
: dimly-lit-word? ( word -- ? )
|
|
|
|
{ POSTPONE: USING: POSTPONE: USE: POSTPONE: IN: } memq? ;
|
|
|
|
|
|
|
|
: parsing-word-color ( word -- color )
|
|
|
|
dimly-lit-word? dim-color COLOR: DarkSlateGray ? ;
|
|
|
|
|
|
|
|
PRIVATE>
|
|
|
|
|
2009-09-08 12:43:47 -04:00
|
|
|
: word-style ( word -- style )
|
|
|
|
dup "word-style" word-prop >hashtable [
|
|
|
|
[
|
|
|
|
[ presented set ] [
|
2009-09-09 15:27:49 -04:00
|
|
|
{
|
|
|
|
{ [ dup parsing-word? ] [ parsing-word-color ] }
|
|
|
|
{ [ dup delimiter? ] [ drop COLOR: DarkSlateGray ] }
|
|
|
|
{ [ dup symbol? ] [ drop COLOR: DarkSlateGray ] }
|
|
|
|
[ drop COLOR: black ]
|
|
|
|
} cond foreground set
|
2009-09-08 12:43:47 -04:00
|
|
|
] bi
|
|
|
|
] bind
|
|
|
|
] keep ;
|
|
|
|
|
|
|
|
: string-style ( obj -- style )
|
|
|
|
[
|
|
|
|
presented set
|
|
|
|
COLOR: LightSalmon4 foreground set
|
|
|
|
] H{ } make-assoc ;
|
|
|
|
|
|
|
|
: vocab-style ( vocab -- style )
|
|
|
|
[
|
|
|
|
presented set
|
2009-09-09 15:27:49 -04:00
|
|
|
dim-color foreground set
|
2009-09-08 12:43:47 -04:00
|
|
|
] H{ } make-assoc ;
|
|
|
|
|
|
|
|
: effect-style ( effect -- style )
|
|
|
|
[
|
|
|
|
presented set
|
|
|
|
COLOR: DarkGreen foreground set
|
|
|
|
] H{ } make-assoc ;
|