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 'bibtex.xml' file of the syntax highlight |
6
|
|
|
|
|
|
|
# engine of the kate text editor (http://www.kate-editor.org |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#kate xml version 1.13 |
9
|
|
|
|
|
|
|
#kate version 2.4 |
10
|
|
|
|
|
|
|
#kate author Jeroen Wijnhout (Jeroen.Wijnhout@kdemail.net) |
11
|
|
|
|
|
|
|
#generated: Sun Feb 3 22:02:04 2008, localtime |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Syntax::Highlight::Engine::Kate::BibTeX; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.14'; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
611
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
18
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
19
|
1
|
|
|
1
|
|
4
|
use base('Syntax::Highlight::Engine::Kate::Template'); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
570
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
2
|
|
|
2
|
0
|
457
|
my $proto = shift; |
23
|
2
|
|
33
|
|
|
11
|
my $class = ref($proto) || $proto; |
24
|
2
|
|
|
|
|
11
|
my $self = $class->SUPER::new(@_); |
25
|
2
|
|
|
|
|
15
|
$self->attributes({ |
26
|
|
|
|
|
|
|
'Char' => 'Char', |
27
|
|
|
|
|
|
|
'Command' => 'Function', |
28
|
|
|
|
|
|
|
'Entry' => 'Keyword', |
29
|
|
|
|
|
|
|
'Field' => 'DataType', |
30
|
|
|
|
|
|
|
'Normal Text' => 'Normal', |
31
|
|
|
|
|
|
|
'Ref Key' => 'Others', |
32
|
|
|
|
|
|
|
'String' => 'String', |
33
|
|
|
|
|
|
|
}); |
34
|
2
|
|
|
|
|
8
|
$self->listAdd('kw_command', |
35
|
|
|
|
|
|
|
'@comment', |
36
|
|
|
|
|
|
|
'@preamble', |
37
|
|
|
|
|
|
|
'@string', |
38
|
|
|
|
|
|
|
); |
39
|
2
|
|
|
|
|
6
|
$self->listAdd('kw_entry', |
40
|
|
|
|
|
|
|
'@article', |
41
|
|
|
|
|
|
|
'@book', |
42
|
|
|
|
|
|
|
'@booklet', |
43
|
|
|
|
|
|
|
'@collection', |
44
|
|
|
|
|
|
|
'@conference', |
45
|
|
|
|
|
|
|
'@inbook', |
46
|
|
|
|
|
|
|
'@incollection', |
47
|
|
|
|
|
|
|
'@inproceedings', |
48
|
|
|
|
|
|
|
'@manual', |
49
|
|
|
|
|
|
|
'@mastersthesis', |
50
|
|
|
|
|
|
|
'@misc', |
51
|
|
|
|
|
|
|
'@patent', |
52
|
|
|
|
|
|
|
'@phdthesis', |
53
|
|
|
|
|
|
|
'@proceedings', |
54
|
|
|
|
|
|
|
'@techreport', |
55
|
|
|
|
|
|
|
'@unpublished', |
56
|
|
|
|
|
|
|
); |
57
|
2
|
|
|
|
|
16
|
$self->contextdata({ |
58
|
|
|
|
|
|
|
'Entry' => { |
59
|
|
|
|
|
|
|
callback => \&parseEntry, |
60
|
|
|
|
|
|
|
attribute => 'Ref Key', |
61
|
|
|
|
|
|
|
}, |
62
|
|
|
|
|
|
|
'Normal' => { |
63
|
|
|
|
|
|
|
callback => \&parseNormal, |
64
|
|
|
|
|
|
|
attribute => 'Normal Text', |
65
|
|
|
|
|
|
|
}, |
66
|
|
|
|
|
|
|
'String' => { |
67
|
|
|
|
|
|
|
callback => \&parseString, |
68
|
|
|
|
|
|
|
attribute => 'String', |
69
|
|
|
|
|
|
|
}, |
70
|
|
|
|
|
|
|
}); |
71
|
2
|
|
|
|
|
9
|
$self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
72
|
2
|
|
|
|
|
9
|
$self->basecontext('Normal'); |
73
|
2
|
|
|
|
|
9
|
$self->keywordscase(0); |
74
|
2
|
|
|
|
|
4
|
$self->initialize; |
75
|
2
|
|
|
|
|
4
|
bless ($self, $class); |
76
|
2
|
|
|
|
|
9
|
return $self; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub language { |
80
|
0
|
|
|
0
|
0
|
0
|
return 'BibTeX'; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub parseEntry { |
84
|
46
|
|
|
46
|
0
|
74
|
my ($self, $text) = @_; |
85
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
86
|
|
|
|
|
|
|
# char => ',' |
87
|
|
|
|
|
|
|
# context => '#pop' |
88
|
|
|
|
|
|
|
# type => 'DetectChar' |
89
|
46
|
100
|
|
|
|
104
|
if ($self->testDetectChar($text, ',', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) { |
90
|
6
|
|
|
|
|
11
|
return 1 |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
93
|
|
|
|
|
|
|
# beginRegion => 'block' |
94
|
|
|
|
|
|
|
# char => '{' |
95
|
|
|
|
|
|
|
# context => '#stay' |
96
|
|
|
|
|
|
|
# type => 'DetectChar' |
97
|
40
|
100
|
|
|
|
81
|
if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) { |
98
|
6
|
|
|
|
|
13
|
return 1 |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
101
|
|
|
|
|
|
|
# char => '}' |
102
|
|
|
|
|
|
|
# context => '#stay' |
103
|
|
|
|
|
|
|
# endRegion => 'block' |
104
|
|
|
|
|
|
|
# type => 'DetectChar' |
105
|
34
|
50
|
|
|
|
63
|
if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) { |
106
|
0
|
|
|
|
|
0
|
return 1 |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
# String => '\\([a-zA-Z]+|.)' |
109
|
|
|
|
|
|
|
# attribute => 'Char' |
110
|
|
|
|
|
|
|
# context => '#stay' |
111
|
|
|
|
|
|
|
# type => 'RegExpr' |
112
|
34
|
50
|
|
|
|
77
|
if ($self->testRegExpr($text, '\\\\([a-zA-Z]+|.)', 0, 0, 0, undef, 0, '#stay', 'Char')) { |
113
|
0
|
|
|
|
|
0
|
return 1 |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
# attribute => 'String' |
116
|
|
|
|
|
|
|
# char => '"' |
117
|
|
|
|
|
|
|
# context => '#pop' |
118
|
|
|
|
|
|
|
# type => 'DetectChar' |
119
|
34
|
50
|
|
|
|
72
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) { |
120
|
0
|
|
|
|
|
0
|
return 1 |
121
|
|
|
|
|
|
|
} |
122
|
34
|
|
|
|
|
55
|
return 0; |
123
|
|
|
|
|
|
|
}; |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub parseNormal { |
126
|
586
|
|
|
586
|
0
|
843
|
my ($self, $text) = @_; |
127
|
|
|
|
|
|
|
# String => '([a-zA-Z]+)\s*=' |
128
|
|
|
|
|
|
|
# attribute => 'Field' |
129
|
|
|
|
|
|
|
# context => '#stay' |
130
|
|
|
|
|
|
|
# firstNonSpace => 'true' |
131
|
|
|
|
|
|
|
# type => 'RegExpr' |
132
|
586
|
100
|
|
|
|
1186
|
if ($self->testRegExpr($text, '([a-zA-Z]+)\\s*=', 0, 0, 0, undef, 1, '#stay', 'Field')) { |
133
|
24
|
|
|
|
|
47
|
return 1 |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
# String => 'kw_entry' |
136
|
|
|
|
|
|
|
# attribute => 'Entry' |
137
|
|
|
|
|
|
|
# context => 'Entry' |
138
|
|
|
|
|
|
|
# type => 'keyword' |
139
|
562
|
100
|
|
|
|
1340
|
if ($self->testKeyword($text, 'kw_entry', 0, undef, 0, 'Entry', 'Entry')) { |
140
|
6
|
|
|
|
|
13
|
return 1 |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
# String => 'kw_command' |
143
|
|
|
|
|
|
|
# attribute => 'Command' |
144
|
|
|
|
|
|
|
# context => '#stay' |
145
|
|
|
|
|
|
|
# type => 'keyword' |
146
|
556
|
100
|
|
|
|
1130
|
if ($self->testKeyword($text, 'kw_command', 0, undef, 0, '#stay', 'Command')) { |
147
|
2
|
|
|
|
|
5
|
return 1 |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
150
|
|
|
|
|
|
|
# beginRegion => 'block' |
151
|
|
|
|
|
|
|
# char => '{' |
152
|
|
|
|
|
|
|
# context => '#stay' |
153
|
|
|
|
|
|
|
# type => 'DetectChar' |
154
|
554
|
100
|
|
|
|
1226
|
if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) { |
155
|
18
|
|
|
|
|
34
|
return 1 |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
158
|
|
|
|
|
|
|
# char => '}' |
159
|
|
|
|
|
|
|
# context => '#stay' |
160
|
|
|
|
|
|
|
# endRegion => 'block' |
161
|
|
|
|
|
|
|
# type => 'DetectChar' |
162
|
536
|
100
|
|
|
|
1128
|
if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) { |
163
|
24
|
|
|
|
|
44
|
return 1 |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
# String => '\\([a-zA-Z]+|.)' |
166
|
|
|
|
|
|
|
# attribute => 'Char' |
167
|
|
|
|
|
|
|
# context => '#stay' |
168
|
|
|
|
|
|
|
# type => 'RegExpr' |
169
|
512
|
50
|
|
|
|
1020
|
if ($self->testRegExpr($text, '\\\\([a-zA-Z]+|.)', 0, 0, 0, undef, 0, '#stay', 'Char')) { |
170
|
0
|
|
|
|
|
0
|
return 1 |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
# attribute => 'String' |
173
|
|
|
|
|
|
|
# char => '"' |
174
|
|
|
|
|
|
|
# context => 'String' |
175
|
|
|
|
|
|
|
# type => 'DetectChar' |
176
|
512
|
100
|
|
|
|
1288
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) { |
177
|
10
|
|
|
|
|
20
|
return 1 |
178
|
|
|
|
|
|
|
} |
179
|
502
|
|
|
|
|
953
|
return 0; |
180
|
|
|
|
|
|
|
}; |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
sub parseString { |
183
|
176
|
|
|
176
|
0
|
252
|
my ($self, $text) = @_; |
184
|
|
|
|
|
|
|
# String => '\\([a-zA-Z]+|.)' |
185
|
|
|
|
|
|
|
# attribute => 'Char' |
186
|
|
|
|
|
|
|
# context => '#stay' |
187
|
|
|
|
|
|
|
# type => 'RegExpr' |
188
|
176
|
50
|
|
|
|
335
|
if ($self->testRegExpr($text, '\\\\([a-zA-Z]+|.)', 0, 0, 0, undef, 0, '#stay', 'Char')) { |
189
|
0
|
|
|
|
|
0
|
return 1 |
190
|
|
|
|
|
|
|
} |
191
|
|
|
|
|
|
|
# attribute => 'String' |
192
|
|
|
|
|
|
|
# char => '"' |
193
|
|
|
|
|
|
|
# context => '#pop' |
194
|
|
|
|
|
|
|
# type => 'DetectChar' |
195
|
176
|
100
|
|
|
|
387
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) { |
196
|
10
|
|
|
|
|
19
|
return 1 |
197
|
|
|
|
|
|
|
} |
198
|
166
|
|
|
|
|
256
|
return 0; |
199
|
|
|
|
|
|
|
}; |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
1; |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
__END__ |