Fix unresolved implicit dependency of c_ppline.st state on c.st
[enscript.git] / states / hl / scheme.st
1 /**
2  * Name: scheme
3  * Description: Scheme programming language.
4  * Author: Markku Rossi <mtr@iki.fi>
5  */
6
7 state scheme extends HighlightEntry
8 {
9   BEGIN {
10     /*
11      * Modify regexp character syntax so that we can distinguish all
12      * scheme symbols.
13      */
14     extras = list ('!', '$', '%', '&', '*', '/', ':', '<',
15                    '=', '>', '?', '~', '^', '.', '+', '-');
16     for (i = 0; i < length (extras); i = i + 1)
17       regexp_syntax (extras[i], 'w');
18   }
19
20   /* Comments. */
21   /;/ {
22     comment_face (true);
23     language_print ($0);
24     call (eat_one_line);
25     comment_face (false);
26   }
27
28   /* String constants. */
29   /\"/ {
30     string_face (true);
31     language_print ($0);
32     call (c_string);
33     string_face (false);
34   }
35
36   /* Definitions. */
37   /(\([ \t]*)(define)([ \t]+\(?)([!\$%&\*\/:<=>\?~_^a-zA-Z][!\$%&\*\/:<=>\?~_^a-zA-Z0-9.+\-]*)/ {
38     /* Starting garbage. */
39     language_print ($1);
40
41     /* Keyword `define'. */
42     keyword_face (true);
43     language_print ($2);
44     keyword_face (false);
45
46     /* Middle garbage. */
47     language_print ($3);
48
49     /* Function name. */
50     function_name_face (true);
51     language_print ($4);
52     function_name_face (false);
53   }
54
55   /* ':'-names, Emacs highlights these, so do we. */
56   /([ \t])(:[!\$%&\*\/:<=>\?~_^a-zA-Z0-9.+\-]*)/ {
57     language_print ($1);
58     reference_face (true);
59     language_print ($2);
60     reference_face (false);
61   }
62
63   /* Keywords.
64      "=>" + "set!" +
65      (build-re '(else define unquote unquote-splicing quote lambda
66      if begin cond and or case let let* letrec do delay quasiquote))
67    */
68   /=>|\bset!|\b(and|begin|c(ase|ond)|d(e(fine|lay)|o)|else|if\
69 |l(ambda|et(|\*|rec))|or|qu(asiquote|ote)|unquote(|-splicing))\b/ {
70     keyword_face (true);
71     language_print ($0);
72     keyword_face (false);
73   }
74 }
75
76 \f
77 /*
78 Local variables:
79 mode: c
80 End:
81 */