line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright (c) 2005 - 2006 Hans Jeuken. All rights reserved. |
2
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or |
3
|
|
|
|
|
|
|
# modify it under the same terms as Perl itself. |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# This file was generated from the 'txt2tags.xml' file of the syntax highlight |
6
|
|
|
|
|
|
|
# engine of the kate text editor (http://www.kate-editor.org |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#kate xml version 1.01 |
9
|
|
|
|
|
|
|
#kate version 2.4 |
10
|
|
|
|
|
|
|
#generated: Sun Feb 3 22:02:06 2008, localtime |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
package Syntax::Highlight::Engine::Kate::Txt2tags; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our $VERSION = '0.07'; |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
1063
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
41
|
|
17
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
18
|
1
|
|
|
1
|
|
8
|
use base('Syntax::Highlight::Engine::Kate::Template'); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
950
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
21
|
1
|
|
|
1
|
0
|
908
|
my $proto = shift; |
22
|
1
|
|
33
|
|
|
14
|
my $class = ref($proto) || $proto; |
23
|
1
|
|
|
|
|
46
|
my $self = $class->SUPER::new(@_); |
24
|
1
|
|
|
|
|
29
|
$self->attributes({ |
25
|
|
|
|
|
|
|
'Bar' => 'IString', |
26
|
|
|
|
|
|
|
'Bold' => 'Float', |
27
|
|
|
|
|
|
|
'BoldItalic' => 'Operator', |
28
|
|
|
|
|
|
|
'Comment' => 'Comment', |
29
|
|
|
|
|
|
|
'Date' => 'BaseN', |
30
|
|
|
|
|
|
|
'DefList' => 'Reserved', |
31
|
|
|
|
|
|
|
'Italic' => 'DecVal', |
32
|
|
|
|
|
|
|
'Link' => 'Variable', |
33
|
|
|
|
|
|
|
'List' => 'Reserved', |
34
|
|
|
|
|
|
|
'Monospaced' => 'Others', |
35
|
|
|
|
|
|
|
'Normal' => 'Normal', |
36
|
|
|
|
|
|
|
'NumList' => 'Reserved', |
37
|
|
|
|
|
|
|
'Quote' => 'Function', |
38
|
|
|
|
|
|
|
'Tabel' => 'BString', |
39
|
|
|
|
|
|
|
'Title' => 'Keyword', |
40
|
|
|
|
|
|
|
'Verbatim Area' => 'String', |
41
|
|
|
|
|
|
|
'Verbatim Line' => 'String', |
42
|
|
|
|
|
|
|
}); |
43
|
1
|
|
|
|
|
14
|
$self->contextdata({ |
44
|
|
|
|
|
|
|
'Context' => { |
45
|
|
|
|
|
|
|
callback => \&parseContext, |
46
|
|
|
|
|
|
|
attribute => 'Normal', |
47
|
|
|
|
|
|
|
}, |
48
|
|
|
|
|
|
|
}); |
49
|
1
|
|
|
|
|
10
|
$self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
50
|
1
|
|
|
|
|
5
|
$self->basecontext('Context'); |
51
|
1
|
|
|
|
|
11
|
$self->keywordscase(1); |
52
|
1
|
|
|
|
|
6
|
$self->initialize; |
53
|
1
|
|
|
|
|
4
|
bless ($self, $class); |
54
|
1
|
|
|
|
|
5
|
return $self; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub language { |
58
|
0
|
|
|
0
|
0
|
|
return 'txt2tags'; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub parseContext { |
62
|
0
|
|
|
0
|
0
|
|
my ($self, $text) = @_; |
63
|
|
|
|
|
|
|
# String => '%%date(\(.*\))?' |
64
|
|
|
|
|
|
|
# attribute => 'Date' |
65
|
|
|
|
|
|
|
# context => 'Context' |
66
|
|
|
|
|
|
|
# type => 'RegExpr' |
67
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '%%date(\\(.*\\))?', 0, 0, 0, undef, 0, 'Context', 'Date')) { |
68
|
0
|
|
|
|
|
|
return 1 |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
# String => '%.*' |
71
|
|
|
|
|
|
|
# attribute => 'Comment' |
72
|
|
|
|
|
|
|
# context => 'Context' |
73
|
|
|
|
|
|
|
# type => 'RegExpr' |
74
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '%.*', 0, 0, 0, undef, 0, 'Context', 'Comment')) { |
75
|
0
|
|
|
|
|
|
return 1 |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
# String => '\*\*.*\*\*' |
78
|
|
|
|
|
|
|
# attribute => 'Bold' |
79
|
|
|
|
|
|
|
# context => 'Context' |
80
|
|
|
|
|
|
|
# type => 'RegExpr' |
81
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '\\*\\*.*\\*\\*', 0, 0, 0, undef, 0, 'Context', 'Bold')) { |
82
|
0
|
|
|
|
|
|
return 1 |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
# String => '//.*//' |
85
|
|
|
|
|
|
|
# attribute => 'Italic' |
86
|
|
|
|
|
|
|
# context => 'Context' |
87
|
|
|
|
|
|
|
# type => 'RegExpr' |
88
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '//.*//', 0, 0, 0, undef, 0, 'Context', 'Italic')) { |
89
|
0
|
|
|
|
|
|
return 1 |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
# String => '\*\*//.*//\*\*' |
92
|
|
|
|
|
|
|
# attribute => 'BoldItalic' |
93
|
|
|
|
|
|
|
# context => 'Context' |
94
|
|
|
|
|
|
|
# type => 'RegExpr' |
95
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '\\*\\*//.*//\\*\\*', 0, 0, 0, undef, 0, 'Context', 'BoldItalic')) { |
96
|
0
|
|
|
|
|
|
return 1 |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
# String => '__.*__' |
99
|
|
|
|
|
|
|
# attribute => 'BoldItalic' |
100
|
|
|
|
|
|
|
# context => 'Context' |
101
|
|
|
|
|
|
|
# type => 'RegExpr' |
102
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '__.*__', 0, 0, 0, undef, 0, 'Context', 'BoldItalic')) { |
103
|
0
|
|
|
|
|
|
return 1 |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
# String => '``.*``' |
106
|
|
|
|
|
|
|
# attribute => 'Monospaced' |
107
|
|
|
|
|
|
|
# context => 'Context' |
108
|
|
|
|
|
|
|
# type => 'RegExpr' |
109
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '``.*``', 0, 0, 0, undef, 0, 'Context', 'Monospaced')) { |
110
|
0
|
|
|
|
|
|
return 1 |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
# String => '``` .*' |
113
|
|
|
|
|
|
|
# attribute => 'Verbatim Line' |
114
|
|
|
|
|
|
|
# context => 'Context' |
115
|
|
|
|
|
|
|
# type => 'RegExpr' |
116
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '``` .*', 0, 0, 0, undef, 0, 'Context', 'Verbatim Line')) { |
117
|
0
|
|
|
|
|
|
return 1 |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
# String => ' *=[^=].*[^=]=\s*$' |
120
|
|
|
|
|
|
|
# attribute => 'Title' |
121
|
|
|
|
|
|
|
# column => '0' |
122
|
|
|
|
|
|
|
# context => 'Context' |
123
|
|
|
|
|
|
|
# type => 'RegExpr' |
124
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, ' *=[^=].*[^=]=\\s*$', 0, 0, 0, 0, 0, 'Context', 'Title')) { |
125
|
0
|
|
|
|
|
|
return 1 |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
# String => ' *==[^=].*[^=]==\s*$' |
128
|
|
|
|
|
|
|
# attribute => 'Title' |
129
|
|
|
|
|
|
|
# column => '0' |
130
|
|
|
|
|
|
|
# context => 'Context' |
131
|
|
|
|
|
|
|
# type => 'RegExpr' |
132
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, ' *==[^=].*[^=]==\\s*$', 0, 0, 0, 0, 0, 'Context', 'Title')) { |
133
|
0
|
|
|
|
|
|
return 1 |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
# String => ' *===[^=].*[^=]===\s*$' |
136
|
|
|
|
|
|
|
# attribute => 'Title' |
137
|
|
|
|
|
|
|
# column => '0' |
138
|
|
|
|
|
|
|
# context => 'Context' |
139
|
|
|
|
|
|
|
# type => 'RegExpr' |
140
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, ' *===[^=].*[^=]===\\s*$', 0, 0, 0, 0, 0, 'Context', 'Title')) { |
141
|
0
|
|
|
|
|
|
return 1 |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
# String => ' *====[^=].*[^=]====\s*$' |
144
|
|
|
|
|
|
|
# attribute => 'Title' |
145
|
|
|
|
|
|
|
# column => '0' |
146
|
|
|
|
|
|
|
# context => 'Context' |
147
|
|
|
|
|
|
|
# type => 'RegExpr' |
148
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, ' *====[^=].*[^=]====\\s*$', 0, 0, 0, 0, 0, 'Context', 'Title')) { |
149
|
0
|
|
|
|
|
|
return 1 |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
# String => ' *=====[^=].*[^=]=====\s*$' |
152
|
|
|
|
|
|
|
# attribute => 'Title' |
153
|
|
|
|
|
|
|
# column => '0' |
154
|
|
|
|
|
|
|
# context => 'Context' |
155
|
|
|
|
|
|
|
# type => 'RegExpr' |
156
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, ' *=====[^=].*[^=]=====\\s*$', 0, 0, 0, 0, 0, 'Context', 'Title')) { |
157
|
0
|
|
|
|
|
|
return 1 |
158
|
|
|
|
|
|
|
} |
159
|
|
|
|
|
|
|
# String => ' *\+[^=].*[^=]\+\s*$' |
160
|
|
|
|
|
|
|
# attribute => 'Title' |
161
|
|
|
|
|
|
|
# column => '0' |
162
|
|
|
|
|
|
|
# context => 'Context' |
163
|
|
|
|
|
|
|
# type => 'RegExpr' |
164
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, ' *\\+[^=].*[^=]\\+\\s*$', 0, 0, 0, 0, 0, 'Context', 'Title')) { |
165
|
0
|
|
|
|
|
|
return 1 |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
# String => ' *\+\+[^=].*[^=]\+\+\s*$' |
168
|
|
|
|
|
|
|
# attribute => 'Title' |
169
|
|
|
|
|
|
|
# column => '0' |
170
|
|
|
|
|
|
|
# context => 'Context' |
171
|
|
|
|
|
|
|
# type => 'RegExpr' |
172
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, ' *\\+\\+[^=].*[^=]\\+\\+\\s*$', 0, 0, 0, 0, 0, 'Context', 'Title')) { |
173
|
0
|
|
|
|
|
|
return 1 |
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
# String => ' *\+\+\+[^=].*[^=]\+\+\+\s*$' |
176
|
|
|
|
|
|
|
# attribute => 'Title' |
177
|
|
|
|
|
|
|
# column => '0' |
178
|
|
|
|
|
|
|
# context => 'Context' |
179
|
|
|
|
|
|
|
# type => 'RegExpr' |
180
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, ' *\\+\\+\\+[^=].*[^=]\\+\\+\\+\\s*$', 0, 0, 0, 0, 0, 'Context', 'Title')) { |
181
|
0
|
|
|
|
|
|
return 1 |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
# String => ' *\+\+\+\+[^=].*[^=]\+\+\+\+\s*$' |
184
|
|
|
|
|
|
|
# attribute => 'Title' |
185
|
|
|
|
|
|
|
# column => '0' |
186
|
|
|
|
|
|
|
# context => 'Context' |
187
|
|
|
|
|
|
|
# type => 'RegExpr' |
188
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, ' *\\+\\+\\+\\+[^=].*[^=]\\+\\+\\+\\+\\s*$', 0, 0, 0, 0, 0, 'Context', 'Title')) { |
189
|
0
|
|
|
|
|
|
return 1 |
190
|
|
|
|
|
|
|
} |
191
|
|
|
|
|
|
|
# String => ' *\+\+\+\+\+[^=].*[^=]\+\+\+\+\+\s*$' |
192
|
|
|
|
|
|
|
# attribute => 'Title' |
193
|
|
|
|
|
|
|
# column => '0' |
194
|
|
|
|
|
|
|
# context => 'Context' |
195
|
|
|
|
|
|
|
# type => 'RegExpr' |
196
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, ' *\\+\\+\\+\\+\\+[^=].*[^=]\\+\\+\\+\\+\\+\\s*$', 0, 0, 0, 0, 0, 'Context', 'Title')) { |
197
|
0
|
|
|
|
|
|
return 1 |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
# attribute => 'Link' |
200
|
|
|
|
|
|
|
# char => '[' |
201
|
|
|
|
|
|
|
# char1 => ']' |
202
|
|
|
|
|
|
|
# type => 'RangeDetect' |
203
|
0
|
0
|
|
|
|
|
if ($self->testRangeDetect($text, '[', ']', 0, 0, undef, 0, '#stay', 'Link')) { |
204
|
0
|
|
|
|
|
|
return 1 |
205
|
|
|
|
|
|
|
} |
206
|
|
|
|
|
|
|
# String => ' *\|\| .*' |
207
|
|
|
|
|
|
|
# attribute => 'Tabel' |
208
|
|
|
|
|
|
|
# column => '0' |
209
|
|
|
|
|
|
|
# context => 'Context' |
210
|
|
|
|
|
|
|
# type => 'RegExpr' |
211
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, ' *\\|\\| .*', 0, 0, 0, 0, 0, 'Context', 'Tabel')) { |
212
|
0
|
|
|
|
|
|
return 1 |
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
# String => ' *\| .*' |
215
|
|
|
|
|
|
|
# attribute => 'Tabel' |
216
|
|
|
|
|
|
|
# column => '0' |
217
|
|
|
|
|
|
|
# context => 'Context' |
218
|
|
|
|
|
|
|
# type => 'RegExpr' |
219
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, ' *\\| .*', 0, 0, 0, 0, 0, 'Context', 'Tabel')) { |
220
|
0
|
|
|
|
|
|
return 1 |
221
|
|
|
|
|
|
|
} |
222
|
|
|
|
|
|
|
# String => ' *\: .*' |
223
|
|
|
|
|
|
|
# attribute => 'DefList' |
224
|
|
|
|
|
|
|
# column => '0' |
225
|
|
|
|
|
|
|
# context => 'Context' |
226
|
|
|
|
|
|
|
# type => 'RegExpr' |
227
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, ' *\\: .*', 0, 0, 0, 0, 0, 'Context', 'DefList')) { |
228
|
0
|
|
|
|
|
|
return 1 |
229
|
|
|
|
|
|
|
} |
230
|
|
|
|
|
|
|
# String => ' *\- .*' |
231
|
|
|
|
|
|
|
# attribute => 'List' |
232
|
|
|
|
|
|
|
# column => '0' |
233
|
|
|
|
|
|
|
# context => 'Context' |
234
|
|
|
|
|
|
|
# type => 'RegExpr' |
235
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, ' *\\- .*', 0, 0, 0, 0, 0, 'Context', 'List')) { |
236
|
0
|
|
|
|
|
|
return 1 |
237
|
|
|
|
|
|
|
} |
238
|
|
|
|
|
|
|
# String => ' *\+ .*' |
239
|
|
|
|
|
|
|
# attribute => 'NumList' |
240
|
|
|
|
|
|
|
# column => '0' |
241
|
|
|
|
|
|
|
# context => 'Context' |
242
|
|
|
|
|
|
|
# type => 'RegExpr' |
243
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, ' *\\+ .*', 0, 0, 0, 0, 0, 'Context', 'NumList')) { |
244
|
0
|
|
|
|
|
|
return 1 |
245
|
|
|
|
|
|
|
} |
246
|
|
|
|
|
|
|
# String => '\t.*' |
247
|
|
|
|
|
|
|
# attribute => 'Quote' |
248
|
|
|
|
|
|
|
# context => 'Context' |
249
|
|
|
|
|
|
|
# type => 'RegExpr' |
250
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '\\t.*', 0, 0, 0, undef, 0, 'Context', 'Quote')) { |
251
|
0
|
|
|
|
|
|
return 1 |
252
|
|
|
|
|
|
|
} |
253
|
|
|
|
|
|
|
# String => '\s*([_=-]{20,})\s*$' |
254
|
|
|
|
|
|
|
# attribute => 'Bar' |
255
|
|
|
|
|
|
|
# context => 'Context' |
256
|
|
|
|
|
|
|
# type => 'RegExpr' |
257
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '\\s*([_=-]{20,})\\s*$', 0, 0, 0, undef, 0, 'Context', 'Bar')) { |
258
|
0
|
|
|
|
|
|
return 1 |
259
|
|
|
|
|
|
|
} |
260
|
0
|
|
|
|
|
|
return 0; |
261
|
|
|
|
|
|
|
}; |
262
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
1; |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
__END__ |