line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSON::Parser::Regexp; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
77686
|
use utf8; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
6
|
|
4
|
1
|
|
|
1
|
|
1427
|
use Regexp::Grammars; |
|
1
|
|
|
|
|
28676
|
|
|
1
|
|
|
|
|
12
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.10'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
1
|
|
|
1
|
0
|
102
|
my $class = shift; |
10
|
1
|
|
|
|
|
5
|
return bless {}, $class; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub T::JSON::X { |
14
|
1
|
|
|
1
|
|
3
|
my ($self) = @_; |
15
|
1
|
|
|
|
|
7
|
return $self->{Hash}->X(); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub T::Hash::X { |
19
|
2
|
|
|
2
|
|
5
|
my ($self) = @_; |
20
|
2
|
|
|
|
|
8
|
my %hash = $self->{Key_Values}->X(); |
21
|
2
|
|
|
|
|
15
|
return \%hash; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub T::Key_Values::X { |
25
|
2
|
|
|
2
|
|
4
|
my ($self) = @_; |
26
|
2
|
|
|
|
|
4
|
my @kvs = (); |
27
|
2
|
|
|
|
|
3
|
for my $element ( @{ $self->{Key_Value} } ) { |
|
2
|
|
|
|
|
8
|
|
28
|
6
|
|
|
|
|
18
|
push @kvs, $element->X(); |
29
|
|
|
|
|
|
|
} |
30
|
2
|
|
|
|
|
15
|
return @kvs; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub T::Key_Value::X { |
34
|
6
|
|
|
6
|
|
11
|
my ($self) = @_; |
35
|
6
|
|
|
|
|
14
|
my $key = $self->{Key}->X(); |
36
|
6
|
|
|
|
|
14
|
my $sep = $self->{Sep}->X(); |
37
|
6
|
|
|
|
|
15
|
my $value = $self->{Value}->X(); |
38
|
|
|
|
|
|
|
|
39
|
6
|
50
|
|
|
|
15
|
if ( $sep eq ':' ) { |
40
|
6
|
|
|
|
|
12
|
my @kv = ( $key, $value ); |
41
|
6
|
|
|
|
|
22
|
return @kv; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub T::Key::X { |
46
|
6
|
|
|
6
|
|
9
|
my ($self) = @_; |
47
|
6
|
|
|
|
|
14
|
return $self->{Any_Value}->X(); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub T::Value::X { |
51
|
6
|
|
|
6
|
|
9
|
my ($self) = @_; |
52
|
6
|
|
|
|
|
12
|
return $self->{Any_Value}->X(); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub T::Any_Value::X { |
56
|
21
|
|
|
21
|
|
36
|
my ($self) = @_; |
57
|
|
|
|
|
|
|
( $self->{String_Value} |
58
|
|
|
|
|
|
|
|| $self->{Numeric_Value} |
59
|
|
|
|
|
|
|
|| $self->{Null_Value} |
60
|
|
|
|
|
|
|
|| $self->{Hash} |
61
|
|
|
|
|
|
|
|| $self->{Array} |
62
|
|
|
|
|
|
|
|| $self->{True} |
63
|
21
|
|
0
|
|
|
98
|
|| $self->{False} )->X(); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub T::String_Value::X { |
67
|
5
|
|
|
5
|
|
8
|
my ($self) = @_; |
68
|
5
|
|
|
|
|
11
|
return $self->{Words}->X(); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub T::Words::X { |
72
|
5
|
|
|
5
|
|
8
|
my ($self) = @_; |
73
|
5
|
|
|
|
|
13
|
return $self->{''}; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub T::Numeric_Value::X { |
77
|
12
|
|
|
12
|
|
17
|
my ($self) = @_; |
78
|
12
|
|
|
|
|
25
|
return $self->{Number}->X(); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub T::Number::X { |
82
|
12
|
|
|
12
|
|
18
|
my ($self) = @_; |
83
|
12
|
|
|
|
|
34
|
return $self->{''}; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub T::Null_Value::X { |
87
|
0
|
|
|
0
|
|
0
|
my ($self) = @_; |
88
|
0
|
0
|
|
|
|
0
|
if ( $self->{''} eq 'null' ) { |
89
|
0
|
|
|
|
|
0
|
return undef; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub T::True::X { |
94
|
0
|
|
|
0
|
|
0
|
my ($self) = @_; |
95
|
0
|
0
|
|
|
|
0
|
if ( $self->{''} eq 'true' ) { |
96
|
0
|
|
|
|
|
0
|
return 1; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub T::False::X { |
101
|
0
|
|
|
0
|
|
0
|
my ($self) = @_; |
102
|
0
|
0
|
|
|
|
0
|
if ( $self->{''} eq 'false' ) { |
103
|
0
|
|
|
|
|
0
|
return 0; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub T::Array::X { |
108
|
3
|
|
|
3
|
|
6
|
my ($self) = @_; |
109
|
3
|
|
|
|
|
6
|
return $self->{Array_Elements}->X(); |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub T::Array_Elements::X { |
113
|
3
|
|
|
3
|
|
6
|
my ($self) = @_; |
114
|
3
|
|
|
|
|
6
|
my @array = (); |
115
|
3
|
|
|
|
|
4
|
for my $element ( @{ $self->{Array_Element} } ) { |
|
3
|
|
|
|
|
6
|
|
116
|
9
|
|
|
|
|
16
|
push @array, $element->X(); |
117
|
|
|
|
|
|
|
} |
118
|
3
|
|
|
|
|
8
|
return \@array; |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
sub T::Array_Element::X { |
122
|
9
|
|
|
9
|
|
14
|
my ($self) = @_; |
123
|
9
|
|
|
|
|
18
|
return $self->{Any_Value}->X(); |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub T::Sep::X { |
127
|
6
|
|
|
6
|
|
10
|
my ($self) = @_; |
128
|
6
|
|
|
|
|
12
|
return $self->{''}; |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
sub T::Comma::X { |
132
|
0
|
|
|
0
|
|
0
|
my ($self) = @_; |
133
|
0
|
|
|
|
|
0
|
return $self->{''}; |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
my $Parser = qr { |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
| | | | | | |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
\{ \} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
<[Key_Value]>+ % |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
\[ \] |
152
|
|
|
|
|
|
|
<[Array_Element]>+ % |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
\s*\"\s*\s*\"\s* |
156
|
|
|
|
|
|
|
(.)*? |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
\s*\s* |
159
|
|
|
|
|
|
|
[-]?[\d\.]* |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
null |
162
|
|
|
|
|
|
|
true |
163
|
|
|
|
|
|
|
false |
164
|
|
|
|
|
|
|
\: |
165
|
|
|
|
|
|
|
\, |
166
|
|
|
|
|
|
|
}xms; |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
sub Json_Parse { |
169
|
1
|
|
|
1
|
0
|
8
|
my ( $self, $String ) = @_; |
170
|
1
|
50
|
|
|
|
35
|
if ( $String =~ $Parser ) { |
171
|
1
|
|
|
|
|
51
|
$/{JSON}->X(); |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
} |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
1; |
176
|
|
|
|
|
|
|
__END__ |