File: m_mod3.fte

package info (click to toggle)
efte 1.1-6
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,904 kB
  • sloc: cpp: 43,587; ansic: 1,228; makefile: 271; objc: 92; sh: 40
file content (149 lines) | stat: -rw-r--r-- 5,578 bytes parent folder | download | duplicates (4)
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
#From: Richard Glidden <rrglidden@uwaterloo.ca>
#
# I just spent an hour or so configuring FTE to recognize Modula-3.
# This file is almost complete (there are two minor bugs - Keywords
# immediately following punctuation don't highlight correctly, and
# RoutineRegexp isn't set to recognize Procedures unless they start at
# column 1), but I thought you'd like a copy of it anyway to include with
# FTE.

colorize MODULA3 {
    SyntaxParser       = 'SIMPLE';

    color {
        { 'Normal',      'Editor_Default' },
        { 'Number',      'Lang_DecimalNumber' },
        { 'HexNumber',   'Lang_HexNumber' },
        { 'Punctuation', 'Lang_Punctuation' },
        { 'String',      'Lang_String' },
        { 'Comment',     'Lang_Comment' },
        { 'Command',     'Lang_Assembler' }, # Pragma
    };

    keyword 'Editor_Keywords' {
        'ABS', 'ADDRESS', 'ADR', 'ADRSIZE', 'AND', 'ANY', 'ARRAY', 'AS',
        'BEGIN', 'BITS', 'BITSIZE', 'BOOLEAN', 'BRANDED', 'BY', 'BYTESIZE',
        'CARDINAL', 'CASE', 'CEILING', 'CHAR', 'CONST',
        'DEC', 'DISPOSE', 'DIV', 'DO',
        'ELSE', 'ELSIF', 'END', 'EVAL', 'EXCEPT', 'EXCEPTION', 'EXIT',
        'EXPORTS', 'EXTENDED',
        'FALSE', 'FINALLY', 'FIRST', 'FLOAT', 'FLOOR', 'FOR', 'FROM',
        'GENERIC',
        'IF', 'IMPORT', 'IN', 'INC', 'INTEGER', 'INTERFACE', 'ISTYPE',
        'LAST', 'LOCK', 'LONGREAL', 'LOOP', 'LOOPHOLE',
        'MAX', 'METHODS', 'MIN', 'MOD', 'MODULE', 'MUTEX',
        'NARROW', 'NEW', 'NIL', 'NOT', 'NULL', 'NUMBER',
        'OBJECT', 'OF', 'OR', 'ORD', 'OVERRIDES',
        'PROCEDURE',
        'RAISE', 'RAISES', 'READONLY', 'REAL', 'RECORD', 'REF', 'REFANY',
        'REPEAT', 'RETURN', 'REVEAL', 'ROOT', 'ROUND',
        'SET', 'SUBARRAY', 'TEXT', 'THEN', 'TO', 'TRUE', 'TRUNC', 'TRY',
        'TYPE', 'TYPECASE', 'TYPECODE', 'UNSAFE', 'UNTIL', 'UNTRACED',
        'VAL', 'VALUE', 'VAR',
        'WHILE', 'WITH',
    };
                        
    # The following h_states are lengthy, but work VERY well.  Unlike the
    # m_pascal.fte file (which m_modul3.fte is based on), punctuation
    # colours do not get 'stuck' on Normal text.

    # BUG: Keywords immediately following punctuation (ie: .IF) do not
    # highlight.  Please add a space between all punctuation and keywords,
    # for now.
    
    h_state 0 { 'Normal' }
    h_trans { 2, '<', '"', 'String' }
    h_trans { 3, '<', '\'', 'String' }
    h_trans { 4, '<', '(*', 'Comment' }
    h_trans { 8, '<', '<*', 'Command' }
    h_trans { 5, '<', '2_', 'HexNumber' }
    h_trans { 5, '<', '3_', 'HexNumber' }
    h_trans { 5, '<', '4_', 'HexNumber' }
    h_trans { 5, '<', '5_', 'HexNumber' }
    h_trans { 5, '<', '6_', 'HexNumber' }
    h_trans { 5, '<', '7_', 'HexNumber' }
    h_trans { 5, '<', '8_', 'HexNumber' }
    h_trans { 5, '<', '9_', 'HexNumber' }
    h_trans { 5, '<', '10_', 'HexNumber' }
    h_trans { 5, '<', '11_', 'HexNumber' }
    h_trans { 5, '<', '12_', 'HexNumber' }
    h_trans { 5, '<', '13_', 'HexNumber' }
    h_trans { 5, '<', '14_', 'HexNumber' }
    h_trans { 5, '<', '15_', 'HexNumber' }
    h_trans { 5, '<', '16_', 'HexNumber' }
    h_trans { 6, '<-s', '0-9', 'Number' }
    h_trans { 1, '-s', 'a-zA-Z_', 'Normal' }
    h_trans { 0, 's', ' ', 'Normal' }
    h_trans { 7, 'S', '_a-zA-Z0-9 ', 'Punctuation' }

    h_state 1 { 'Normal' }
    h_trans { 0, '$', '', 'Normal' }
    h_wtype { 0, 0, 0, '', 'a-zA-Z0-9_' }

    h_state 2 { 'String' }
    h_trans { 0, '>', '"', 'String' }
    h_trans { 0, '$', '', 'String' }

    h_state 3 { 'String' }
    h_trans { 0, '>', '\'', 'String' }
    h_trans { 0, '$', '', 'String' }

    h_state 4 { 'Comment' }
    h_trans { 0, '>', '*)', 'Comment' }

    h_state 5 { 'HexNumber' }
    h_trans { 0, '-S', '0-9A-Fa-f', 'Normal' }
    h_trans { 0, '$', '', 'Normal' }

    h_state 6 { 'Number' }
    h_trans { 0, '-S', '0-9', 'Normal' }
    h_trans { 0, '$', '', 'Normal' }

    h_state 7 { 'Punctuation' }
    h_trans { 2, '<', '"', 'String' }
    h_trans { 3, '<', '\'', 'String' }
    h_trans { 4, '<', '(*', 'Comment' }
    h_trans { 8, '<', '<*', 'Command' }
    h_trans { 5, '<', '2_', 'HexNumber' }
    h_trans { 5, '<', '3_', 'HexNumber' }
    h_trans { 5, '<', '4_', 'HexNumber' }
    h_trans { 5, '<', '5_', 'HexNumber' }
    h_trans { 5, '<', '6_', 'HexNumber' }
    h_trans { 5, '<', '7_', 'HexNumber' }
    h_trans { 5, '<', '8_', 'HexNumber' }
    h_trans { 5, '<', '9_', 'HexNumber' }
    h_trans { 5, '<', '10_', 'HexNumber' }
    h_trans { 5, '<', '11_', 'HexNumber' }
    h_trans { 5, '<', '12_', 'HexNumber' }
    h_trans { 5, '<', '13_', 'HexNumber' }
    h_trans { 5, '<', '14_', 'HexNumber' }
    h_trans { 5, '<', '15_', 'HexNumber' }
    h_trans { 5, '<', '16_', 'HexNumber' }
    h_trans { 0, 's', '_a-zA-Z ', 'Normal' }
    h_trans { 0, '$', '', 'Normal' }    
    h_trans { 7, '<s', '0-9', 'Number' }
    
    h_state 8 { 'Command' }
    h_trans { 0, '>', '*>', 'Command' }
}
mode MODULA3: SOURCE {      # Modula-3 Mode
    FileNameRx          = /\.\c{m3}|{i3}$/;
    HilitOn             = 1;
    Colorizer           = 'MODULA3';
    AutoIndent          = 1;
    IndentMode          = 'PLAIN';
    MatchCase           = 1;
    Trim                = 1;
    MultiLineHilit      = 1;
    AutoHilitParen      = 1;

    SaveFolds           = 2;      # save fold info at end of line
    CommentStart        = ' (*';
    CommentEnd          = '*)';

    # Needs to be modified to allow PROCEDURE to start anywhere on a line,
    # not just column 1.
    RoutineRegexp       = '^{PROCEDURE}'; 
}

oinclude 'mym_mod3.fte';