File: m_pascal.fte

package info (click to toggle)
efte 1.1-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 3,800 kB
  • sloc: cpp: 43,587; ansic: 1,228; makefile: 271; objc: 92; sh: 40
file content (154 lines) | stat: -rw-r--r-- 5,392 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

colorize PASCAL {
    SyntaxParser       = 'SIMPLE';

    color {
        { 'Normal',        'Editor_Default' },
        { 'Number',        'Lang_DecimalNumber' },
        { 'HexNumber',     'Lang_HexNumber' },
        { 'Punctuation',   'Lang_Punctuation' },
        { 'String',        'Lang_String' },
        { 'Comment',       'Lang_Comment' },
        { 'Command',       'Lang_Assembler' }, # assembler
        { 'CPreprocessor', 'Lang_Preprocessor' },
        { 'Function',      'Lang_Function' },
        { 'Keyword',       'Editor_Keywords' },
    };

    keyword 'Editor_Keywords' {
        'program', 'const', 'type', 'var', 
        'begin', 'end', 'array', 'set', 'record', 'string', 
        'if', 'then', 'else', 'while', 'for', 'to', 'downto', 'do', 'with',
        'repeat', 'until', 'case', 'of', 'goto', 'exit', 'label',
        'procedure', 'function', 'nil', 'file', 'and', 'or', 'not', 'xor',
        'div', 'mod', 'unit', 'uses', 'implementation', 'interface', 
        'asm', 'inline', 'object', 'constructor', 'destructor', 'inherited', 
        'except', 'finally', 'initialization', 'out', 'property',
        'resourcestring', 'try', 'exports', 'library', 'packed',
        'raise', 'as', 'class', 'dispinterface', 'in', 'shl', 'shr',
        'threadvar', 'finalization', 'is', 'at', 'on',
        
        'private', 'protected', 'public', 'published', 'automated',
        'absolute', 'abstract', 'cdecl', 'contains', 'default', 'dispid',
        'dynamic', 'export', 'external', 'far', 'assembler', 'virtual', 
        'near', 'forward', 'implements', 'index', 'message', 'name',
        'nodefault', 'overload', 'override', 'package', 'pascal', 'read',
        'readonly', 'register', 'reintroduce', 'requires', 'resident',
        'safecall', 'stdcall', 'stored', 'write', 'writeonly', 'result',
        
        'integer', 'cardinal', 'shortint', 'smallint', 'longint', 'int64',
        'byte', 'word', 'longword', 'char', 'boolean', 'bytebool',
        'wordbool', 'longbool', 'real48', 'single', 'smallword',
        'double', 'extended', 'comp', 'currency', 'real',
        'shortstring', 'ansistring', 'widestring',
    };

    keyword 'Lang_DecimalNumber' {
        'true', 'false',
    };

    h_state 0 { 'Normal' }
    h_trans { 10, '<', '(*&', 'CPreprocessor' }    
    h_trans { 10, '<', '(*$', 'CPreprocessor' }
    h_trans { 9, '<', '{&', 'CPreprocessor' }    
    h_trans { 9, '<', '{$', 'CPreprocessor' }
    h_trans { 8, '', 'asm', 'Command' }

    # workaround for bug 854418
    h_trans { 17, '<-x', /\c{while}|{if}|{until}|{not}|{and}|{or}|{xor}|{div}|{mod}\s*\(/, 'Keyword' }

    h_trans { 16, '<-x', /[_a-zA-Z0-9]+\s*\(/, 'Function' }

    h_trans { 5, '-s', 'a-zA-Z_', 'Normal' }
    h_trans { 11, '<', '//', 'Comment' }
    h_trans { 1, '<', '(*', 'Comment' }
    h_trans { 2, '<', '{', 'Comment' }
    h_trans { 3, '<', '"', 'String' }
    h_trans { 4, '<', '\'', 'String' }
    h_trans { 6, '<', '0x', 'HexNumber' }
    h_trans { 6, '<', '$', 'HexNumber' }
    h_trans { 7, '<s', '0-9', 'Number' }
    h_trans { 15, '<', '#$', 'String' }
    h_trans { 14, '<', '#', 'String' }
    h_trans { 0, 'S', '_a-zA-Z0-9', 'Punctuation' }

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

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

    h_state 4 { 'String' }
    h_trans { 0, '>', '\'', 'String' }
    h_trans { 0, '$', '', 'String' }
    
    h_state 5 { 'Normal' }
    h_trans { 0, '$', '', 'Normal' }
    h_wtype { 0, 0, 0, 'i', 'a-zA-Z0-9_' }

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

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

    h_state 8 { 'Command' }
    h_trans { 0, '', 'end', 'Command' }
    h_trans { 12, '<', '(*', 'Comment' }
    h_trans { 13, '<', '{', 'Comment' }
    
    h_state 9 { 'CPreprocessor' }
    h_trans { 0, '>', '}', 'CPreprocessor' }
    
    h_state 10 { 'CPreprocessor' }
    h_trans { 0, '>', '*)', 'CPreprocessor' }
    
    h_state 11 { 'Comment' }
    h_trans { 0, '$', '', 'Comment' }
    
    h_state 12 { 'Comment' }
    h_trans { 8, '>', '*)', 'Comment' }

    h_state 13 { 'Comment' }
    h_trans { 8, '>', '}', 'Comment' }

    h_state 14 { 'String' }       # character of the form #ddd
    h_trans { 0, '-S', '0-9', 'Normal' }
    h_trans { 0, '$', '', 'Normal' }

    h_state 15 { 'String' }       # character of the form #$xx
    h_trans { 0, '-S', '0-9A-Fa-f', 'Normal' }
    h_trans { 0, '$', '', 'Normal' }

    h_state 16 { 'Function' }
    h_trans { 0, '->', '(', 'Normal' }

    h_state 17 { 'Keyword' }
    h_trans { 0, '->', '(', 'Normal' }
}

mode PASCAL: SOURCE {      # Pascal Mode
    FileNameRx          = /\.\c{{PAS}|{PP}|{INC}}$/;
    HilitOn             = 1;
    Colorizer           = 'PASCAL';
    AutoIndent          = 1;
    IndentMode          = 'PLAIN';
    MatchCase           = 0;
    Trim                = 1;
    MultiLineHilit      = 1;
    AutoHilitParen      = 1;

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

    RoutineRegexp       = '^{procedure}|{function}>';
}

oinclude 'mym_pascal.fte';