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 'latex.xml' file of the syntax highlight |
6
|
|
|
|
|
|
|
# engine of the kate text editor (http://www.kate-editor.org |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#kate xml version 1.14 |
9
|
|
|
|
|
|
|
#kate version 2.4 |
10
|
|
|
|
|
|
|
#kate author Jeroen Wijnhout (Jeroen.Wijnhout@kdemail.net) |
11
|
|
|
|
|
|
|
#generated: Sun Feb 3 22:02:05 2008, localtime |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Syntax::Highlight::Engine::Kate::LaTeX; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.12'; |
16
|
|
|
|
|
|
|
|
17
|
1
|
|
|
1
|
|
795
|
use strict; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
85
|
|
18
|
1
|
|
|
1
|
|
11
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
51
|
|
19
|
1
|
|
|
1
|
|
9
|
use base('Syntax::Highlight::Engine::Kate::Template'); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
2606
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
2
|
|
|
2
|
0
|
1141
|
my $proto = shift; |
23
|
2
|
|
33
|
|
|
19
|
my $class = ref($proto) || $proto; |
24
|
2
|
|
|
|
|
20
|
my $self = $class->SUPER::new(@_); |
25
|
2
|
|
|
|
|
34
|
$self->attributes({ |
26
|
|
|
|
|
|
|
'Comment' => 'Comment', |
27
|
|
|
|
|
|
|
'Environment' => 'DataType', |
28
|
|
|
|
|
|
|
'Keyword' => 'Keyword', |
29
|
|
|
|
|
|
|
'Keyword Mathmode' => 'Reserved', |
30
|
|
|
|
|
|
|
'Math' => 'Float', |
31
|
|
|
|
|
|
|
'Normal Text' => 'Normal', |
32
|
|
|
|
|
|
|
'Region Marker' => 'RegionMarker', |
33
|
|
|
|
|
|
|
'Structure' => 'String', |
34
|
|
|
|
|
|
|
'Verbatim' => 'BString', |
35
|
|
|
|
|
|
|
}); |
36
|
2
|
|
|
|
|
376
|
$self->contextdata({ |
37
|
|
|
|
|
|
|
'Comment' => { |
38
|
|
|
|
|
|
|
callback => \&parseComment, |
39
|
|
|
|
|
|
|
attribute => 'Comment', |
40
|
|
|
|
|
|
|
lineending => '#pop', |
41
|
|
|
|
|
|
|
}, |
42
|
|
|
|
|
|
|
'ContrSeq' => { |
43
|
|
|
|
|
|
|
callback => \&parseContrSeq, |
44
|
|
|
|
|
|
|
attribute => 'Keyword', |
45
|
|
|
|
|
|
|
lineending => '#pop', |
46
|
|
|
|
|
|
|
}, |
47
|
|
|
|
|
|
|
'Environment' => { |
48
|
|
|
|
|
|
|
callback => \&parseEnvironment, |
49
|
|
|
|
|
|
|
attribute => 'Environment', |
50
|
|
|
|
|
|
|
}, |
51
|
|
|
|
|
|
|
'FindEnvironment' => { |
52
|
|
|
|
|
|
|
callback => \&parseFindEnvironment, |
53
|
|
|
|
|
|
|
attribute => 'Normal Text', |
54
|
|
|
|
|
|
|
}, |
55
|
|
|
|
|
|
|
'Label' => { |
56
|
|
|
|
|
|
|
callback => \&parseLabel, |
57
|
|
|
|
|
|
|
attribute => 'Normal Text', |
58
|
|
|
|
|
|
|
lineending => '#pop#pop', |
59
|
|
|
|
|
|
|
fallthrough => '#pop#pop', |
60
|
|
|
|
|
|
|
}, |
61
|
|
|
|
|
|
|
'MathContrSeq' => { |
62
|
|
|
|
|
|
|
callback => \&parseMathContrSeq, |
63
|
|
|
|
|
|
|
attribute => 'Keyword Mathmode', |
64
|
|
|
|
|
|
|
lineending => '#pop', |
65
|
|
|
|
|
|
|
}, |
66
|
|
|
|
|
|
|
'MathEnv' => { |
67
|
|
|
|
|
|
|
callback => \&parseMathEnv, |
68
|
|
|
|
|
|
|
attribute => 'Environment', |
69
|
|
|
|
|
|
|
}, |
70
|
|
|
|
|
|
|
'MathFindEnd' => { |
71
|
|
|
|
|
|
|
callback => \&parseMathFindEnd, |
72
|
|
|
|
|
|
|
attribute => 'Normal Text', |
73
|
|
|
|
|
|
|
lineending => '#pop', |
74
|
|
|
|
|
|
|
fallthrough => '#pop', |
75
|
|
|
|
|
|
|
}, |
76
|
|
|
|
|
|
|
'MathMode' => { |
77
|
|
|
|
|
|
|
callback => \&parseMathMode, |
78
|
|
|
|
|
|
|
attribute => 'Math', |
79
|
|
|
|
|
|
|
}, |
80
|
|
|
|
|
|
|
'MathModeEnv' => { |
81
|
|
|
|
|
|
|
callback => \&parseMathModeEnv, |
82
|
|
|
|
|
|
|
attribute => 'Math', |
83
|
|
|
|
|
|
|
}, |
84
|
|
|
|
|
|
|
'Normal Text' => { |
85
|
|
|
|
|
|
|
callback => \&parseNormalText, |
86
|
|
|
|
|
|
|
attribute => 'Normal Text', |
87
|
|
|
|
|
|
|
}, |
88
|
|
|
|
|
|
|
'ToEndOfLine' => { |
89
|
|
|
|
|
|
|
callback => \&parseToEndOfLine, |
90
|
|
|
|
|
|
|
attribute => 'Normal Text', |
91
|
|
|
|
|
|
|
lineending => '#pop', |
92
|
|
|
|
|
|
|
}, |
93
|
|
|
|
|
|
|
'Verb' => { |
94
|
|
|
|
|
|
|
callback => \&parseVerb, |
95
|
|
|
|
|
|
|
attribute => 'Verbatim', |
96
|
|
|
|
|
|
|
lineending => '#pop', |
97
|
|
|
|
|
|
|
fallthrough => '#pop', |
98
|
|
|
|
|
|
|
}, |
99
|
|
|
|
|
|
|
'VerbFindEnd' => { |
100
|
|
|
|
|
|
|
callback => \&parseVerbFindEnd, |
101
|
|
|
|
|
|
|
attribute => 'Normal Text', |
102
|
|
|
|
|
|
|
lineending => '#pop', |
103
|
|
|
|
|
|
|
fallthrough => '#pop', |
104
|
|
|
|
|
|
|
}, |
105
|
|
|
|
|
|
|
'Verbatim' => { |
106
|
|
|
|
|
|
|
callback => \&parseVerbatim, |
107
|
|
|
|
|
|
|
attribute => 'Verbatim', |
108
|
|
|
|
|
|
|
}, |
109
|
|
|
|
|
|
|
'VerbatimEnv' => { |
110
|
|
|
|
|
|
|
callback => \&parseVerbatimEnv, |
111
|
|
|
|
|
|
|
attribute => 'Environment', |
112
|
|
|
|
|
|
|
}, |
113
|
|
|
|
|
|
|
}); |
114
|
2
|
|
|
|
|
20
|
$self->deliminators('\\s||\\.|\\(|\\)|:|\\!|\\+|,|-|<|=|>|\\%|\\&|\\*|\\/|;|\\?|\\[|\\]|\\^|\\{|\\||\\}|\\~|\\\\'); |
115
|
2
|
|
|
|
|
13
|
$self->basecontext('Normal Text'); |
116
|
2
|
|
|
|
|
14
|
$self->keywordscase(1); |
117
|
2
|
|
|
|
|
10
|
$self->initialize; |
118
|
2
|
|
|
|
|
7
|
bless ($self, $class); |
119
|
2
|
|
|
|
|
16
|
return $self; |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub language { |
123
|
0
|
|
|
0
|
0
|
0
|
return 'LaTeX'; |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub parseComment { |
127
|
326
|
|
|
326
|
0
|
652
|
my ($self, $text) = @_; |
128
|
326
|
|
|
|
|
756
|
return 0; |
129
|
|
|
|
|
|
|
}; |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub parseContrSeq { |
132
|
10
|
|
|
10
|
0
|
53
|
my ($self, $text) = @_; |
133
|
|
|
|
|
|
|
# String => 'verb*' |
134
|
|
|
|
|
|
|
# attribute => 'Keyword' |
135
|
|
|
|
|
|
|
# context => 'Verb' |
136
|
|
|
|
|
|
|
# type => 'StringDetect' |
137
|
10
|
50
|
|
|
|
50
|
if ($self->testStringDetect($text, 'verb*', 0, 0, 0, undef, 0, 'Verb', 'Keyword')) { |
138
|
0
|
|
|
|
|
0
|
return 1 |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
# String => 'verb' |
141
|
|
|
|
|
|
|
# attribute => 'Keyword' |
142
|
|
|
|
|
|
|
# context => 'Verb' |
143
|
|
|
|
|
|
|
# type => 'StringDetect' |
144
|
10
|
100
|
|
|
|
44
|
if ($self->testStringDetect($text, 'verb', 0, 0, 0, undef, 0, 'Verb', 'Keyword')) { |
145
|
2
|
|
|
|
|
6
|
return 1 |
146
|
|
|
|
|
|
|
} |
147
|
|
|
|
|
|
|
# String => '[a-zA-Z]+' |
148
|
|
|
|
|
|
|
# attribute => 'Keyword' |
149
|
|
|
|
|
|
|
# context => '#pop' |
150
|
|
|
|
|
|
|
# type => 'RegExpr' |
151
|
8
|
100
|
|
|
|
37
|
if ($self->testRegExpr($text, '[a-zA-Z]+', 0, 0, 0, undef, 0, '#pop', 'Keyword')) { |
152
|
2
|
|
|
|
|
10
|
return 1 |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
# String => '[^a-zA-Z]' |
155
|
|
|
|
|
|
|
# attribute => 'Keyword' |
156
|
|
|
|
|
|
|
# context => '#pop' |
157
|
|
|
|
|
|
|
# type => 'RegExpr' |
158
|
6
|
50
|
|
|
|
27
|
if ($self->testRegExpr($text, '[^a-zA-Z]', 0, 0, 0, undef, 0, '#pop', 'Keyword')) { |
159
|
6
|
|
|
|
|
20
|
return 1 |
160
|
|
|
|
|
|
|
} |
161
|
0
|
|
|
|
|
0
|
return 0; |
162
|
|
|
|
|
|
|
}; |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
sub parseEnvironment { |
165
|
130
|
|
|
130
|
0
|
257
|
my ($self, $text) = @_; |
166
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
167
|
|
|
|
|
|
|
# char => '}' |
168
|
|
|
|
|
|
|
# context => '#pop#pop' |
169
|
|
|
|
|
|
|
# type => 'DetectChar' |
170
|
130
|
100
|
|
|
|
326
|
if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop#pop', 'Normal Text')) { |
171
|
4
|
|
|
|
|
12
|
return 1 |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
174
|
|
|
|
|
|
|
# char => ']' |
175
|
|
|
|
|
|
|
# context => '#pop#pop' |
176
|
|
|
|
|
|
|
# type => 'DetectChar' |
177
|
126
|
50
|
|
|
|
300
|
if ($self->testDetectChar($text, ']', 0, 0, 0, undef, 0, '#pop#pop', 'Normal Text')) { |
178
|
0
|
|
|
|
|
0
|
return 1 |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
# String => '(semiverbatim|verbatim|lstlisting|boxedverbatim|Verbatim)\*?' |
181
|
|
|
|
|
|
|
# attribute => 'Environment' |
182
|
|
|
|
|
|
|
# context => 'VerbatimEnv' |
183
|
|
|
|
|
|
|
# type => 'RegExpr' |
184
|
126
|
100
|
|
|
|
329
|
if ($self->testRegExpr($text, '(semiverbatim|verbatim|lstlisting|boxedverbatim|Verbatim)\\*?', 0, 0, 0, undef, 0, 'VerbatimEnv', 'Environment')) { |
185
|
6
|
|
|
|
|
15
|
return 1 |
186
|
|
|
|
|
|
|
} |
187
|
|
|
|
|
|
|
# String => '(equation|displaymath|eqnarray|subeqnarray|math|multline|gather|align|alignat|flalign)\*?' |
188
|
|
|
|
|
|
|
# attribute => 'Environment' |
189
|
|
|
|
|
|
|
# context => 'MathEnv' |
190
|
|
|
|
|
|
|
# type => 'RegExpr' |
191
|
120
|
100
|
|
|
|
338
|
if ($self->testRegExpr($text, '(equation|displaymath|eqnarray|subeqnarray|math|multline|gather|align|alignat|flalign)\\*?', 0, 0, 0, undef, 0, 'MathEnv', 'Environment')) { |
192
|
4
|
|
|
|
|
16
|
return 1 |
193
|
|
|
|
|
|
|
} |
194
|
116
|
|
|
|
|
235
|
return 0; |
195
|
|
|
|
|
|
|
}; |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
sub parseFindEnvironment { |
198
|
14
|
|
|
14
|
0
|
35
|
my ($self, $text) = @_; |
199
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
200
|
|
|
|
|
|
|
# char => '{' |
201
|
|
|
|
|
|
|
# context => 'Environment' |
202
|
|
|
|
|
|
|
# type => 'DetectChar' |
203
|
14
|
50
|
|
|
|
61
|
if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, 'Environment', 'Normal Text')) { |
204
|
14
|
|
|
|
|
40
|
return 1 |
205
|
|
|
|
|
|
|
} |
206
|
|
|
|
|
|
|
# String => '\S' |
207
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
208
|
|
|
|
|
|
|
# context => '#pop' |
209
|
|
|
|
|
|
|
# type => 'RegExpr' |
210
|
0
|
0
|
|
|
|
0
|
if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) { |
211
|
0
|
|
|
|
|
0
|
return 1 |
212
|
|
|
|
|
|
|
} |
213
|
0
|
|
|
|
|
0
|
return 0; |
214
|
|
|
|
|
|
|
}; |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
sub parseLabel { |
217
|
18
|
|
|
18
|
0
|
34
|
my ($self, $text) = @_; |
218
|
|
|
|
|
|
|
# String => '\s*\{\s*' |
219
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
220
|
|
|
|
|
|
|
# context => '#stay' |
221
|
|
|
|
|
|
|
# type => 'RegExpr' |
222
|
18
|
100
|
|
|
|
49
|
if ($self->testRegExpr($text, '\\s*\\{\\s*', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) { |
223
|
6
|
|
|
|
|
16
|
return 1 |
224
|
|
|
|
|
|
|
} |
225
|
|
|
|
|
|
|
# String => '[^\}\{]+' |
226
|
|
|
|
|
|
|
# attribute => 'Environment' |
227
|
|
|
|
|
|
|
# context => '#stay' |
228
|
|
|
|
|
|
|
# type => 'RegExpr' |
229
|
12
|
100
|
|
|
|
40
|
if ($self->testRegExpr($text, '[^\\}\\{]+', 0, 0, 0, undef, 0, '#stay', 'Environment')) { |
230
|
6
|
|
|
|
|
16
|
return 1 |
231
|
|
|
|
|
|
|
} |
232
|
|
|
|
|
|
|
# String => '\s*\}\s*' |
233
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
234
|
|
|
|
|
|
|
# context => '#pop' |
235
|
|
|
|
|
|
|
# type => 'RegExpr' |
236
|
6
|
50
|
|
|
|
22
|
if ($self->testRegExpr($text, '\\s*\\}\\s*', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) { |
237
|
6
|
|
|
|
|
14
|
return 1 |
238
|
|
|
|
|
|
|
} |
239
|
0
|
|
|
|
|
0
|
return 0; |
240
|
|
|
|
|
|
|
}; |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
sub parseMathContrSeq { |
243
|
16
|
|
|
16
|
0
|
43
|
my ($self, $text) = @_; |
244
|
|
|
|
|
|
|
# String => '[a-zA-Z]+' |
245
|
|
|
|
|
|
|
# attribute => 'Keyword Mathmode' |
246
|
|
|
|
|
|
|
# context => '#pop' |
247
|
|
|
|
|
|
|
# type => 'RegExpr' |
248
|
16
|
100
|
|
|
|
68
|
if ($self->testRegExpr($text, '[a-zA-Z]+', 0, 0, 0, undef, 0, '#pop', 'Keyword Mathmode')) { |
249
|
14
|
|
|
|
|
44
|
return 1 |
250
|
|
|
|
|
|
|
} |
251
|
|
|
|
|
|
|
# String => '[^a-zA-Z]' |
252
|
|
|
|
|
|
|
# attribute => 'Keyword Mathmode' |
253
|
|
|
|
|
|
|
# context => '#pop' |
254
|
|
|
|
|
|
|
# type => 'RegExpr' |
255
|
2
|
50
|
|
|
|
10
|
if ($self->testRegExpr($text, '[^a-zA-Z]', 0, 0, 0, undef, 0, '#pop', 'Keyword Mathmode')) { |
256
|
2
|
|
|
|
|
11
|
return 1 |
257
|
|
|
|
|
|
|
} |
258
|
0
|
|
|
|
|
0
|
return 0; |
259
|
|
|
|
|
|
|
}; |
260
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
sub parseMathEnv { |
262
|
4
|
|
|
4
|
0
|
15
|
my ($self, $text) = @_; |
263
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
264
|
|
|
|
|
|
|
# char => '}' |
265
|
|
|
|
|
|
|
# context => 'MathModeEnv' |
266
|
|
|
|
|
|
|
# type => 'DetectChar' |
267
|
4
|
50
|
|
|
|
19
|
if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, 'MathModeEnv', 'Normal Text')) { |
268
|
4
|
|
|
|
|
12
|
return 1 |
269
|
|
|
|
|
|
|
} |
270
|
|
|
|
|
|
|
# String => '\S' |
271
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
272
|
|
|
|
|
|
|
# context => '#pop' |
273
|
|
|
|
|
|
|
# type => 'RegExpr' |
274
|
0
|
0
|
|
|
|
0
|
if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) { |
275
|
0
|
|
|
|
|
0
|
return 1 |
276
|
|
|
|
|
|
|
} |
277
|
0
|
|
|
|
|
0
|
return 0; |
278
|
|
|
|
|
|
|
}; |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
sub parseMathFindEnd { |
281
|
12
|
|
|
12
|
0
|
25
|
my ($self, $text) = @_; |
282
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
283
|
|
|
|
|
|
|
# char => '{' |
284
|
|
|
|
|
|
|
# context => '#stay' |
285
|
|
|
|
|
|
|
# type => 'DetectChar' |
286
|
12
|
100
|
|
|
|
34
|
if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) { |
287
|
4
|
|
|
|
|
14
|
return 1 |
288
|
|
|
|
|
|
|
} |
289
|
|
|
|
|
|
|
# String => '[a-zA-Z]*(equation|displaymath|eqnarray|subeqnarray|math|multline|gather|align|alignat|flalign)\*?' |
290
|
|
|
|
|
|
|
# attribute => 'Environment' |
291
|
|
|
|
|
|
|
# context => '#stay' |
292
|
|
|
|
|
|
|
# type => 'RegExpr' |
293
|
8
|
100
|
|
|
|
26
|
if ($self->testRegExpr($text, '[a-zA-Z]*(equation|displaymath|eqnarray|subeqnarray|math|multline|gather|align|alignat|flalign)\\*?', 0, 0, 0, undef, 0, '#stay', 'Environment')) { |
294
|
4
|
|
|
|
|
9
|
return 1 |
295
|
|
|
|
|
|
|
} |
296
|
|
|
|
|
|
|
# type => 'DetectSpaces' |
297
|
4
|
50
|
|
|
|
29
|
if ($self->testDetectSpaces($text, 0, undef, 0, '#stay', undef)) { |
298
|
0
|
|
|
|
|
0
|
return 1 |
299
|
|
|
|
|
|
|
} |
300
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
301
|
|
|
|
|
|
|
# char => '}' |
302
|
|
|
|
|
|
|
# context => '#pop#pop#pop#pop#pop' |
303
|
|
|
|
|
|
|
# endRegion => 'block' |
304
|
|
|
|
|
|
|
# type => 'DetectChar' |
305
|
4
|
50
|
|
|
|
20
|
if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop#pop#pop#pop#pop', 'Normal Text')) { |
306
|
4
|
|
|
|
|
11
|
return 1 |
307
|
|
|
|
|
|
|
} |
308
|
0
|
|
|
|
|
0
|
return 0; |
309
|
|
|
|
|
|
|
}; |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
sub parseMathMode { |
312
|
230
|
|
|
230
|
0
|
418
|
my ($self, $text) = @_; |
313
|
|
|
|
|
|
|
# attribute => 'Math' |
314
|
|
|
|
|
|
|
# char => '\' |
315
|
|
|
|
|
|
|
# char1 => ']' |
316
|
|
|
|
|
|
|
# context => '#pop' |
317
|
|
|
|
|
|
|
# endRegion => 'mathMode' |
318
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
319
|
230
|
100
|
|
|
|
554
|
if ($self->testDetect2Chars($text, '\\', ']', 0, 0, 0, undef, 0, '#pop', 'Math')) { |
320
|
2
|
|
|
|
|
7
|
return 1 |
321
|
|
|
|
|
|
|
} |
322
|
|
|
|
|
|
|
# attribute => 'Math' |
323
|
|
|
|
|
|
|
# char => '\' |
324
|
|
|
|
|
|
|
# char1 => ')' |
325
|
|
|
|
|
|
|
# context => '#pop' |
326
|
|
|
|
|
|
|
# endRegion => 'mathMode' |
327
|
|
|
|
|
|
|
# type => 'Detect2Chars' |
328
|
228
|
100
|
|
|
|
545
|
if ($self->testDetect2Chars($text, '\\', ')', 0, 0, 0, undef, 0, '#pop', 'Math')) { |
329
|
2
|
|
|
|
|
6
|
return 1 |
330
|
|
|
|
|
|
|
} |
331
|
|
|
|
|
|
|
# String => '\\begin(?=[^a-zA-Z])' |
332
|
|
|
|
|
|
|
# attribute => 'Keyword Mathmode' |
333
|
|
|
|
|
|
|
# beginRegion => 'block' |
334
|
|
|
|
|
|
|
# context => '#stay' |
335
|
|
|
|
|
|
|
# type => 'RegExpr' |
336
|
226
|
100
|
|
|
|
615
|
if ($self->testRegExpr($text, '\\\\begin(?=[^a-zA-Z])', 0, 0, 0, undef, 0, '#stay', 'Keyword Mathmode')) { |
337
|
2
|
|
|
|
|
8
|
return 1 |
338
|
|
|
|
|
|
|
} |
339
|
|
|
|
|
|
|
# String => '\\end(?=[^a-zA-Z])' |
340
|
|
|
|
|
|
|
# attribute => 'Keyword Mathmode' |
341
|
|
|
|
|
|
|
# context => '#stay' |
342
|
|
|
|
|
|
|
# endRegion => 'block' |
343
|
|
|
|
|
|
|
# type => 'RegExpr' |
344
|
224
|
100
|
|
|
|
685
|
if ($self->testRegExpr($text, '\\\\end(?=[^a-zA-Z])', 0, 0, 0, undef, 0, '#stay', 'Keyword Mathmode')) { |
345
|
2
|
|
|
|
|
6
|
return 1 |
346
|
|
|
|
|
|
|
} |
347
|
|
|
|
|
|
|
# attribute => 'Keyword Mathmode' |
348
|
|
|
|
|
|
|
# char => '\' |
349
|
|
|
|
|
|
|
# context => 'MathContrSeq' |
350
|
|
|
|
|
|
|
# type => 'DetectChar' |
351
|
222
|
100
|
|
|
|
643
|
if ($self->testDetectChar($text, '\\', 0, 0, 0, undef, 0, 'MathContrSeq', 'Keyword Mathmode')) { |
352
|
6
|
|
|
|
|
15
|
return 1 |
353
|
|
|
|
|
|
|
} |
354
|
|
|
|
|
|
|
# String => '$$' |
355
|
|
|
|
|
|
|
# attribute => 'Math' |
356
|
|
|
|
|
|
|
# context => '#pop' |
357
|
|
|
|
|
|
|
# endRegion => 'mathMode' |
358
|
|
|
|
|
|
|
# type => 'StringDetect' |
359
|
216
|
100
|
|
|
|
557
|
if ($self->testStringDetect($text, '$$', 0, 0, 0, undef, 0, '#pop', 'Math')) { |
360
|
2
|
|
|
|
|
7
|
return 1 |
361
|
|
|
|
|
|
|
} |
362
|
|
|
|
|
|
|
# attribute => 'Math' |
363
|
|
|
|
|
|
|
# char => '$' |
364
|
|
|
|
|
|
|
# context => '#pop' |
365
|
|
|
|
|
|
|
# endRegion => 'mathMode' |
366
|
|
|
|
|
|
|
# type => 'DetectChar' |
367
|
214
|
100
|
|
|
|
486
|
if ($self->testDetectChar($text, '$', 0, 0, 0, undef, 0, '#pop', 'Math')) { |
368
|
2
|
|
|
|
|
8
|
return 1 |
369
|
|
|
|
|
|
|
} |
370
|
|
|
|
|
|
|
# String => '%\s*BEGIN.*$' |
371
|
|
|
|
|
|
|
# attribute => 'Region Marker' |
372
|
|
|
|
|
|
|
# beginRegion => 'regionMarker' |
373
|
|
|
|
|
|
|
# context => '#stay' |
374
|
|
|
|
|
|
|
# firstNonSpace => 'true' |
375
|
|
|
|
|
|
|
# type => 'RegExpr' |
376
|
212
|
50
|
|
|
|
541
|
if ($self->testRegExpr($text, '%\\s*BEGIN.*$', 0, 0, 0, undef, 1, '#stay', 'Region Marker')) { |
377
|
0
|
|
|
|
|
0
|
return 1 |
378
|
|
|
|
|
|
|
} |
379
|
|
|
|
|
|
|
# String => '%\s*END.*$' |
380
|
|
|
|
|
|
|
# attribute => 'Region Marker' |
381
|
|
|
|
|
|
|
# context => '#stay' |
382
|
|
|
|
|
|
|
# endRegion => 'regionMarker' |
383
|
|
|
|
|
|
|
# firstNonSpace => 'true' |
384
|
|
|
|
|
|
|
# type => 'RegExpr' |
385
|
212
|
50
|
|
|
|
627
|
if ($self->testRegExpr($text, '%\\s*END.*$', 0, 0, 0, undef, 1, '#stay', 'Region Marker')) { |
386
|
0
|
|
|
|
|
0
|
return 1 |
387
|
|
|
|
|
|
|
} |
388
|
|
|
|
|
|
|
# attribute => 'Comment' |
389
|
|
|
|
|
|
|
# char => '%' |
390
|
|
|
|
|
|
|
# context => 'Comment' |
391
|
|
|
|
|
|
|
# type => 'DetectChar' |
392
|
212
|
100
|
|
|
|
580
|
if ($self->testDetectChar($text, '%', 0, 0, 0, undef, 0, 'Comment', 'Comment')) { |
393
|
2
|
|
|
|
|
7
|
return 1 |
394
|
|
|
|
|
|
|
} |
395
|
210
|
|
|
|
|
408
|
return 0; |
396
|
|
|
|
|
|
|
}; |
397
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
sub parseMathModeEnv { |
399
|
112
|
|
|
112
|
0
|
194
|
my ($self, $text) = @_; |
400
|
|
|
|
|
|
|
# String => '\\end(?=\s*\{\s*[a-zA-Z]*(equation|displaymath|eqnarray|subeqnarray|math|multline|gather|align|alignat|flalign)\*?\s*\})' |
401
|
|
|
|
|
|
|
# attribute => 'Structure' |
402
|
|
|
|
|
|
|
# context => 'MathFindEnd' |
403
|
|
|
|
|
|
|
# type => 'RegExpr' |
404
|
112
|
100
|
|
|
|
278
|
if ($self->testRegExpr($text, '\\\\end(?=\\s*\\{\\s*[a-zA-Z]*(equation|displaymath|eqnarray|subeqnarray|math|multline|gather|align|alignat|flalign)\\*?\\s*\\})', 0, 0, 0, undef, 0, 'MathFindEnd', 'Structure')) { |
405
|
4
|
|
|
|
|
11
|
return 1 |
406
|
|
|
|
|
|
|
} |
407
|
|
|
|
|
|
|
# String => '\\begin(?=[^a-zA-Z])' |
408
|
|
|
|
|
|
|
# attribute => 'Keyword Mathmode' |
409
|
|
|
|
|
|
|
# beginRegion => 'block' |
410
|
|
|
|
|
|
|
# context => '#stay' |
411
|
|
|
|
|
|
|
# type => 'RegExpr' |
412
|
108
|
100
|
|
|
|
345
|
if ($self->testRegExpr($text, '\\\\begin(?=[^a-zA-Z])', 0, 0, 0, undef, 0, '#stay', 'Keyword Mathmode')) { |
413
|
4
|
|
|
|
|
13
|
return 1 |
414
|
|
|
|
|
|
|
} |
415
|
|
|
|
|
|
|
# String => '\\end(?=[^a-zA-Z])' |
416
|
|
|
|
|
|
|
# attribute => 'Keyword Mathmode' |
417
|
|
|
|
|
|
|
# context => '#stay' |
418
|
|
|
|
|
|
|
# endRegion => 'block' |
419
|
|
|
|
|
|
|
# type => 'RegExpr' |
420
|
104
|
100
|
|
|
|
312
|
if ($self->testRegExpr($text, '\\\\end(?=[^a-zA-Z])', 0, 0, 0, undef, 0, '#stay', 'Keyword Mathmode')) { |
421
|
4
|
|
|
|
|
16
|
return 1 |
422
|
|
|
|
|
|
|
} |
423
|
|
|
|
|
|
|
# String => '\(' |
424
|
|
|
|
|
|
|
# attribute => 'Math' |
425
|
|
|
|
|
|
|
# beginRegion => 'mathMode' |
426
|
|
|
|
|
|
|
# context => 'MathMode' |
427
|
|
|
|
|
|
|
# type => 'StringDetect' |
428
|
100
|
50
|
|
|
|
288
|
if ($self->testStringDetect($text, '\\(', 0, 0, 0, undef, 0, 'MathMode', 'Math')) { |
429
|
0
|
|
|
|
|
0
|
return 1 |
430
|
|
|
|
|
|
|
} |
431
|
|
|
|
|
|
|
# String => '\[' |
432
|
|
|
|
|
|
|
# attribute => 'Math' |
433
|
|
|
|
|
|
|
# beginRegion => 'mathMode' |
434
|
|
|
|
|
|
|
# context => 'MathMode' |
435
|
|
|
|
|
|
|
# type => 'StringDetect' |
436
|
100
|
50
|
|
|
|
242
|
if ($self->testStringDetect($text, '\\[', 0, 0, 0, undef, 0, 'MathMode', 'Math')) { |
437
|
0
|
|
|
|
|
0
|
return 1 |
438
|
|
|
|
|
|
|
} |
439
|
|
|
|
|
|
|
# attribute => 'Keyword Mathmode' |
440
|
|
|
|
|
|
|
# char => '\' |
441
|
|
|
|
|
|
|
# context => 'MathContrSeq' |
442
|
|
|
|
|
|
|
# type => 'DetectChar' |
443
|
100
|
100
|
|
|
|
250
|
if ($self->testDetectChar($text, '\\', 0, 0, 0, undef, 0, 'MathContrSeq', 'Keyword Mathmode')) { |
444
|
10
|
|
|
|
|
29
|
return 1 |
445
|
|
|
|
|
|
|
} |
446
|
|
|
|
|
|
|
# String => '$$' |
447
|
|
|
|
|
|
|
# attribute => 'Math' |
448
|
|
|
|
|
|
|
# beginRegion => 'mathMode' |
449
|
|
|
|
|
|
|
# context => 'MathMode' |
450
|
|
|
|
|
|
|
# type => 'StringDetect' |
451
|
90
|
50
|
|
|
|
236
|
if ($self->testStringDetect($text, '$$', 0, 0, 0, undef, 0, 'MathMode', 'Math')) { |
452
|
0
|
|
|
|
|
0
|
return 1 |
453
|
|
|
|
|
|
|
} |
454
|
|
|
|
|
|
|
# attribute => 'Math' |
455
|
|
|
|
|
|
|
# beginRegion => 'mathMode' |
456
|
|
|
|
|
|
|
# char => '$' |
457
|
|
|
|
|
|
|
# context => 'MathMode' |
458
|
|
|
|
|
|
|
# type => 'DetectChar' |
459
|
90
|
50
|
|
|
|
205
|
if ($self->testDetectChar($text, '$', 0, 0, 0, undef, 0, 'MathMode', 'Math')) { |
460
|
0
|
|
|
|
|
0
|
return 1 |
461
|
|
|
|
|
|
|
} |
462
|
|
|
|
|
|
|
# String => '%\s*BEGIN.*$' |
463
|
|
|
|
|
|
|
# attribute => 'Region Marker' |
464
|
|
|
|
|
|
|
# beginRegion => 'regionMarker' |
465
|
|
|
|
|
|
|
# context => '#stay' |
466
|
|
|
|
|
|
|
# firstNonSpace => 'true' |
467
|
|
|
|
|
|
|
# type => 'RegExpr' |
468
|
90
|
50
|
|
|
|
236
|
if ($self->testRegExpr($text, '%\\s*BEGIN.*$', 0, 0, 0, undef, 1, '#stay', 'Region Marker')) { |
469
|
0
|
|
|
|
|
0
|
return 1 |
470
|
|
|
|
|
|
|
} |
471
|
|
|
|
|
|
|
# String => '%\s*END.*$' |
472
|
|
|
|
|
|
|
# attribute => 'Region Marker' |
473
|
|
|
|
|
|
|
# context => '#stay' |
474
|
|
|
|
|
|
|
# endRegion => 'regionMarker' |
475
|
|
|
|
|
|
|
# firstNonSpace => 'true' |
476
|
|
|
|
|
|
|
# type => 'RegExpr' |
477
|
90
|
50
|
|
|
|
262
|
if ($self->testRegExpr($text, '%\\s*END.*$', 0, 0, 0, undef, 1, '#stay', 'Region Marker')) { |
478
|
0
|
|
|
|
|
0
|
return 1 |
479
|
|
|
|
|
|
|
} |
480
|
|
|
|
|
|
|
# attribute => 'Comment' |
481
|
|
|
|
|
|
|
# char => '%' |
482
|
|
|
|
|
|
|
# context => 'Comment' |
483
|
|
|
|
|
|
|
# type => 'DetectChar' |
484
|
90
|
100
|
|
|
|
240
|
if ($self->testDetectChar($text, '%', 0, 0, 0, undef, 0, 'Comment', 'Comment')) { |
485
|
2
|
|
|
|
|
7
|
return 1 |
486
|
|
|
|
|
|
|
} |
487
|
88
|
|
|
|
|
205
|
return 0; |
488
|
|
|
|
|
|
|
}; |
489
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
sub parseNormalText { |
491
|
306
|
|
|
306
|
0
|
623
|
my ($self, $text) = @_; |
492
|
|
|
|
|
|
|
# String => '\\begin(?=[^a-zA-Z])' |
493
|
|
|
|
|
|
|
# attribute => 'Structure' |
494
|
|
|
|
|
|
|
# beginRegion => 'block' |
495
|
|
|
|
|
|
|
# context => 'FindEnvironment' |
496
|
|
|
|
|
|
|
# type => 'RegExpr' |
497
|
306
|
100
|
|
|
|
872
|
if ($self->testRegExpr($text, '\\\\begin(?=[^a-zA-Z])', 0, 0, 0, undef, 0, 'FindEnvironment', 'Structure')) { |
498
|
12
|
|
|
|
|
46
|
return 1 |
499
|
|
|
|
|
|
|
} |
500
|
|
|
|
|
|
|
# String => '\\end(?=[^a-zA-Z])' |
501
|
|
|
|
|
|
|
# attribute => 'Structure' |
502
|
|
|
|
|
|
|
# context => 'FindEnvironment' |
503
|
|
|
|
|
|
|
# endRegion => 'block' |
504
|
|
|
|
|
|
|
# type => 'RegExpr' |
505
|
294
|
100
|
|
|
|
910
|
if ($self->testRegExpr($text, '\\\\end(?=[^a-zA-Z])', 0, 0, 0, undef, 0, 'FindEnvironment', 'Structure')) { |
506
|
2
|
|
|
|
|
6
|
return 1 |
507
|
|
|
|
|
|
|
} |
508
|
|
|
|
|
|
|
# String => '\\(label|pageref|ref|cite)(?=[^a-zA-Z])' |
509
|
|
|
|
|
|
|
# attribute => 'Structure' |
510
|
|
|
|
|
|
|
# context => 'Label' |
511
|
|
|
|
|
|
|
# type => 'RegExpr' |
512
|
292
|
100
|
|
|
|
837
|
if ($self->testRegExpr($text, '\\\\(label|pageref|ref|cite)(?=[^a-zA-Z])', 0, 0, 0, undef, 0, 'Label', 'Structure')) { |
513
|
6
|
|
|
|
|
20
|
return 1 |
514
|
|
|
|
|
|
|
} |
515
|
|
|
|
|
|
|
# String => '\\(part|chapter|section|subsection|subsubsection|paragraph|subparagraph)(?=[^a-zA-Z])' |
516
|
|
|
|
|
|
|
# attribute => 'Structure' |
517
|
|
|
|
|
|
|
# context => '#stay' |
518
|
|
|
|
|
|
|
# type => 'RegExpr' |
519
|
286
|
100
|
|
|
|
865
|
if ($self->testRegExpr($text, '\\\\(part|chapter|section|subsection|subsubsection|paragraph|subparagraph)(?=[^a-zA-Z])', 0, 0, 0, undef, 0, '#stay', 'Structure')) { |
520
|
2
|
|
|
|
|
8
|
return 1 |
521
|
|
|
|
|
|
|
} |
522
|
|
|
|
|
|
|
# String => '\renewcommand' |
523
|
|
|
|
|
|
|
# attribute => 'Keyword' |
524
|
|
|
|
|
|
|
# context => 'ToEndOfLine' |
525
|
|
|
|
|
|
|
# type => 'StringDetect' |
526
|
284
|
50
|
|
|
|
883
|
if ($self->testStringDetect($text, '\\renewcommand', 0, 0, 0, undef, 0, 'ToEndOfLine', 'Keyword')) { |
527
|
0
|
|
|
|
|
0
|
return 1 |
528
|
|
|
|
|
|
|
} |
529
|
|
|
|
|
|
|
# String => '\newcommand' |
530
|
|
|
|
|
|
|
# attribute => 'Keyword' |
531
|
|
|
|
|
|
|
# context => 'ToEndOfLine' |
532
|
|
|
|
|
|
|
# type => 'StringDetect' |
533
|
284
|
100
|
|
|
|
709
|
if ($self->testStringDetect($text, '\\newcommand', 0, 0, 0, undef, 0, 'ToEndOfLine', 'Keyword')) { |
534
|
2
|
|
|
|
|
7
|
return 1 |
535
|
|
|
|
|
|
|
} |
536
|
|
|
|
|
|
|
# String => '\(' |
537
|
|
|
|
|
|
|
# attribute => 'Math' |
538
|
|
|
|
|
|
|
# beginRegion => 'mathMode' |
539
|
|
|
|
|
|
|
# context => 'MathMode' |
540
|
|
|
|
|
|
|
# type => 'StringDetect' |
541
|
282
|
100
|
|
|
|
761
|
if ($self->testStringDetect($text, '\\(', 0, 0, 0, undef, 0, 'MathMode', 'Math')) { |
542
|
2
|
|
|
|
|
6
|
return 1 |
543
|
|
|
|
|
|
|
} |
544
|
|
|
|
|
|
|
# String => '\[' |
545
|
|
|
|
|
|
|
# attribute => 'Math' |
546
|
|
|
|
|
|
|
# beginRegion => 'mathMode' |
547
|
|
|
|
|
|
|
# context => 'MathMode' |
548
|
|
|
|
|
|
|
# type => 'StringDetect' |
549
|
280
|
100
|
|
|
|
694
|
if ($self->testStringDetect($text, '\\[', 0, 0, 0, undef, 0, 'MathMode', 'Math')) { |
550
|
2
|
|
|
|
|
7
|
return 1 |
551
|
|
|
|
|
|
|
} |
552
|
|
|
|
|
|
|
# attribute => 'Keyword' |
553
|
|
|
|
|
|
|
# char => '\' |
554
|
|
|
|
|
|
|
# context => 'ContrSeq' |
555
|
|
|
|
|
|
|
# type => 'DetectChar' |
556
|
278
|
100
|
|
|
|
778
|
if ($self->testDetectChar($text, '\\', 0, 0, 0, undef, 0, 'ContrSeq', 'Keyword')) { |
557
|
10
|
|
|
|
|
29
|
return 1 |
558
|
|
|
|
|
|
|
} |
559
|
|
|
|
|
|
|
# String => '$$' |
560
|
|
|
|
|
|
|
# attribute => 'Math' |
561
|
|
|
|
|
|
|
# beginRegion => 'mathMode' |
562
|
|
|
|
|
|
|
# context => 'MathMode' |
563
|
|
|
|
|
|
|
# type => 'StringDetect' |
564
|
268
|
100
|
|
|
|
679
|
if ($self->testStringDetect($text, '$$', 0, 0, 0, undef, 0, 'MathMode', 'Math')) { |
565
|
2
|
|
|
|
|
7
|
return 1 |
566
|
|
|
|
|
|
|
} |
567
|
|
|
|
|
|
|
# attribute => 'Math' |
568
|
|
|
|
|
|
|
# beginRegion => 'mathMode' |
569
|
|
|
|
|
|
|
# char => '$' |
570
|
|
|
|
|
|
|
# context => 'MathMode' |
571
|
|
|
|
|
|
|
# type => 'DetectChar' |
572
|
266
|
100
|
|
|
|
686
|
if ($self->testDetectChar($text, '$', 0, 0, 0, undef, 0, 'MathMode', 'Math')) { |
573
|
2
|
|
|
|
|
12
|
return 1 |
574
|
|
|
|
|
|
|
} |
575
|
|
|
|
|
|
|
# String => '%\s*BEGIN.*$' |
576
|
|
|
|
|
|
|
# attribute => 'Region Marker' |
577
|
|
|
|
|
|
|
# beginRegion => 'regionMarker' |
578
|
|
|
|
|
|
|
# context => '#stay' |
579
|
|
|
|
|
|
|
# firstNonSpace => 'true' |
580
|
|
|
|
|
|
|
# type => 'RegExpr' |
581
|
264
|
50
|
|
|
|
727
|
if ($self->testRegExpr($text, '%\\s*BEGIN.*$', 0, 0, 0, undef, 1, '#stay', 'Region Marker')) { |
582
|
0
|
|
|
|
|
0
|
return 1 |
583
|
|
|
|
|
|
|
} |
584
|
|
|
|
|
|
|
# String => '%\s*END.*$' |
585
|
|
|
|
|
|
|
# attribute => 'Region Marker' |
586
|
|
|
|
|
|
|
# context => '#stay' |
587
|
|
|
|
|
|
|
# endRegion => 'regionMarker' |
588
|
|
|
|
|
|
|
# firstNonSpace => 'true' |
589
|
|
|
|
|
|
|
# type => 'RegExpr' |
590
|
264
|
50
|
|
|
|
775
|
if ($self->testRegExpr($text, '%\\s*END.*$', 0, 0, 0, undef, 1, '#stay', 'Region Marker')) { |
591
|
0
|
|
|
|
|
0
|
return 1 |
592
|
|
|
|
|
|
|
} |
593
|
|
|
|
|
|
|
# attribute => 'Comment' |
594
|
|
|
|
|
|
|
# char => '%' |
595
|
|
|
|
|
|
|
# context => 'Comment' |
596
|
|
|
|
|
|
|
# type => 'DetectChar' |
597
|
264
|
100
|
|
|
|
718
|
if ($self->testDetectChar($text, '%', 0, 0, 0, undef, 0, 'Comment', 'Comment')) { |
598
|
12
|
|
|
|
|
37
|
return 1 |
599
|
|
|
|
|
|
|
} |
600
|
252
|
|
|
|
|
534
|
return 0; |
601
|
|
|
|
|
|
|
}; |
602
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
sub parseToEndOfLine { |
604
|
34
|
|
|
34
|
0
|
75
|
my ($self, $text) = @_; |
605
|
34
|
|
|
|
|
88
|
return 0; |
606
|
|
|
|
|
|
|
}; |
607
|
|
|
|
|
|
|
|
608
|
|
|
|
|
|
|
sub parseVerb { |
609
|
2
|
|
|
2
|
0
|
6
|
my ($self, $text) = @_; |
610
|
|
|
|
|
|
|
# String => '(.).*\1' |
611
|
|
|
|
|
|
|
# attribute => 'Verbatim' |
612
|
|
|
|
|
|
|
# context => '#pop#pop' |
613
|
|
|
|
|
|
|
# minimal => 'true' |
614
|
|
|
|
|
|
|
# type => 'RegExpr' |
615
|
2
|
50
|
|
|
|
10
|
if ($self->testRegExpr($text, '(.).*?\\1', 0, 0, 0, undef, 0, '#pop#pop', 'Verbatim')) { |
616
|
2
|
|
|
|
|
5
|
return 1 |
617
|
|
|
|
|
|
|
} |
618
|
0
|
|
|
|
|
0
|
return 0; |
619
|
|
|
|
|
|
|
}; |
620
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
sub parseVerbFindEnd { |
622
|
18
|
|
|
18
|
0
|
43
|
my ($self, $text) = @_; |
623
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
624
|
|
|
|
|
|
|
# char => '{' |
625
|
|
|
|
|
|
|
# context => '#stay' |
626
|
|
|
|
|
|
|
# type => 'DetectChar' |
627
|
18
|
100
|
|
|
|
55
|
if ($self->testDetectChar($text, '{', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) { |
628
|
6
|
|
|
|
|
18
|
return 1 |
629
|
|
|
|
|
|
|
} |
630
|
|
|
|
|
|
|
# String => '(semiverbatim|verbatim|lstlisting|boxedverbatim|Verbatim)\*?' |
631
|
|
|
|
|
|
|
# attribute => 'Environment' |
632
|
|
|
|
|
|
|
# context => '#stay' |
633
|
|
|
|
|
|
|
# type => 'RegExpr' |
634
|
12
|
100
|
|
|
|
41
|
if ($self->testRegExpr($text, '(semiverbatim|verbatim|lstlisting|boxedverbatim|Verbatim)\\*?', 0, 0, 0, undef, 0, '#stay', 'Environment')) { |
635
|
6
|
|
|
|
|
21
|
return 1 |
636
|
|
|
|
|
|
|
} |
637
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
638
|
|
|
|
|
|
|
# char => '}' |
639
|
|
|
|
|
|
|
# context => '#pop#pop#pop#pop#pop' |
640
|
|
|
|
|
|
|
# endRegion => 'block' |
641
|
|
|
|
|
|
|
# type => 'DetectChar' |
642
|
6
|
50
|
|
|
|
29
|
if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, '#pop#pop#pop#pop#pop', 'Normal Text')) { |
643
|
6
|
|
|
|
|
16
|
return 1 |
644
|
|
|
|
|
|
|
} |
645
|
0
|
|
|
|
|
0
|
return 0; |
646
|
|
|
|
|
|
|
}; |
647
|
|
|
|
|
|
|
|
648
|
|
|
|
|
|
|
sub parseVerbatim { |
649
|
264
|
|
|
264
|
0
|
433
|
my ($self, $text) = @_; |
650
|
|
|
|
|
|
|
# String => '\\end(?=\{(semiverbatim|verbatim|lstlisting|boxedverbatim|Verbatim)\*?\})' |
651
|
|
|
|
|
|
|
# attribute => 'Structure' |
652
|
|
|
|
|
|
|
# context => 'VerbFindEnd' |
653
|
|
|
|
|
|
|
# type => 'RegExpr' |
654
|
264
|
100
|
|
|
|
633
|
if ($self->testRegExpr($text, '\\\\end(?=\\{(semiverbatim|verbatim|lstlisting|boxedverbatim|Verbatim)\\*?\\})', 0, 0, 0, undef, 0, 'VerbFindEnd', 'Structure')) { |
655
|
6
|
|
|
|
|
18
|
return 1 |
656
|
|
|
|
|
|
|
} |
657
|
258
|
|
|
|
|
513
|
return 0; |
658
|
|
|
|
|
|
|
}; |
659
|
|
|
|
|
|
|
|
660
|
|
|
|
|
|
|
sub parseVerbatimEnv { |
661
|
6
|
|
|
6
|
0
|
16
|
my ($self, $text) = @_; |
662
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
663
|
|
|
|
|
|
|
# char => '*' |
664
|
|
|
|
|
|
|
# context => '#stay' |
665
|
|
|
|
|
|
|
# type => 'DetectChar' |
666
|
6
|
50
|
|
|
|
21
|
if ($self->testDetectChar($text, '*', 0, 0, 0, undef, 0, '#stay', 'Normal Text')) { |
667
|
0
|
|
|
|
|
0
|
return 1 |
668
|
|
|
|
|
|
|
} |
669
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
670
|
|
|
|
|
|
|
# char => '}' |
671
|
|
|
|
|
|
|
# context => 'Verbatim' |
672
|
|
|
|
|
|
|
# type => 'DetectChar' |
673
|
6
|
50
|
|
|
|
24
|
if ($self->testDetectChar($text, '}', 0, 0, 0, undef, 0, 'Verbatim', 'Normal Text')) { |
674
|
6
|
|
|
|
|
18
|
return 1 |
675
|
|
|
|
|
|
|
} |
676
|
|
|
|
|
|
|
# String => '\S' |
677
|
|
|
|
|
|
|
# attribute => 'Normal Text' |
678
|
|
|
|
|
|
|
# context => '#pop' |
679
|
|
|
|
|
|
|
# type => 'RegExpr' |
680
|
0
|
0
|
|
|
|
|
if ($self->testRegExpr($text, '\\S', 0, 0, 0, undef, 0, '#pop', 'Normal Text')) { |
681
|
0
|
|
|
|
|
|
return 1 |
682
|
|
|
|
|
|
|
} |
683
|
0
|
|
|
|
|
|
return 0; |
684
|
|
|
|
|
|
|
}; |
685
|
|
|
|
|
|
|
|
686
|
|
|
|
|
|
|
|
687
|
|
|
|
|
|
|
1; |
688
|
|
|
|
|
|
|
|
689
|
|
|
|
|
|
|
__END__ |