File: erlang.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 (161 lines) | stat: -rw-r--r-- 3,596 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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/**
  * Name: erlang
  * Description: Erlang programming language.
  * Author: Sean Hinde 
  */


/* Erlang atom: ([a-z][a-zA-Z0-9_]*|\'[^\n]*\') */

state erlang extends HighlightEntry
{
   /* Comments */
   /%/ {
     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);
   }

   /* Special -record(rec_name, {}).  pre-processor case */
   /(-record)(\([ \t]*)([a-z][a-zA-Z0-9_]*|\'[^\n]*\')/ {
     reference_face (true);
     language_print ($1);
     reference_face (false);
     language_print ($2);
     type_face (true);
     language_print ($3);
     type_face (false);
   }

   /* Special -define(Alter, "Hello").  pre-processor case */
   /(-define)(\([ 
\t]*)([a-z][a-zA-Z0-9_]*|\'[^\n]*\'|[A-Z_][a-zA-Z0-9_]*)/ {
     reference_face (true);
     language_print ($1);
     reference_face (false);
     language_print ($2);
     builtin_face (true);
     language_print ($3);
     builtin_face (false);
   }

   /* Pre-processor lines. */
   /^-([a-z][a-zA-Z0-9_]*)/ {
     reference_face (true);
     language_print ($0);
     reference_face (false);
   }

   /* Defines */
   /(\?)([a-z][a-zA-Z0-9_]*|\'[^\n]*\'|[A-Z_][a-zA-Z0-9_]*)/ {
     language_print ($1);
     builtin_face (true);
     language_print ($2);
     builtin_face (false);
   }

   /* Records */
   /(#)([a-z][a-zA-Z0-9_]*|\'[^\n]*\')/ {
     language_print ($1);
     type_face (true);
     language_print ($2);
     type_face (false);
   }

   /* Keywords.
      '(after begin case try catch end fun if of receive when)
      Regexp taken from emacs Erlang mode R9C
   */
   /\b(a(fter|ndalso)|begin|c(atch|ase)\
|end|fun|if|o(f|relse)|receive|try|when\
|query)\b/ {
     keyword_face (true);
     language_print ($0);
     keyword_face (false);
   }

   /* Guards.
    Regexp taken from emacs Erlang mode R9C
   */
   /\b((is_)*(atom|function|binary|constant|float\
|integer|list|number|p(id|ort)\
|re(ference|cord)|tuple))\b/ {
     builtin_face (true);
     language_print ($0);
     builtin_face (false);
   }

   /* Built in functions */

/\b(a(bs|live|pply|tom_to_list)\
|binary_to_(list|term)\
|concat_binary|d(ate|isconnect_node)\
|e(lement|rase|xit)\
|float(|_to_list)\
|g(arbage_collect|et(|_keys)|roup_leader)\
|h(alt|d)\
|i(nte(ger_to_list|rnal_bif)|s_alive)\
|l(ength|i(nk|st_to_(atom|binary|float|integer\
|pid|tuple)))\
|make_ref|no(de(|_(link|unlink)|s)|talive)\
|open_port\
|p(id_to_list|rocess(_(flag|info)|es)|ut)\
|r(egister(|ed)|ound)\
|s(e(lf|telement)|ize\
|p(awn(|_link)|lit_binary)|tatistics)\
|t(erm_to_binary|hrow|ime|l\
|r(ace|unc)|uple_to_list)\
|un(link|register)|whereis)\b/ {
     keyword_face (true);
     language_print ($0);
     keyword_face (false);
   }

   /*
    * Function definitions.
    */
   /^([a-z][a-zA-Z0-9_]*|'[^\n]*')/ {
     function_name_face (true);
     language_print ($1);
     function_name_face (false);
     language_print ($2);
   }

   /* Atom like strings */
   /('[^\n]*')/ {
     string_face (true);
     language_print ($0);
     string_face (false);
   }

   /* Characters */
   /(\$.)/ {
     string_face (true);
     language_print ($0);
     string_face (false);
   }

   /* Variable Names */
   /*  /([\{\(\,\[ \t]+)([A-Z_][a-zA-Z0-9_]*)/ { */
   /([^a-z0-9_\"])([A-Z_][a-zA-Z0-9_]*)/ {
     language_print ($1);
     variable_name_face (true);
     language_print ($2);
     variable_name_face (false);
   }
}

/*
Local variables:
mode: erlang
End:
*/