line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Asterisk::config::syntax::highlight; |
2
|
1
|
|
|
1
|
|
26374
|
use strict "vars"; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
3
|
1
|
|
|
1
|
|
1035
|
use Syntax::Highlight::Engine::Simple; |
|
1
|
|
|
|
|
2342
|
|
|
1
|
|
|
|
|
50
|
|
4
|
|
|
|
|
|
|
our $strict; |
5
|
|
|
|
|
|
|
our $VERSION = '0.5'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
839
|
use Class::Std::Utils; |
|
1
|
|
|
|
|
3269
|
|
|
1
|
|
|
|
|
6
|
|
8
|
|
|
|
|
|
|
{ |
9
|
|
|
|
|
|
|
my %global; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
0
|
|
|
0
|
1
|
|
my ($class) = @_; |
13
|
0
|
|
|
|
|
|
my $self = bless \do { my $anon_scalar }, $class; |
|
0
|
|
|
|
|
|
|
14
|
0
|
|
|
|
|
|
return $self; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub load_file { |
18
|
0
|
|
|
0
|
1
|
|
my ( $self, %options ) = @_; |
19
|
0
|
|
0
|
|
|
|
$strict = $options{strict} || 0; |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
my $highlight = Syntax::Highlight::Engine::Simple->new(); |
22
|
0
|
|
|
|
|
|
$highlight->setSyntax( |
23
|
|
|
|
|
|
|
syntax => [ |
24
|
|
|
|
|
|
|
{ |
25
|
|
|
|
|
|
|
class => 'identifier', |
26
|
|
|
|
|
|
|
regexp => "\[(.*)\]", |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
{ |
29
|
|
|
|
|
|
|
class => 'exten', |
30
|
|
|
|
|
|
|
regexp => qr!\\;!, |
31
|
|
|
|
|
|
|
}, |
32
|
|
|
|
|
|
|
{ |
33
|
|
|
|
|
|
|
class => 'value', |
34
|
|
|
|
|
|
|
regexp => "\[{.*}\]", |
35
|
|
|
|
|
|
|
}, |
36
|
|
|
|
|
|
|
{ |
37
|
|
|
|
|
|
|
class => 'comment', |
38
|
|
|
|
|
|
|
regexp => "\;(.*)", |
39
|
|
|
|
|
|
|
}, |
40
|
|
|
|
|
|
|
{ |
41
|
|
|
|
|
|
|
class => 'exten', |
42
|
|
|
|
|
|
|
regexp => q!(\s*)\[(.*)\]!, |
43
|
|
|
|
|
|
|
}, |
44
|
|
|
|
|
|
|
{ |
45
|
|
|
|
|
|
|
class => 'exten', |
46
|
|
|
|
|
|
|
regexp => q!include(\s*)(=|=>)(.*)!, |
47
|
|
|
|
|
|
|
}, |
48
|
|
|
|
|
|
|
{ |
49
|
|
|
|
|
|
|
class => 'exten', |
50
|
|
|
|
|
|
|
regexp => $highlight->array2regexp( exten() ), |
51
|
|
|
|
|
|
|
}, |
52
|
|
|
|
|
|
|
{ |
53
|
|
|
|
|
|
|
class => 'keyword', |
54
|
|
|
|
|
|
|
regexp => $highlight->array2regexp( commands() ), |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
}, |
57
|
|
|
|
|
|
|
{ |
58
|
|
|
|
|
|
|
class => 'function', |
59
|
|
|
|
|
|
|
regexp => $highlight->array2regexp( functions() ), |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
}, |
62
|
|
|
|
|
|
|
] |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
|
65
|
0
|
0
|
|
|
|
|
open my $in, '<', $options{file} or die 'not that file?'; |
66
|
0
|
|
|
|
|
|
my $datas = do { local $/; <$in> }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
close $in; |
68
|
0
|
|
|
|
|
|
$/ = "\n"; |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
my @data = |
71
|
0
|
|
|
|
|
|
map { $highlight->doStr( str => $_ ) } |
72
|
|
|
|
|
|
|
split( /\n/, $datas ); |
73
|
0
|
|
|
|
|
|
$global{ ident $self}{datas} = \@data; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
#only return array references now |
78
|
|
|
|
|
|
|
sub return_html_array_ref { |
79
|
0
|
|
|
0
|
1
|
|
my ( $self, %options ) = @_; |
80
|
0
|
|
|
|
|
|
return $global{ ident $self}{datas}; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub return_ubb_array_ref { |
84
|
0
|
|
|
0
|
1
|
|
my ( $self, %options ) = @_; |
85
|
0
|
|
|
|
|
|
my @data = |
86
|
0
|
|
|
|
|
|
map { $self->_html2ubb($_); } @{ $global{ ident $self}{datas} }; |
|
0
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
return \@data; |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub return_wiki_array_ref { |
92
|
0
|
|
|
0
|
1
|
|
my ( $self, %options ) = @_; |
93
|
0
|
|
|
|
|
|
my @data = |
94
|
0
|
|
|
|
|
|
map { $self->_html2wiki($_); } @{ $global{ ident $self}{datas} }; |
|
0
|
|
|
|
|
|
|
95
|
0
|
|
|
|
|
|
return \@data; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub _html2ubb { |
99
|
0
|
|
|
0
|
|
|
my ( $self, $text ) = @_; |
100
|
0
|
|
|
|
|
|
$text =~ s//[color=blue]/ig; |
101
|
0
|
|
|
|
|
|
$text =~ s//[color=olive]/ig; |
102
|
0
|
|
|
|
|
|
$text =~ s//[color=seagreen]/ig; |
103
|
0
|
|
|
|
|
|
$text =~ s//[color=purple]/ig; |
104
|
0
|
|
|
|
|
|
$text =~ s//[color=magenta]/ig; |
105
|
0
|
|
|
|
|
|
$text =~ s//[color=red]/ig; |
106
|
0
|
|
|
|
|
|
$text =~ s/<\/span>/[\/color]/ig; |
107
|
0
|
|
|
|
|
|
return $text; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub _html2wiki { |
111
|
0
|
|
|
0
|
|
|
my ( $self, $text ) = @_; |
112
|
0
|
|
|
|
|
|
$text =~ s//~~blue:/ig; |
113
|
0
|
|
|
|
|
|
$text =~ s//~~olive:/ig; |
114
|
0
|
|
|
|
|
|
$text =~ s//~~seagreen:/ig; |
115
|
0
|
|
|
|
|
|
$text =~ s//~~purple:/ig; |
116
|
0
|
|
|
|
|
|
$text =~ s//~~magenta:/ig; |
117
|
0
|
|
|
|
|
|
$text =~ s//~~red:/ig; |
118
|
0
|
|
|
|
|
|
$text =~ s/<\/span>/~~/ig; |
119
|
0
|
|
|
|
|
|
$text =~ s/\[/\[\[/ig; |
120
|
0
|
|
|
|
|
|
return $text; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub DESTROY { |
124
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
125
|
0
|
|
|
|
|
|
delete $global{ ident $self}; |
126
|
0
|
|
|
|
|
|
return; |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
sub commands { |
130
|
0
|
|
|
0
|
0
|
|
return qw/ |
131
|
|
|
|
|
|
|
AbsoluteTimeout |
132
|
|
|
|
|
|
|
AddQueueMember |
133
|
|
|
|
|
|
|
ADSIProg |
134
|
|
|
|
|
|
|
AgentCallbackLogin |
135
|
|
|
|
|
|
|
AgentLogin |
136
|
|
|
|
|
|
|
AgentMonitorOutgoing |
137
|
|
|
|
|
|
|
AGI |
138
|
|
|
|
|
|
|
AlarmReceiver |
139
|
|
|
|
|
|
|
ALSAMonitor |
140
|
|
|
|
|
|
|
AMD |
141
|
|
|
|
|
|
|
Answer |
142
|
|
|
|
|
|
|
AppendCDRUserField |
143
|
|
|
|
|
|
|
Authenticate |
144
|
|
|
|
|
|
|
BackGround |
145
|
|
|
|
|
|
|
BackgroundDetect |
146
|
|
|
|
|
|
|
Bridge |
147
|
|
|
|
|
|
|
Busy |
148
|
|
|
|
|
|
|
CallingPres |
149
|
|
|
|
|
|
|
ChangeMonitor |
150
|
|
|
|
|
|
|
ChanIsAvail |
151
|
|
|
|
|
|
|
ChannelRedirect |
152
|
|
|
|
|
|
|
ChanSpy |
153
|
|
|
|
|
|
|
CheckGroup |
154
|
|
|
|
|
|
|
ClearHash |
155
|
|
|
|
|
|
|
Congestion |
156
|
|
|
|
|
|
|
ContinueWhile |
157
|
|
|
|
|
|
|
ControlPlayback |
158
|
|
|
|
|
|
|
DAHDIBarge |
159
|
|
|
|
|
|
|
DAHDIRAS |
160
|
|
|
|
|
|
|
DAHDIScan |
161
|
|
|
|
|
|
|
DAHDISendKeypadFacility |
162
|
|
|
|
|
|
|
DBdel |
163
|
|
|
|
|
|
|
DBdeltree |
164
|
|
|
|
|
|
|
DBQuery |
165
|
|
|
|
|
|
|
DBRewrite |
166
|
|
|
|
|
|
|
DeadAGI |
167
|
|
|
|
|
|
|
Dial |
168
|
|
|
|
|
|
|
Dictate |
169
|
|
|
|
|
|
|
DigitTimeout |
170
|
|
|
|
|
|
|
Directory |
171
|
|
|
|
|
|
|
DISA |
172
|
|
|
|
|
|
|
DTMFToText |
173
|
|
|
|
|
|
|
DUNDiLookup |
174
|
|
|
|
|
|
|
EAGI |
175
|
|
|
|
|
|
|
Echo |
176
|
|
|
|
|
|
|
EndWhile |
177
|
|
|
|
|
|
|
EnumLookup |
178
|
|
|
|
|
|
|
Exec |
179
|
|
|
|
|
|
|
ExecIf |
180
|
|
|
|
|
|
|
ExecIfTime |
181
|
|
|
|
|
|
|
ExitWhile |
182
|
|
|
|
|
|
|
ExtenSpy |
183
|
|
|
|
|
|
|
ExternIVR |
184
|
|
|
|
|
|
|
Festival |
185
|
|
|
|
|
|
|
Flash |
186
|
|
|
|
|
|
|
Flite |
187
|
|
|
|
|
|
|
ForkCDR |
188
|
|
|
|
|
|
|
GetCPEID |
189
|
|
|
|
|
|
|
GetGroupCount |
190
|
|
|
|
|
|
|
GetGroupMatchCount |
191
|
|
|
|
|
|
|
Gosub |
192
|
|
|
|
|
|
|
GosubIf |
193
|
|
|
|
|
|
|
Goto |
194
|
|
|
|
|
|
|
GotoIf |
195
|
|
|
|
|
|
|
GotoIfTime |
196
|
|
|
|
|
|
|
Hangup |
197
|
|
|
|
|
|
|
HasNewVoicemail |
198
|
|
|
|
|
|
|
HasVoicemail |
199
|
|
|
|
|
|
|
ICES |
200
|
|
|
|
|
|
|
ImportVar |
201
|
|
|
|
|
|
|
JabberSend |
202
|
|
|
|
|
|
|
JabberStatus |
203
|
|
|
|
|
|
|
KeepAlive |
204
|
|
|
|
|
|
|
Log |
205
|
|
|
|
|
|
|
LookupBlacklist |
206
|
|
|
|
|
|
|
LookupCIDName |
207
|
|
|
|
|
|
|
Macro |
208
|
|
|
|
|
|
|
MacroExclusive |
209
|
|
|
|
|
|
|
MacroExit |
210
|
|
|
|
|
|
|
MailboxExists |
211
|
|
|
|
|
|
|
MeetMe |
212
|
|
|
|
|
|
|
MeetMeAdmin |
213
|
|
|
|
|
|
|
MeetMeChannelAdmin |
214
|
|
|
|
|
|
|
MeetMeCount |
215
|
|
|
|
|
|
|
Milliwatt |
216
|
|
|
|
|
|
|
MiniVM |
217
|
|
|
|
|
|
|
MixMonitor |
218
|
|
|
|
|
|
|
Monitor |
219
|
|
|
|
|
|
|
MP3Player |
220
|
|
|
|
|
|
|
MSet |
221
|
|
|
|
|
|
|
MusicOnHold |
222
|
|
|
|
|
|
|
MYSQL |
223
|
|
|
|
|
|
|
Asterisk cmg NBScat |
224
|
|
|
|
|
|
|
NoCDR |
225
|
|
|
|
|
|
|
NoOp |
226
|
|
|
|
|
|
|
ODBCFinish |
227
|
|
|
|
|
|
|
Page |
228
|
|
|
|
|
|
|
Park |
229
|
|
|
|
|
|
|
ParkAndAnnounce |
230
|
|
|
|
|
|
|
ParkedCall |
231
|
|
|
|
|
|
|
PauseQueueMember |
232
|
|
|
|
|
|
|
Perl |
233
|
|
|
|
|
|
|
Pickup |
234
|
|
|
|
|
|
|
PickUP |
235
|
|
|
|
|
|
|
PickupChan |
236
|
|
|
|
|
|
|
Playback |
237
|
|
|
|
|
|
|
Playtones |
238
|
|
|
|
|
|
|
PPPD |
239
|
|
|
|
|
|
|
PrivacyManager |
240
|
|
|
|
|
|
|
Proceeding |
241
|
|
|
|
|
|
|
Progress |
242
|
|
|
|
|
|
|
Queue |
243
|
|
|
|
|
|
|
Random |
244
|
|
|
|
|
|
|
Read |
245
|
|
|
|
|
|
|
ReadExten |
246
|
|
|
|
|
|
|
ReadFile |
247
|
|
|
|
|
|
|
RealTime |
248
|
|
|
|
|
|
|
Record |
249
|
|
|
|
|
|
|
RemoveQueueMember |
250
|
|
|
|
|
|
|
ResetCDR |
251
|
|
|
|
|
|
|
ResponseTimeout |
252
|
|
|
|
|
|
|
RetryDial |
253
|
|
|
|
|
|
|
Return |
254
|
|
|
|
|
|
|
Ringing |
255
|
|
|
|
|
|
|
Rpt |
256
|
|
|
|
|
|
|
SayAlpha |
257
|
|
|
|
|
|
|
SayDigits |
258
|
|
|
|
|
|
|
SayNumber |
259
|
|
|
|
|
|
|
SayPhonetic |
260
|
|
|
|
|
|
|
SayUnixTime |
261
|
|
|
|
|
|
|
SendDTMF |
262
|
|
|
|
|
|
|
SendImage |
263
|
|
|
|
|
|
|
SendText |
264
|
|
|
|
|
|
|
SendURL |
265
|
|
|
|
|
|
|
Set |
266
|
|
|
|
|
|
|
SetAccount |
267
|
|
|
|
|
|
|
SetAMAflags |
268
|
|
|
|
|
|
|
SetCallerID |
269
|
|
|
|
|
|
|
SetCallerPres |
270
|
|
|
|
|
|
|
SetCDRUserField |
271
|
|
|
|
|
|
|
SetGlobalVar |
272
|
|
|
|
|
|
|
SetMusicOnHold |
273
|
|
|
|
|
|
|
SIPAddHeader |
274
|
|
|
|
|
|
|
SIPCallPickup |
275
|
|
|
|
|
|
|
SIPGetHeader |
276
|
|
|
|
|
|
|
SIPdtmfMode |
277
|
|
|
|
|
|
|
SMS |
278
|
|
|
|
|
|
|
SoftHangup |
279
|
|
|
|
|
|
|
SrxEchoCan |
280
|
|
|
|
|
|
|
SrxDeflect |
281
|
|
|
|
|
|
|
SrxMWI |
282
|
|
|
|
|
|
|
StackPop |
283
|
|
|
|
|
|
|
Steal |
284
|
|
|
|
|
|
|
StopMonitor |
285
|
|
|
|
|
|
|
StopMixMonitor |
286
|
|
|
|
|
|
|
StopPlaytones |
287
|
|
|
|
|
|
|
System |
288
|
|
|
|
|
|
|
TestClient |
289
|
|
|
|
|
|
|
TestServer |
290
|
|
|
|
|
|
|
Transfer |
291
|
|
|
|
|
|
|
TrySystem |
292
|
|
|
|
|
|
|
TXTCIDName |
293
|
|
|
|
|
|
|
UnpauseQueueMember |
294
|
|
|
|
|
|
|
UserEvent |
295
|
|
|
|
|
|
|
VMAuthenticate |
296
|
|
|
|
|
|
|
VoiceMail |
297
|
|
|
|
|
|
|
VoiceMailMain |
298
|
|
|
|
|
|
|
Wait |
299
|
|
|
|
|
|
|
WaitExten |
300
|
|
|
|
|
|
|
WaitForRing |
301
|
|
|
|
|
|
|
WaitMusicOnHold |
302
|
|
|
|
|
|
|
WaitUntil |
303
|
|
|
|
|
|
|
While |
304
|
|
|
|
|
|
|
Zapateller |
305
|
|
|
|
|
|
|
/; |
306
|
|
|
|
|
|
|
} |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
sub functions { |
309
|
0
|
|
|
0
|
0
|
|
return qw/ |
310
|
|
|
|
|
|
|
AGENT |
311
|
|
|
|
|
|
|
ARRAY |
312
|
|
|
|
|
|
|
BASE64_DECODE |
313
|
|
|
|
|
|
|
BASE64_ENCODE |
314
|
|
|
|
|
|
|
CALLERID |
315
|
|
|
|
|
|
|
CDR |
316
|
|
|
|
|
|
|
CHANNEL |
317
|
|
|
|
|
|
|
CHECKSIPDOMAIN |
318
|
|
|
|
|
|
|
CHECK_MD5 |
319
|
|
|
|
|
|
|
clearhash |
320
|
|
|
|
|
|
|
CURL |
321
|
|
|
|
|
|
|
CUT |
322
|
|
|
|
|
|
|
device_State |
323
|
|
|
|
|
|
|
DB |
324
|
|
|
|
|
|
|
DB_DELETE |
325
|
|
|
|
|
|
|
DB_EXISTS |
326
|
|
|
|
|
|
|
DIALGROUP |
327
|
|
|
|
|
|
|
dialplan_exists |
328
|
|
|
|
|
|
|
DUNDILOOKUP |
329
|
|
|
|
|
|
|
ENUMLOOKUP |
330
|
|
|
|
|
|
|
ENV |
331
|
|
|
|
|
|
|
EVAL |
332
|
|
|
|
|
|
|
EXISTS |
333
|
|
|
|
|
|
|
extension_state |
334
|
|
|
|
|
|
|
FIELDQTY |
335
|
|
|
|
|
|
|
FILTER |
336
|
|
|
|
|
|
|
GROUP |
337
|
|
|
|
|
|
|
GROUP_COUNT |
338
|
|
|
|
|
|
|
GROUP_LIST |
339
|
|
|
|
|
|
|
GROUP_MATCH_COUNT |
340
|
|
|
|
|
|
|
HASH |
341
|
|
|
|
|
|
|
hashkeys |
342
|
|
|
|
|
|
|
hint |
343
|
|
|
|
|
|
|
IAXPEER |
344
|
|
|
|
|
|
|
iaxvar |
345
|
|
|
|
|
|
|
IF |
346
|
|
|
|
|
|
|
IFTIME |
347
|
|
|
|
|
|
|
ISNULL |
348
|
|
|
|
|
|
|
KEYPADHASH |
349
|
|
|
|
|
|
|
LANGUAGE |
350
|
|
|
|
|
|
|
LEN |
351
|
|
|
|
|
|
|
MATH |
352
|
|
|
|
|
|
|
MD5 |
353
|
|
|
|
|
|
|
MUSICCLASS |
354
|
|
|
|
|
|
|
ODBC |
355
|
|
|
|
|
|
|
QUEUEAGENTCOUNT |
356
|
|
|
|
|
|
|
QUEUE_MEMBER_COUNT |
357
|
|
|
|
|
|
|
QUEUE_MEMBER_LIST |
358
|
|
|
|
|
|
|
QUOTE |
359
|
|
|
|
|
|
|
RAND |
360
|
|
|
|
|
|
|
REALTIME |
361
|
|
|
|
|
|
|
REGEX |
362
|
|
|
|
|
|
|
SET |
363
|
|
|
|
|
|
|
SHA1 |
364
|
|
|
|
|
|
|
SHARED |
365
|
|
|
|
|
|
|
SIPCHANINFO |
366
|
|
|
|
|
|
|
SIPPEER |
367
|
|
|
|
|
|
|
SIPAddHeader |
368
|
|
|
|
|
|
|
SIP_HEADER |
369
|
|
|
|
|
|
|
SORT |
370
|
|
|
|
|
|
|
SQL_ESC |
371
|
|
|
|
|
|
|
STAT |
372
|
|
|
|
|
|
|
STRFTIME |
373
|
|
|
|
|
|
|
STRPTIME |
374
|
|
|
|
|
|
|
sysinfo |
375
|
|
|
|
|
|
|
TIMEOUT |
376
|
|
|
|
|
|
|
toupper |
377
|
|
|
|
|
|
|
tolower |
378
|
|
|
|
|
|
|
TXTCIDNAME |
379
|
|
|
|
|
|
|
URIDECODE |
380
|
|
|
|
|
|
|
URIENCODE |
381
|
|
|
|
|
|
|
VOLUME |
382
|
|
|
|
|
|
|
VMCOUNT |
383
|
|
|
|
|
|
|
/; |
384
|
|
|
|
|
|
|
} |
385
|
|
|
|
|
|
|
|
386
|
|
|
|
|
|
|
sub exten { |
387
|
0
|
|
|
0
|
0
|
|
return qw/ |
388
|
|
|
|
|
|
|
exten |
389
|
|
|
|
|
|
|
/; |
390
|
|
|
|
|
|
|
} |
391
|
|
|
|
|
|
|
|
392
|
1
|
|
|
1
|
|
1114
|
no warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
299
|
|
393
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
#reload |
395
|
|
|
|
|
|
|
sub Syntax::Highlight::Engine::Simple::_make_map { |
396
|
|
|
|
|
|
|
|
397
|
0
|
|
|
0
|
|
|
my $self = shift; |
398
|
0
|
|
|
|
|
|
my %args = ( str => '', pos => 0, index => undef, @_ ); |
399
|
|
|
|
|
|
|
|
400
|
0
|
|
|
|
|
|
my $map_ref = $self->{_markup_map}; |
401
|
0
|
|
|
|
|
|
my @scraps; |
402
|
0
|
0
|
|
|
|
|
if ($strict) { |
403
|
0
|
|
|
|
|
|
@scraps = |
404
|
|
|
|
|
|
|
split( /$self->{syntax}->[$args{index}]->{regexp}/, |
405
|
|
|
|
|
|
|
$args{str}, 2 ); |
406
|
|
|
|
|
|
|
} |
407
|
|
|
|
|
|
|
else { |
408
|
0
|
|
|
|
|
|
@scraps = |
409
|
|
|
|
|
|
|
split( /$self->{syntax}->[$args{index}]->{regexp}/i, |
410
|
|
|
|
|
|
|
$args{str}, 2 ); |
411
|
|
|
|
|
|
|
} |
412
|
|
|
|
|
|
|
|
413
|
0
|
0
|
|
|
|
|
if ( ( scalar @scraps ) >= 2 ) { |
|
|
0
|
|
|
|
|
|
414
|
|
|
|
|
|
|
|
415
|
0
|
|
|
|
|
|
my $rest = pop(@scraps); |
416
|
0
|
|
|
|
|
|
my $ins_pos0 = $args{pos} + length( $scraps[0] ); |
417
|
0
|
|
|
|
|
|
my $ins_pos1 = |
418
|
|
|
|
|
|
|
$args{pos} + ( length( $args{str} ) - length($rest) ); |
419
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
### Add markup position |
421
|
0
|
|
|
|
|
|
push( @$map_ref, [ $ins_pos0, $ins_pos1, $args{index}, ] ); |
422
|
|
|
|
|
|
|
|
423
|
|
|
|
|
|
|
### Recurseion for rest |
424
|
0
|
|
|
|
|
|
$self->_make_map( %args, str => $rest, pos => $ins_pos1 ); |
425
|
|
|
|
|
|
|
} |
426
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
### Follow up process |
428
|
|
|
|
|
|
|
elsif (@$map_ref) { |
429
|
|
|
|
|
|
|
|
430
|
0
|
0
|
0
|
|
|
|
@$map_ref = |
431
|
|
|
|
|
|
|
sort { |
432
|
0
|
|
|
|
|
|
$$a[0] <=> $$b[0] |
433
|
|
|
|
|
|
|
or $$b[1] <=> $$a[1] |
434
|
|
|
|
|
|
|
or $$a[2] <=> $$b[2] |
435
|
|
|
|
|
|
|
} @$map_ref; |
436
|
|
|
|
|
|
|
} |
437
|
|
|
|
|
|
|
|
438
|
0
|
|
|
|
|
|
return; |
439
|
|
|
|
|
|
|
} |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
} |
442
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
1; |
444
|
|
|
|
|
|
|
|
445
|
|
|
|
|
|
|
__END__ |