]> gitweb.factorcode.org Git - factor.git/blob - basis/prettyprint/stylesheet/stylesheet.factor
prettyprint.stylesheet: fixed an error found by help-lint
[factor.git] / basis / prettyprint / stylesheet / stylesheet.factor
1 ! Copyright (C) 2009 Your name.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: colors.constants combinators combinators.short-circuit
4 hashtables io.styles kernel namespaces sequences words
5 words.symbol ;
6 IN: prettyprint.stylesheet
7
8 <PRIVATE
9
10 CONSTANT: dim-color COLOR: cornsilk4
11
12 : dimly-lit-word? ( word -- ? )
13     { POSTPONE: USING: POSTPONE: USE: POSTPONE: IN: } memq? ;
14
15 : parsing-word-color ( word -- color )
16     dimly-lit-word? dim-color COLOR: DarkSlateGray ? ;
17
18 PRIVATE>
19
20 : word-style ( word -- style )
21     dup "word-style" word-prop >hashtable [
22         [
23             [ presented set ] [
24                 {
25                     { [ dup parsing-word? ] [ parsing-word-color ] }
26                     { [ dup delimiter? ] [ drop COLOR: DarkSlateGray ] }
27                     { [ dup symbol? ] [ drop COLOR: DarkSlateGray ] }
28                     [ drop COLOR: black ]
29                 } cond foreground set
30             ] bi
31         ] bind
32     ] keep ;
33
34 : string-style ( str -- style )
35     [
36         presented set
37         COLOR: LightSalmon4 foreground set
38     ] H{ } make-assoc ;
39
40 : vocab-style ( vocab -- style )
41     [
42         presented set
43         dim-color foreground set
44     ] H{ } make-assoc ;
45
46 : effect-style ( effect -- style )
47     [
48         presented set
49         COLOR: DarkGreen foreground set
50     ] H{ } make-assoc ;