File: oberon2.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 (111 lines) | stat: -rw-r--r-- 2,314 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
/**
 * Name: oberon2
 * Description: Oberon 2 Programming Language.
 * Author: Brent Fulgham <bfulgham@debian.org>
 */

oberon2_builtins =
/* Builtins */
  /\b(CONST|IMPORT)\b/;

oberon2_types =
/* Types */
  /\b(ARRAY|B(OOLEAN|YTE)|CHAR|INTEGER|LONG(|INT|REAL)|MODULE|NIL\
|P(OINTER|ROCEDURE)|RE(AL|CORD)|SHORT(|INT))\b/;
  
oberon2_keywords =
/* Keywords */
  /\b(A(BS|ND|SH)|BEGIN|C(A(P|SE)|HR)|D(O|EC|IV)\
|E(LS(E|IF)|N(D|TIER)|X(CL|IT))|F(ALSE|OR)|HALT|I(F|S|N(|C(|L)))\
|L(EN|OOP)|M(AX|IN|OD)|NEW|O(F|DD|R(|D))|S(ET|IZE)|T(HEN|O|RUE|YPE)\
|UNTIL|RE(PEAT|TURN)|VAR|W(HILE|ITH))\b/;

state oberon2_comment extends Highlight
{
  /\*\)/ {
    language_print ($0);
    return;
  }
}

state oberon2 extends HighlightEntry
{
  /* Comments. */
  /\(\*/ {
    comment_face (true);
    language_print ($0);
    call (oberon2_comment);
    comment_face (false);
  }

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

  /* Types. */
  oberon2_types {
    type_face (true);
    language_print ($0);
    type_face (false);
  }

  /* Structure support */
  oberon2_builtins {
    reference_face (true);
    language_print ($0);
    reference_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);
  }

  /*
   * Function definitions, with args
   * fct_name (args...) is
   */
  /([ \t]*PROCEDURE[ \t]+)(\w+)([ \t]*)/ {
    keyword_face (true);
    language_print ($1);
    keyword_face (false);
    function_name_face (true);
    face_on(face_bold_italic);
    language_print ($2);
    face_off(face_bold_italic);
    function_name_face (false);
    language_print ($3);
  }

  /([ \t]*END[ \t]+)(\w+)([ \t]*[;\.])/ {
    keyword_face (true);
    language_print ($1);
    keyword_face (false);
    function_name_face (true);
    face_on(face_bold_italic);
    language_print ($2);
    face_off(face_bold_italic);
    function_name_face (false);
    language_print ($3);
  }
}