line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
50
|
|
2
|
1
|
|
|
1
|
|
7
|
use warnings FATAL => 'all'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
63
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package MarpaX::Languages::ECMAScript::AST::Impl; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Implementation of Marpa's interface |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
970
|
use Marpa::R2 2.080000; |
|
1
|
|
|
|
|
196126
|
|
|
1
|
|
|
|
|
45
|
|
9
|
1
|
|
|
1
|
|
695
|
use MarpaX::Languages::ECMAScript::AST::Exceptions qw/:all/; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
198
|
|
10
|
1
|
|
|
1
|
|
927
|
use MarpaX::Languages::ECMAScript::AST::Impl::Logger; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
46
|
|
11
|
1
|
|
|
1
|
|
665
|
use MarpaX::Languages::ECMAScript::AST::Impl::Singleton; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
194
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.018'; # VERSION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $MARPA_TRACE_FILE_HANDLE; |
16
|
|
|
|
|
|
|
our $MARPA_TRACE_BUFFER; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub BEGIN { |
19
|
|
|
|
|
|
|
# |
20
|
|
|
|
|
|
|
## We do not want Marpa to pollute STDERR |
21
|
|
|
|
|
|
|
# |
22
|
|
|
|
|
|
|
## Autovivify a new file handle |
23
|
|
|
|
|
|
|
# |
24
|
1
|
|
|
1
|
|
28
|
open($MARPA_TRACE_FILE_HANDLE, '>', \$MARPA_TRACE_BUFFER); |
|
1
|
|
|
1
|
|
6
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
25
|
1
|
50
|
|
|
|
1437
|
if (! defined($MARPA_TRACE_FILE_HANDLE)) { |
26
|
0
|
|
|
|
|
0
|
InternalError(error => "Cannot create temporary file handle to tie Marpa logging, $!\n"); |
27
|
|
|
|
|
|
|
} else { |
28
|
1
|
50
|
|
|
|
3
|
if (! tie ${$MARPA_TRACE_FILE_HANDLE}, 'MarpaX::Languages::ECMAScript::AST::Impl::Logger') { |
|
1
|
|
|
|
|
12
|
|
29
|
0
|
|
|
|
|
0
|
InternalError(error => "Cannot tie $MARPA_TRACE_FILE_HANDLE, $!\n"); |
30
|
0
|
0
|
|
|
|
0
|
if (! close($MARPA_TRACE_FILE_HANDLE)) { |
31
|
0
|
|
|
|
|
0
|
InternalError(error => "Cannot close temporary file handle, $!\n"); |
32
|
|
|
|
|
|
|
} |
33
|
0
|
|
|
|
|
0
|
$MARPA_TRACE_FILE_HANDLE = undef; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
our $singleton = MarpaX::Languages::ECMAScript::AST::Impl::Singleton->instance(); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub new { |
42
|
1
|
|
|
1
|
1
|
4
|
my ($class, $grammarOptionsHashp, $recceOptionsHashp) = @_; |
43
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
10
|
my $self->{grammar} = $singleton->G($grammarOptionsHashp); |
45
|
|
|
|
|
|
|
|
46
|
1
|
50
|
|
|
|
5
|
if (defined($recceOptionsHashp)) { |
47
|
1
|
|
|
|
|
4
|
$recceOptionsHashp->{grammar} = $self->{grammar}; |
48
|
|
|
|
|
|
|
} else { |
49
|
0
|
|
|
|
|
0
|
$recceOptionsHashp = {grammar => $self->{grammar}}; |
50
|
|
|
|
|
|
|
} |
51
|
1
|
|
50
|
|
|
14
|
$recceOptionsHashp->{trace_terminals} = $ENV{MARPA_TRACE_TERMINALS} || $ENV{MARPA_TRACE} || 0; |
52
|
1
|
|
50
|
|
|
12
|
$recceOptionsHashp->{trace_values} = $ENV{MARPA_TRACE_VALUES} || $ENV{MARPA_TRACE} || 0; |
53
|
1
|
|
|
|
|
3
|
$recceOptionsHashp->{trace_file_handle} = $MARPA_TRACE_FILE_HANDLE; |
54
|
|
|
|
|
|
|
# |
55
|
|
|
|
|
|
|
# Save recceOptionsHashp for further use |
56
|
|
|
|
|
|
|
# |
57
|
1
|
|
|
|
|
3
|
$self->{_recceOptionsHashp} = $recceOptionsHashp; |
58
|
|
|
|
|
|
|
|
59
|
1
|
|
|
|
|
4
|
bless($self, $class); |
60
|
|
|
|
|
|
|
|
61
|
1
|
|
|
|
|
6
|
return $self; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub make_R { |
66
|
0
|
|
|
0
|
1
|
|
$_[0]->{recce} = Marpa::R2::Scanless::R->new($_[0]->{_recceOptionsHashp}); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub destroy_R { |
71
|
0
|
|
|
0
|
1
|
|
$_[0]->{recce} = undef; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub value { |
76
|
0
|
|
|
0
|
1
|
|
return $_[0]->{recce}->value(@_[1..$#_]); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub read { |
81
|
0
|
|
|
0
|
1
|
|
return $_[0]->{recce}->read(@_[1..$#_]); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub resume { |
86
|
0
|
|
|
0
|
1
|
|
return $_[0]->{recce}->resume(@_[1..$#_]); |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub last_completed { |
91
|
0
|
|
|
0
|
1
|
|
return $_[0]->{recce}->last_completed(@_[1..$#_]); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub last_completed_range { |
96
|
0
|
|
|
0
|
1
|
|
return $_[0]->{recce}->last_completed_range(@_[1..$#_]); |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub range_to_string { |
101
|
0
|
|
|
0
|
1
|
|
return $_[0]->{recce}->range_to_string(@_[1..$#_]); |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub event { |
106
|
0
|
|
|
0
|
1
|
|
return $_[0]->{recce}->event(@_[1..$#_]); |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub events { |
111
|
0
|
|
|
0
|
1
|
|
return $_[0]->{recce}->events(); |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
sub pause_lexeme { |
116
|
0
|
|
|
0
|
1
|
|
return $_[0]->{recce}->pause_lexeme(@_[1..$#_]); |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub pause_span { |
121
|
0
|
|
|
0
|
1
|
|
return $_[0]->{recce}->pause_span(@_[1..$#_]); |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub literal { |
126
|
0
|
|
|
0
|
1
|
|
return $_[0]->{recce}->literal(@_[1..$#_]); |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub line_column { |
131
|
0
|
|
|
0
|
1
|
|
return $_[0]->{recce}->line_column(@_[1..$#_]); |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub substring { |
136
|
0
|
|
|
0
|
1
|
|
return $_[0]->{recce}->substring(@_[1..$#_]); |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub lexeme_read { |
141
|
0
|
|
|
0
|
1
|
|
return $_[0]->{recce}->lexeme_read(@_[1..$#_]); |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub current_g1_location { |
146
|
0
|
|
|
0
|
1
|
|
return $_[0]->{recce}->current_g1_location(@_[1..$#_]); |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
sub g1_location_to_span { |
151
|
0
|
|
|
0
|
1
|
|
return $_[0]->{recce}->g1_location_to_span(@_[1..$#_]); |
152
|
|
|
|
|
|
|
} |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub terminals_expected { |
156
|
0
|
|
|
0
|
1
|
|
return $_[0]->{recce}->terminals_expected(@_[1..$#_]); |
157
|
|
|
|
|
|
|
} |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub show_progress { |
161
|
0
|
|
|
0
|
1
|
|
return $_[0]->{recce}->show_progress(@_[1..$#_]); |
162
|
|
|
|
|
|
|
} |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
sub progress { |
166
|
0
|
|
|
0
|
1
|
|
return $_[0]->{recce}->progress(@_[1..$#_]); |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
sub grammar { |
171
|
0
|
|
|
0
|
1
|
|
return $_[0]->{grammar}; |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
sub G { |
176
|
0
|
|
|
0
|
1
|
|
return $_[0]->grammar; |
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
sub recce { |
181
|
0
|
|
|
0
|
1
|
|
return $_[0]->{recce}; |
182
|
|
|
|
|
|
|
} |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
sub R { |
186
|
0
|
|
|
0
|
1
|
|
return $_[0]->recce; |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
sub rule_ids { |
191
|
0
|
|
|
0
|
1
|
|
return $_[0]->{grammar}->rule_ids(@_[1..$#_]); |
192
|
|
|
|
|
|
|
} |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
sub rule_expand { |
196
|
0
|
|
|
0
|
1
|
|
return $_[0]->{grammar}->rule_expand(@_[1..$#_]); |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
sub symbol_name { |
201
|
0
|
|
|
0
|
1
|
|
return $_[0]->{grammar}->symbol_name(@_[1..$#_]); |
202
|
|
|
|
|
|
|
} |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
1; |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
__END__ |