line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JSON::Parser::Regexp; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
77460
|
use Mouse; |
|
1
|
|
|
|
|
31243
|
|
|
1
|
|
|
|
|
6
|
|
4
|
1
|
|
|
1
|
|
516
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
5
|
1
|
|
|
1
|
|
886
|
use Kavorka; |
|
1
|
|
|
|
|
16497
|
|
|
1
|
|
|
|
|
12
|
|
6
|
1
|
|
|
1
|
|
205469
|
use Regexp::Grammars; |
|
1
|
|
|
|
|
21356
|
|
|
1
|
|
|
|
|
11
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
50
|
|
1
|
|
2026
|
method AST::JSON::X() { |
|
1
|
50
|
|
1
|
|
2
|
|
|
1
|
|
|
|
|
129
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
4
|
|
12
|
1
|
|
|
|
|
5
|
return $self->{Hash}->X(); |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
1
|
50
|
|
1
|
|
1141
|
method AST::Hash::X() { |
|
1
|
50
|
|
2
|
|
3
|
|
|
1
|
|
|
|
|
119
|
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
3
|
|
16
|
2
|
|
|
|
|
10
|
my %hash = $self->{Key_Values}->X(); |
17
|
2
|
|
|
|
|
16
|
return \%hash; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
1
|
50
|
|
1
|
|
1320
|
method AST::Key_Values::X() { |
|
1
|
50
|
|
2
|
|
3
|
|
|
1
|
|
|
|
|
165
|
|
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
3
|
|
21
|
2
|
|
|
|
|
4
|
my @kvs = (); |
22
|
2
|
|
|
|
|
4
|
for my $element ( @{ $self->{Key_Value} } ) { |
|
2
|
|
|
|
|
8
|
|
23
|
6
|
|
|
|
|
13
|
push @kvs, $element->X(); |
24
|
|
|
|
|
|
|
} |
25
|
2
|
|
|
|
|
15
|
return @kvs; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
1
|
50
|
|
1
|
|
1208
|
method AST::Key_Value::X() { |
|
1
|
50
|
|
6
|
|
2
|
|
|
1
|
|
|
|
|
165
|
|
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
9
|
|
29
|
6
|
|
|
|
|
14
|
my $key = $self->{Key}->X(); |
30
|
6
|
|
|
|
|
15
|
my $sep = $self->{Sep}->X(); |
31
|
6
|
|
|
|
|
16
|
my $value = $self->{Value}->X(); |
32
|
|
|
|
|
|
|
|
33
|
6
|
50
|
|
|
|
18
|
if( $sep eq ':' ) { |
34
|
6
|
|
|
|
|
14
|
my @kv = ($key, $value); |
35
|
6
|
|
|
|
|
20
|
return @kv; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
1
|
50
|
|
1
|
|
1149
|
method AST::Key::X() { |
|
1
|
50
|
|
6
|
|
2
|
|
|
1
|
|
|
|
|
133
|
|
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
9
|
|
40
|
6
|
|
|
|
|
13
|
return $self->{Any_Value}->X(); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
1
|
50
|
|
1
|
|
1258
|
method AST::Value::X() { |
|
1
|
50
|
|
6
|
|
3
|
|
|
1
|
|
|
|
|
112
|
|
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
8
|
|
44
|
6
|
|
|
|
|
12
|
return $self->{Any_Value}->X(); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
1
|
50
|
|
1
|
|
1215
|
method AST::Any_Value::X() { |
|
1
|
50
|
|
21
|
|
2
|
|
|
1
|
|
|
|
|
137
|
|
|
21
|
|
|
|
|
34
|
|
|
21
|
|
|
|
|
40
|
|
|
21
|
|
|
|
|
41
|
|
48
|
21
|
|
66
|
|
|
131
|
($self->{String_Value} || $self->{Numeric_Value} || $self->{Null_Value} || $self->{Hash} || $self->{Array})->X(); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
1
|
50
|
|
1
|
|
1606
|
method AST::String_Value::X() { |
|
1
|
50
|
|
5
|
|
4
|
|
|
1
|
|
|
|
|
123
|
|
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
6
|
|
52
|
5
|
|
|
|
|
13
|
return $self->{Words}->X(); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
1
|
50
|
|
1
|
|
1195
|
method AST::Words::X() { |
|
1
|
50
|
|
5
|
|
2
|
|
|
1
|
|
|
|
|
121
|
|
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
6
|
|
56
|
5
|
|
|
|
|
12
|
return $self->{''}; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
1
|
50
|
|
1
|
|
1240
|
method AST::Numeric_Value::X() { |
|
1
|
50
|
|
12
|
|
3
|
|
|
1
|
|
|
|
|
113
|
|
|
12
|
|
|
|
|
23
|
|
|
12
|
|
|
|
|
23
|
|
|
12
|
|
|
|
|
15
|
|
60
|
12
|
|
|
|
|
25
|
return $self->{Number}->X(); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
1
|
50
|
|
1
|
|
1157
|
method AST::Number::X() { |
|
1
|
50
|
|
12
|
|
2
|
|
|
1
|
|
|
|
|
109
|
|
|
12
|
|
|
|
|
20
|
|
|
12
|
|
|
|
|
22
|
|
|
12
|
|
|
|
|
13
|
|
64
|
12
|
|
|
|
|
35
|
return $self->{''}; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
1
|
0
|
|
1
|
|
1278
|
method AST::Null_Value::X() { |
|
1
|
0
|
|
0
|
|
2
|
|
|
1
|
|
|
|
|
110
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
68
|
0
|
|
|
|
|
0
|
return $self->{''}; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
1
|
50
|
|
1
|
|
1163
|
method AST::Array::X() { |
|
1
|
50
|
|
3
|
|
3
|
|
|
1
|
|
|
|
|
119
|
|
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
4
|
|
72
|
3
|
|
|
|
|
10
|
return $self->{Array_Elements}->X(); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
1
|
50
|
|
1
|
|
1218
|
method AST::Array_Elements::X() { |
|
1
|
50
|
|
3
|
|
3
|
|
|
1
|
|
|
|
|
213
|
|
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
5
|
|
76
|
3
|
|
|
|
|
5
|
my @array = (); |
77
|
3
|
|
|
|
|
5
|
for my $element ( @{ $self->{Array_Element} } ) { |
|
3
|
|
|
|
|
7
|
|
78
|
9
|
|
|
|
|
18
|
push @array, $element->X(); |
79
|
|
|
|
|
|
|
} |
80
|
3
|
|
|
|
|
8
|
return \@array; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
1
|
50
|
|
1
|
|
1287
|
method AST::Array_Element::X() { |
|
1
|
50
|
|
9
|
|
2
|
|
|
1
|
|
|
|
|
116
|
|
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
10
|
|
84
|
9
|
|
|
|
|
22
|
return $self->{Any_Value}->X(); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
1
|
50
|
|
1
|
|
1163
|
method AST::Sep::X() { |
|
1
|
50
|
|
6
|
|
2
|
|
|
1
|
|
|
|
|
113
|
|
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
6
|
|
88
|
6
|
|
|
|
|
13
|
return $self->{''}; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
1
|
0
|
|
1
|
|
1121
|
method AST::Comma::X() { |
|
1
|
0
|
|
0
|
|
2
|
|
|
1
|
|
|
|
|
156
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
92
|
0
|
|
|
|
|
0
|
return $self->{''}; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
my $Parser = qr { |
97
|
|
|
|
|
|
|
<nocontext:> |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
<JSON> |
100
|
|
|
|
|
|
|
<objrule: AST::JSON> <ws: (\s++)*> <Hash> |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
<objrule: AST::Any_Value> <String_Value> | <Numeric_Value> | <Null_Value> | <Hash> | <Array> |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
<objrule: AST::Hash> \{ <Key_Values> \} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
<objrule: AST::Key_Values> <[Key_Value]>+ % <Comma> |
107
|
|
|
|
|
|
|
<objrule: AST::Key_Value> <Key> <Sep> <Value> |
108
|
|
|
|
|
|
|
<objrule: AST::Key> <Any_Value> |
109
|
|
|
|
|
|
|
<objrule: AST::Value> <Any_Value> |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
<objrule: AST::Array> \[ <Array_Elements> \] |
112
|
|
|
|
|
|
|
<objrule: AST::Array_Elements> <[Array_Element]>+ % <Comma> |
113
|
|
|
|
|
|
|
<objrule: AST::Array_Element> <Any_Value> |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
<objtoken: AST::String_Value> \s*\"\s*<Words>\s*\"\s* |
116
|
|
|
|
|
|
|
<objtoken: AST::Words> (.)*? |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
<objtoken: AST::Numeric_Value> \s*<Number>\s* |
119
|
|
|
|
|
|
|
<objtoken: AST::Number> [-]?[\d\.]* |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
<objtoken: Null_Value> null |
122
|
|
|
|
|
|
|
<objtoken: AST::Sep> \: |
123
|
|
|
|
|
|
|
<objtoken: AST::Comma> \, |
124
|
|
|
|
|
|
|
}xms; |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
127
|
1
|
50
|
|
1
|
|
2536
|
method Json_Parse( $String ) { |
|
1
|
50
|
|
1
|
|
3
|
|
|
1
|
50
|
|
|
|
284
|
|
|
1
|
|
|
|
|
211
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
4
|
|
128
|
1
|
50
|
|
|
|
36
|
if( $String =~ $Parser ) { |
129
|
1
|
|
|
|
|
9
|
$/{JSON}->X(); |
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
1; |
136
|
|
|
|
|
|
|
__END__ |
137
|
|
|
|
|
|
|
=encoding utf-8 |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 NAME |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
JSON::Parser::Regexp - Json parser |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 SYNOPSIS |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
use utf8; |
146
|
|
|
|
|
|
|
use JSON::Parser::Regexp; |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
my $json = Json::Parser::Regexp->new(); |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
my $hash = $json->Json_Parse('{"foo" : [-1.2, -2, 3, 4, ౮], "buz": "a string ఈ వారపు వ్యాసం with spaces", "more": {3 : [8, 9]} , 1 : 41, "array": [1, 23]}'); |
151
|
|
|
|
|
|
|
print $hash->{"more"}->{3}->[0]; |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 AUTHOR |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Rajkumar Reddy, mesg.raj@outlook.com |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Copyright (C) 2019 by Rajkumar Reddy |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
162
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.26.1 or, |
163
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=cut |