line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Regexp::SAR; |
2
|
|
|
|
|
|
|
# ABSTRACT: Regexp::SAR - perl module implementing regular expression engine for handling matching events (Simple API for Regexp) |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
30479
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
87
|
|
8
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
710
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
require XSLoader; |
12
|
|
|
|
|
|
|
XSLoader::load( 'Regexp::SAR' ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub new { |
16
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
my $obj = []; |
19
|
0
|
|
|
|
|
|
my $rootNode = Regexp::SAR::buildRootNode(); |
20
|
0
|
|
|
|
|
|
return bless \$rootNode, $class; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub addRegexp { |
24
|
0
|
|
|
0
|
1
|
|
my ( $rootRef, $regexpStr, $handler ) = @_; |
25
|
0
|
|
|
|
|
|
my $reLength = length $regexpStr; |
26
|
0
|
0
|
|
|
|
|
unless ($reLength) { |
27
|
0
|
|
|
|
|
|
return; |
28
|
|
|
|
|
|
|
} |
29
|
0
|
|
|
|
|
|
Regexp::SAR::buildPath( $$rootRef, $regexpStr, $reLength, $handler ); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub match { |
33
|
0
|
|
|
0
|
1
|
|
my ( $rootRef, $matchStr ) = @_; |
34
|
0
|
0
|
|
|
|
|
if (ref $matchStr) { |
35
|
0
|
|
|
|
|
|
Regexp::SAR::lookPathRef( $$rootRef, $matchStr, 0 ); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
else { |
38
|
0
|
|
|
|
|
|
Regexp::SAR::lookPath( $$rootRef, $matchStr, 0 ); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub matchRef { |
43
|
0
|
|
|
0
|
0
|
|
my ( $rootRef, $matchStr ) = @_; |
44
|
0
|
|
|
|
|
|
Regexp::SAR::lookPathRef( $$rootRef, $matchStr, 0 ); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub matchFrom { |
48
|
0
|
|
|
0
|
1
|
|
my ( $rootRef, $matchStr, $pos ) = @_; |
49
|
0
|
0
|
|
|
|
|
if (ref $matchStr) { |
50
|
0
|
|
|
|
|
|
Regexp::SAR::lookPathRef( $$rootRef, $matchStr, $pos ); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
else { |
53
|
0
|
|
|
|
|
|
Regexp::SAR::lookPath( $$rootRef, $matchStr, $pos ); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub matchAt { |
58
|
0
|
|
|
0
|
1
|
|
my ( $rootRef, $matchStr, $pos ) = @_; |
59
|
0
|
|
|
|
|
|
Regexp::SAR::lookPathAtPos( $$rootRef, $matchStr, $pos ); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub stopMatch { |
63
|
0
|
|
|
0
|
1
|
|
my ( $rootRef ) = @_; |
64
|
0
|
|
|
|
|
|
Regexp::SAR::stop($$rootRef); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub continueFrom { |
68
|
0
|
|
|
0
|
1
|
|
my ( $rootRef, $from ) = @_; |
69
|
0
|
|
|
|
|
|
Regexp::SAR::continue($$rootRef, $from); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub DESTROY { |
73
|
0
|
|
|
0
|
|
|
my ( $rootRef ) = @_; |
74
|
0
|
|
|
|
|
|
Regexp::SAR::cleanAll($$rootRef); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |