File: eiffel.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 (132 lines) | stat: -rw-r--r-- 3,737 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
/**
 * Name: eiffel
 * Description: Eiffel programming language.
 * Author: Julien Lemoine <speedblue@happycoders.org>
 *         Brent Fulgham <bfulgham@debian.org>
 */

eiffel_types =
/* Types */
  /\b(ABSTRACT_(FRACTION|INTEGER)|ANY|AR(GUMENTS|RAY(|2|3|ED_COLLECTION))\
|BASIC_(DIRECTORY|TIME)|BINARY_FILE_(READ|WRITE)|BIT_(N|STRING)|BOOLEAN\
|CHARACTER(|_CONSTANTS)|CLOCK|COLLECTION(|2|3|_SORTER)|COMPARABLE\
|COUNTER|DICTIONARY(|_NODE)|D(IRECTORY|OUBLE)|EXCEPTIONS|FILE(|_TOOLS)\
|FIXED_ARRAY(|2|3)|GE(NERAL|N_RAND)|HASH(ABLE|_TABLE_SIZE)|INPUT_STREAM\
|INTEGER(|_8|_16|_32|_64|_FRACTION|_GENERAL)\
|ITERATOR(|_ON_(COLLECTION|DICTIONARY(_ITEMS|_KEYS)|LINKED_LIST|SET\
|STRING|TWO_WAY_LINKED_LIST|UNICODE_STRING))\
|LARGE(|_NEGATIVE|_POSITIVE)_INTEGER|LINK(|2|ED(_COLLECTION|_LIST))\
|MATH_CONSTANTS|MEMO(|RY)|MICROSECOND_TIME|MINI_PARSER_BUFFER\
|MIN_STAND|MUTABLE_BIG_INTEGER|NATIVE_ARRAY|NULL_(INPUT|OUTPUT)\
|NUMBER(|_FRACTION|_TOOLS)|NUMERIC|OUTPUT_STREAM|PLATFORM|POINTER\
|REAL|REVERSE_COLLECTION_SORTER|SAFE_EQUAL|SCOOP_UTILITIES|SET(|_NODE)\
|SMALL_INTEGER|STD_(ERROR|FILE_(READ|READ_WRITE|WRITE)|INPUT(|_OUTPUT)\
|OUTPUT|RAND)|STRING(|_HANDLER)|SYSTEM|TIME(|_IN_(ENGLISH|FRENCH|GERMAN\
|ITALIAN|SOME_LANGUAGE|SPANISH))|TWO_WAY_LINKED_LIST\
|UNICODE_STRING(|_HANDLER)|UTF8_PARSER)\b/;

eiffel_keywords =
/* Keywords */
  /\b(agent|a(ll|lias)|and|as(|sign)|check|class|convert|create|Current|debug\
|deferred|do|else(|if)|en(d|sure)|ex(panded|port|ternal)|False\
|feature|fro(m|zen)|if|implies|in(dexing|fix|herit|spect|variant)\
|is|like|local|loop|not|o(r|bsolete|ld|nce)|prefix|Precursor|pure\
|re(define|ference|name|quire|scue|try)|Result|separate|then|True\
|TUPLE|un(define|til)|creation)\b/;

state eiffel extends HighlightEntry
{

  /* One line comments. */
  /\-\-/ {
    comment_face (true);
    language_print ($0);
    call (eat_one_line);
    comment_face (false);
  }

  /* Keywords. */
  eiffel_keywords {
    keyword_face (true);
    language_print ($0);
    keyword_face (false);
  }

  /* Types. */
  eiffel_types {
    type_face (true);
    language_print ($0);
    type_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);
  }

  /* Symbols, etc. */
  /:=|==|<=|>=|=|!=|\/=|!|!!/ {
    reference_face (true);
    language_print ($0);
    reference_face (false);
  }

  /* Type declarations */
  /([ \t])*([a-zA-Z]+[, \ta-zA-Z0-9_]*):[^=]/ {
    reference_face (true);
    language_print ($0);
    reference_face (false);
  }
  

  /*
   * Function definitions, with args
   * fct_name (args...) is
   */
  /^([ \t]*[a-zA-Z_][a-zA-Z_0-9]*[ \t]*)(\([ \t]*[ \ta-z,A-Z_0-9]+)(:[ \ta-zA-Z0-9_\[\]]+)?(\)[ \t]*)(:[ \ta-zA-Z0-9_\[\]]+)?([ \t]+is)[ \t]*$/ {
    function_name_face (true);
    face_on(face_bold_italic);
    language_print ($1);
    face_off(face_bold_italic);
    function_name_face (false);
    language_print ($2);
    type_face (true);
    language_print ($3);
    type_face (false);
    language_print ($4);
    type_face (true);
    language_print ($5);
    type_face (false);
    keyword_face (true);
    language_print ($6);
    keyword_face (false);
    language_print ($7);
  }

  /*
   * Function definitions, without args
   * fct_name is
   */
  /^([ \t]*[a-zA-Z_][a-zA-Z_0-9]*)([ \t]*)(is)[ \t]*$/ {
    function_name_face (true);
    face_on(face_bold_italic);
    language_print ($1);
    face_off(face_bold_italic);
    function_name_face (false);
    language_print(" ");
    keyword_face (true);
    language_print ($3);
    keyword_face (false);
  }

}