line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
7
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
51
|
|
2
|
2
|
|
|
2
|
|
6
|
use warnings FATAL => 'all'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
77
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package MarpaX::Languages::C::AST::Impl; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Implementation of Marpa's interface |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# use MarpaX::Languages::C::AST::Util qw/traceAndUnpack/; |
9
|
2
|
|
|
2
|
|
748
|
use Marpa::R2 2.081001; |
|
2
|
|
|
|
|
208575
|
|
|
2
|
|
|
|
|
73
|
|
10
|
2
|
|
|
2
|
|
12
|
use Carp qw/croak/; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
99
|
|
11
|
2
|
|
|
2
|
|
728
|
use MarpaX::Languages::C::AST::Impl::Logger; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
291
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.47'; # 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
|
2
|
|
|
2
|
|
55
|
open($MARPA_TRACE_FILE_HANDLE, '>', \$MARPA_TRACE_BUFFER); |
|
2
|
|
|
2
|
|
14
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
14
|
|
25
|
2
|
50
|
|
|
|
1504
|
if (! defined($MARPA_TRACE_FILE_HANDLE)) { |
26
|
0
|
|
|
|
|
0
|
croak "Cannot create temporary file handle to tie Marpa logging, $!\n"; |
27
|
|
|
|
|
|
|
} else { |
28
|
2
|
50
|
|
|
|
3
|
if (! tie ${$MARPA_TRACE_FILE_HANDLE}, 'MarpaX::Languages::C::AST::Impl::Logger') { |
|
2
|
|
|
|
|
14
|
|
29
|
0
|
|
|
|
|
0
|
croak "Cannot tie $MARPA_TRACE_FILE_HANDLE, $!\n"; |
30
|
0
|
0
|
|
|
|
0
|
if (! close($MARPA_TRACE_FILE_HANDLE)) { |
31
|
0
|
|
|
|
|
0
|
croak "Cannot close temporary file handle, $!\n"; |
32
|
|
|
|
|
|
|
} |
33
|
0
|
|
|
|
|
0
|
$MARPA_TRACE_FILE_HANDLE = undef; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub new { |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
1
|
1
|
2
|
my ($class, $grammarOptionsHashp, $recceOptionsHashp) = @_; |
42
|
|
|
|
|
|
|
|
43
|
1
|
|
|
|
|
3
|
my $self = { |
44
|
|
|
|
|
|
|
_cacheRule => {} |
45
|
|
|
|
|
|
|
}; |
46
|
1
|
|
|
|
|
11
|
$self->{grammar} = Marpa::R2::Scanless::G->new($grammarOptionsHashp); |
47
|
1
|
50
|
|
|
|
872623
|
if (defined($recceOptionsHashp)) { |
48
|
1
|
|
|
|
|
5
|
$recceOptionsHashp->{grammar} = $self->{grammar}; |
49
|
|
|
|
|
|
|
} else { |
50
|
0
|
|
|
|
|
0
|
$recceOptionsHashp = {grammar => $self->{grammar}}; |
51
|
|
|
|
|
|
|
} |
52
|
1
|
|
50
|
|
|
12
|
$recceOptionsHashp->{trace_terminals} = $ENV{MARPA_TRACE_TERMINALS} || $ENV{MARPA_TRACE} || 0; |
53
|
1
|
|
50
|
|
|
9
|
$recceOptionsHashp->{trace_values} = $ENV{MARPA_TRACE_VALUES} || $ENV{MARPA_TRACE} || 0; |
54
|
1
|
|
|
|
|
3
|
$recceOptionsHashp->{trace_file_handle} = $MARPA_TRACE_FILE_HANDLE; |
55
|
1
|
|
|
|
|
9
|
$self->{recce} = Marpa::R2::Scanless::R->new($recceOptionsHashp); |
56
|
1
|
|
|
|
|
533
|
bless($self, $class); |
57
|
|
|
|
|
|
|
|
58
|
1
|
|
|
|
|
17
|
return $self; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub value { |
63
|
2
|
|
|
2
|
1
|
16
|
return $_[0]->{recce}->value(@_[1..$#_]); |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub read { |
68
|
1
|
|
|
1
|
1
|
20
|
return $_[0]->{recce}->read(@_[1..$#_]); |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub resume { |
73
|
18
|
|
|
18
|
1
|
52
|
return $_[0]->{recce}->resume(@_[1..$#_]); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub last_completed { |
78
|
0
|
|
|
0
|
1
|
0
|
return $_[0]->{recce}->last_completed(@_[1..$#_]); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub last_completed_range { |
83
|
0
|
|
|
0
|
1
|
0
|
return $_[0]->{recce}->last_completed_range(@_[1..$#_]); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub range_to_string { |
88
|
0
|
|
|
0
|
1
|
0
|
return $_[0]->{recce}->range_to_string(@_[1..$#_]); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
sub event { |
93
|
40
|
|
|
40
|
1
|
110
|
return $_[0]->{recce}->event(@_[1..$#_]); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub pause_lexeme { |
98
|
25
|
|
|
25
|
1
|
81
|
return $_[0]->{recce}->pause_lexeme(@_[1..$#_]); |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub pause_span { |
103
|
23
|
|
|
23
|
1
|
52
|
return $_[0]->{recce}->pause_span(@_[1..$#_]); |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
sub literal { |
108
|
23
|
|
|
23
|
1
|
57
|
return $_[0]->{recce}->literal(@_[1..$#_]); |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub line_column { |
113
|
42
|
|
|
42
|
1
|
101
|
return $_[0]->{recce}->line_column(@_[1..$#_]); |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub substring { |
118
|
0
|
|
|
0
|
1
|
0
|
return $_[0]->{recce}->substring(@_[1..$#_]); |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub lexeme_read { |
123
|
7
|
|
|
7
|
1
|
27
|
return $_[0]->{recce}->lexeme_read(@_[1..$#_]); |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
sub lexeme_alternative { |
128
|
3
|
|
|
3
|
1
|
14
|
return $_[0]->{recce}->lexeme_alternative(@_[1..$#_]); |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
sub lexeme_complete { |
133
|
3
|
|
|
3
|
1
|
12
|
return $_[0]->{recce}->lexeme_complete(@_[1..$#_]); |
134
|
|
|
|
|
|
|
} |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
sub current_g1_location { |
138
|
19
|
|
|
19
|
1
|
62
|
return $_[0]->{recce}->current_g1_location(@_[1..$#_]); |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
sub g1_location_to_span { |
143
|
19
|
|
|
19
|
1
|
50
|
return $_[0]->{recce}->g1_location_to_span(@_[1..$#_]); |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
sub terminals_expected { |
148
|
3
|
|
|
3
|
1
|
16
|
return $_[0]->{recce}->terminals_expected(@_[1..$#_]); |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
sub show_progress { |
153
|
0
|
|
|
0
|
1
|
|
return $_[0]->{recce}->show_progress(@_[1..$#_]); |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
sub start_symbol_id { |
158
|
0
|
|
|
0
|
1
|
|
return $_[0]->{grammar}->start_symbol_id(@_[1..$#_]); |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
sub rule_ids { |
163
|
0
|
|
|
0
|
1
|
|
return $_[0]->{grammar}->rule_ids(@_[1..$#_]); |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
sub symbol_name { |
168
|
0
|
|
|
0
|
1
|
|
return $_[0]->{grammar}->symbol_name(@_[1..$#_]); |
169
|
|
|
|
|
|
|
} |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
sub rule_name { |
173
|
0
|
|
|
0
|
1
|
|
return $_[0]->{grammar}->rule_name(@_[1..$#_]); |
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
sub rule_expand { |
178
|
0
|
|
|
0
|
1
|
|
return $_[0]->{grammar}->rule_expand(@_[1..$#_]); |
179
|
|
|
|
|
|
|
} |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
1; |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
__END__ |