File: dylan.st

package info (click to toggle)
enscript 1.6.5.90-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 7,264 kB
  • ctags: 4,824
  • sloc: ansic: 33,705; sh: 5,383; makefile: 649; yacc: 457; lex: 428; perl: 340; lisp: 109; sed: 16
file content (124 lines) | stat: -rw-r--r-- 3,009 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/**
 * Name: dylan
 * Description: Dylan Programming Language template for Enscript.
 * Author: Brent Fulgham <bfulgham@debian.org>
 * (based on the Scheme version by Markku Rossi <mtr@iki.fi>)
 */

dylan_mod_re =
/* Definition Modifiers
  (build-re '(abstract block concrete constant class domain exception exclude
  export function functional generic handler import inherited inline
  instance interface library macro method open primary sealed sideways
  singleton slot subclass variable virtual))
  */
  /\b(subclass|abstract|block|c(on(crete|stant)|lass)|domain\
|ex(c(eption|lude)|port)|f(unction(|al))|generic|handler\
|i(n(herited|line|stance|terface)|mport)|library|m(acro|ethod)\
|open|primary|sealed|si(deways|ngleton)|slot\
|v(ariable|irtual))\b/;

state dylan extends HighlightEntry
{
  BEGIN {
    /*
     * Modify regexp character syntax so that we can distinguish all
     * dylan symbols.
     */
    extras = list ('!', '$', '%', '&', '*', '/', ':', 
		   '=', '?', '~', '^', '.', '+', '-');
    for (i = 0; i < length (extras); i = i + 1)
      regexp_syntax (extras[i], 'w');
  }

  /* Modifiers */
  dylan_mod_re {
    reference_face (true);
    language_print ($0);
    reference_face (false);
  }

  /* Types */
  /<\w+>/ {
    type_face (true);
    language_print ($0);
    type_face (false);
  }

  /* Symbols */
  /#\"/ {
    string_face (true);
    language_print ($0);
    call (c_string);
    string_face (false);
  }

  /* Comments. */
  /\/\// {
    comment_face (true);
    language_print ($0);
    call (eat_one_line);
    comment_face (false);
  }
  /\/\*/ {
    comment_face (true);
    language_print ($0);
    call (eat_one_line);
    comment_face (false);
  }

  /* String constants. */
  /\"/ {
    string_face (true);
    language_print ($0);
    call (c_string);
    string_face (false);
  }

  /* Character constants. */
  /'.*'/ {
    string_face (true);
    language_print ($0);
    string_face (false);
  }
    
  /* Keywords.
     "=>" +
     (build-re '(above afterwards begin below by case cleanup create
     define end else elseif finally for from if in let local otherwise rename
     select signal then to unless until use variable virtual when while
   */
  /=>|\b(a(bove|fterwards)|b(e(gin|low)|y)|c(ase|leanup|reate)\
|define|else(|if)|end|f(inally|or|rom)|i[fn]|l(et|ocal)|otherwise\
|rename|s(elect|ignal)|t(hen|o)|u(n(less|til)|se)|wh(en|ile))\b/ {
    keyword_face (true);
    language_print ($0);
    keyword_face (false);
  }

  /* ':'-names, Emacs highlights these, so do we. */
  /([ \t])([!\$%&\*\/:<=>\?~_^a-zA-Z0-9.+\-]*:)/ {
    language_print ($1);
    reference_face (true);
    language_print ($2);
    reference_face (false);
  }

  /* Function faces */
  /([ \t]*)(\w+[^:])([ \t]*\([ \t]*)/ {
    language_print ($1);
    function_name_face(true);
    face_on(face_bold_italic);
    language_print ($2);
    face_off(face_bold_italic);
    function_name_face(false);
    language_print ($3);
  }
}


/*
Local variables:
mode: c
End:
*/