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.07'; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
1022
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
47
|
|
18
|
1
|
|
|
1
|
|
8
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
42
|
|
19
|
1
|
|
|
1
|
|
6
|
use base('Syntax::Highlight::Engine::Kate::Template'); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
862
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
2
|
|
|
2
|
0
|
700
|
my $proto = shift; |
23
|
2
|
|
33
|
|
|
13
|
my $class = ref($proto) || $proto; |
24
|
2
|
|
|
|
|
21
|
my $self = $class->SUPER::new(@_); |
25
|
2
|
|
|
|
|
26
|
$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
|
|
|
|
|
17
|
$self->listAdd('kw_command', |
35
|
|
|
|
|
|
|
'@comment', |
36
|
|
|
|
|
|
|
'@preamble', |
37
|
|
|
|
|
|
|
'@string', |
38
|
|
|
|
|
|
|
); |
39
|
2
|
|
|
|
|
7
|
$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
|
|
|
|
|
28
|
$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
|
|
|
|
|
15
|
$self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
72
|
2
|
|
|
|
|
9
|
$self->basecontext('Normal'); |
73
|
2
|
|
|
|
|
18
|
$self->keywordscase(0); |
74
|
2
|
|
|
|
|
6
|
$self->initialize; |
75
|
2
|
|
|
|
|
8
|
bless ($self, $class); |
76
|
2
|
|
|
|
|
12
|
return $self; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub language { |
80
|
0
|
|
|
0
|
0
|
0
|
return 'BibTeX'; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub parseEntry { |
84
|
46
|
|
|
46
|
0
|
80
|
my ($self, $text) = @_; |
85
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
86
|
|
|
|
|
|
|
# char => ',' |
87
|
|
|
|
|
|
|
# context => '#pop' |
88
|
|
|
|
|
|
|
# type => 'DetectChar' |
89
|
46
|
100
|
|
|
|
256
|
if ($self->testDetectChar($text, ',', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) { |
90
|
6
|
|
|
|
|
24
|
return 1 |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
93
|
|
|
|
|
|
|
# beginRegion => 'block' |
94
|
|
|
|
|
|
|
# char => '{' |
95
|
|
|
|
|
|
|
# context => '#stay' |
96
|
|
|
|
|
|
|
# type => 'DetectChar' |
97
|
40
|
100
|
|
|
|
182
|
if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) { |
98
|
6
|
|
|
|
|
23
|
return 1 |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
101
|
|
|
|
|
|
|
# char => '}' |
102
|
|
|
|
|
|
|
# context => '#stay' |
103
|
|
|
|
|
|
|
# endRegion => 'block' |
104
|
|
|
|
|
|
|
# type => 'DetectChar' |
105
|
34
|
50
|
|
|
|
124
|
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
|
|
|
|
1317
|
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
|
|
|
|
127
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) { |
120
|
0
|
|
|
|
|
0
|
return 1 |
121
|
|
|
|
|
|
|
} |
122
|
34
|
|
|
|
|
171
|
return 0; |
123
|
|
|
|
|
|
|
}; |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub parseNormal { |
126
|
586
|
|
|
586
|
0
|
1295
|
my ($self, $text) = @_; |
127
|
|
|
|
|
|
|
# String => '([a-zA-Z]+)\s*=' |
128
|
|
|
|
|
|
|
# attribute => 'Field' |
129
|
|
|
|
|
|
|
# context => '#stay' |
130
|
|
|
|
|
|
|
# firstNonSpace => 'true' |
131
|
|
|
|
|
|
|
# type => 'RegExpr' |
132
|
586
|
100
|
|
|
|
2639
|
if ($self->testRegExpr($text, '([a-zA-Z]+)\\s*=', 0, 0, 0, undef, 1, '#stay', 'Field')) { |
133
|
24
|
|
|
|
|
71
|
return 1 |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
# String => 'kw_entry' |
136
|
|
|
|
|
|
|
# attribute => 'Entry' |
137
|
|
|
|
|
|
|
# context => 'Entry' |
138
|
|
|
|
|
|
|
# type => 'keyword' |
139
|
562
|
100
|
|
|
|
3168
|
if ($self->testKeyword($text, 'kw_entry', 0, undef, 0, 'Entry', 'Entry')) { |
140
|
6
|
|
|
|
|
20
|
return 1 |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
# String => 'kw_command' |
143
|
|
|
|
|
|
|
# attribute => 'Command' |
144
|
|
|
|
|
|
|
# context => '#stay' |
145
|
|
|
|
|
|
|
# type => 'keyword' |
146
|
556
|
100
|
|
|
|
1937
|
if ($self->testKeyword($text, 'kw_command', 0, undef, 0, '#stay', 'Command')) { |
147
|
2
|
|
|
|
|
14
|
return 1 |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
150
|
|
|
|
|
|
|
# beginRegion => 'block' |
151
|
|
|
|
|
|
|
# char => '{' |
152
|
|
|
|
|
|
|
# context => '#stay' |
153
|
|
|
|
|
|
|
# type => 'DetectChar' |
154
|
554
|
100
|
|
|
|
1894
|
if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) { |
155
|
18
|
|
|
|
|
54
|
return 1 |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
158
|
|
|
|
|
|
|
# char => '}' |
159
|
|
|
|
|
|
|
# context => '#stay' |
160
|
|
|
|
|
|
|
# endRegion => 'block' |
161
|
|
|
|
|
|
|
# type => 'DetectChar' |
162
|
536
|
100
|
|
|
|
2057
|
if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) { |
163
|
24
|
|
|
|
|
73
|
return 1 |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
# String => '\\([a-zA-Z]+|.)' |
166
|
|
|
|
|
|
|
# attribute => 'Char' |
167
|
|
|
|
|
|
|
# context => '#stay' |
168
|
|
|
|
|
|
|
# type => 'RegExpr' |
169
|
512
|
50
|
|
|
|
1973
|
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
|
|
|
|
2367
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, 'String', 'String')) { |
177
|
10
|
|
|
|
|
32
|
return 1 |
178
|
|
|
|
|
|
|
} |
179
|
502
|
|
|
|
|
1537
|
return 0; |
180
|
|
|
|
|
|
|
}; |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
sub parseString { |
183
|
176
|
|
|
176
|
0
|
285
|
my ($self, $text) = @_; |
184
|
|
|
|
|
|
|
# String => '\\([a-zA-Z]+|.)' |
185
|
|
|
|
|
|
|
# attribute => 'Char' |
186
|
|
|
|
|
|
|
# context => '#stay' |
187
|
|
|
|
|
|
|
# type => 'RegExpr' |
188
|
176
|
50
|
|
|
|
609
|
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
|
|
|
|
765
|
if ($self->testDetectChar($text, '"', 0, 0, 0, undef, 0, '#pop', 'String')) { |
196
|
10
|
|
|
|
|
34
|
return 1 |
197
|
|
|
|
|
|
|
} |
198
|
166
|
|
|
|
|
426
|
return 0; |
199
|
|
|
|
|
|
|
}; |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
1; |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
__END__ |