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