| 1 | # Marpa::R3 is Copyright (C) 2018, Jeffrey Kegler. | ||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||
| 3 | # This module is free software; you can redistribute it and/or modify it | ||||||||||||||||||||||||||||
| 4 | # under the same terms as Perl 5.10.1. For more details, see the full text | ||||||||||||||||||||||||||||
| 5 | # of the licenses in the directory LICENSES. | ||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||
| 7 | # This program is distributed in the hope that it will be | ||||||||||||||||||||||||||||
| 8 | # useful, but it is provided "as is" and without any express | ||||||||||||||||||||||||||||
| 9 | # or implied warranties. For details, see the full text of | ||||||||||||||||||||||||||||
| 10 | # of the licenses in the directory LICENSES. | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | package Marpa::R3::ASF; | ||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 104 | ▶ | use 5.010001; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 104 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | 104 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 104 | ▶ | no warnings qw(recursion); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 104 | ▶ | use vars qw($VERSION $STRING_VERSION); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 20 | 104 | $VERSION = '4.001_054'; | |||||||||||||||||||||||||||
| 21 | 104 | $STRING_VERSION = $VERSION; | |||||||||||||||||||||||||||
| 22 | ## no critic(BuiltinFunctions::ProhibitStringyEval) | ||||||||||||||||||||||||||||
| 23 | 104 | $VERSION = eval $VERSION; | |||||||||||||||||||||||||||
| 24 | ## use critic | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | # The code in this file, for now, breaks "the rules". It makes use | ||||||||||||||||||||||||||||
| 27 | # of internal methods not documented as part of Libmarpa. | ||||||||||||||||||||||||||||
| 28 | # It is intended to create documented Libmarpa methods to underlie | ||||||||||||||||||||||||||||
| 29 | # this interface, and rewrite it to use them | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | package Marpa::R3::Internal_ASF; | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 104 | ▶ | use Scalar::Util qw(blessed tainted); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 34 | 104 | ▶ | use English qw( -no_match_vars ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 104 | our $PACKAGE = 'Marpa::R3::ASF'; | |||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | # Set those common args which are at the Perl level. | ||||||||||||||||||||||||||||
| 39 | # This is more complicated that it needs to be for the current implementation. | ||||||||||||||||||||||||||||
| 40 | # It allows for LHS terminals (implemented in Libmarpa but not allowed by the SLIF). | ||||||||||||||||||||||||||||
| 41 | # It also assumes that every or-node which can be constructed from preceding or-nodes | ||||||||||||||||||||||||||||
| 42 | # and the input will be present. This is currently the case, but in the future | ||||||||||||||||||||||||||||
| 43 | # rules and/or symbols may have extra-syntactic conditions attached making this | ||||||||||||||||||||||||||||
| 44 | # assumption false. | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | # Set those common args which are at the Perl level. | ||||||||||||||||||||||||||||
| 47 | 1 | ▶ | sub asf_common_set { | ||||||||||||||||||||||||||
|
Subroutine
asf_common_set: called CC=2 SCAR=7.2
| |||||||||||||||||||||||||||||
| 48 | 1 | my ( $asf, $flat_args ) = @_; | |||||||||||||||||||||||||||
| 49 | 1 | ▶ | if ( my $value = $flat_args->{'trace_file_handle'} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | 0 | $asf->[Marpa::R3::Internal_ASF::TRACE_FILE_HANDLE] = $value; | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | 1 | my $trace_file_handle = | |||||||||||||||||||||||||||
| 53 | $asf->[Marpa::R3::Internal_ASF::TRACE_FILE_HANDLE]; | ||||||||||||||||||||||||||||
| 54 | 1 | delete $flat_args->{'trace_file_handle'}; | |||||||||||||||||||||||||||
| 55 | 1 | return $flat_args; | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | # Returns undef if no parse | ||||||||||||||||||||||||||||
| 59 | 1 | ▶ | sub Marpa::R3::ASF::new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=9 SCAR=26.3
Pod
undocumented
| |||||||||||||||||||||||||||||
| 60 | 1 | my ( $class, @args ) = @_; | |||||||||||||||||||||||||||
| 61 | 1 | my $asf = bless [], $class; | |||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 1 | my $end_of_parse; | |||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | 1 | my ( $flat_args, $error_message ) = Marpa::R3::flatten_hash_args( \@args ); | |||||||||||||||||||||||||||
| 66 | 1 | ▶ | Marpa::R3::exception( sprintf $error_message, '$asf->new' ) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 67 | if not $flat_args; | ||||||||||||||||||||||||||||
| 68 | 1 | $flat_args = asf_common_set( $asf, $flat_args ); | |||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 1 | my $slr = $flat_args->{recognizer}; | |||||||||||||||||||||||||||
| 71 | 1 | ▶ | Marpa::R3::exception( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 72 | qq{Marpa::R3::ASF::new() called without a "recognizer" argument} ) | ||||||||||||||||||||||||||||
| 73 | if not defined $slr; | ||||||||||||||||||||||||||||
| 74 | 1 | $asf->[Marpa::R3::Internal_ASF::SLR] = $slr; | |||||||||||||||||||||||||||
| 75 | 1 | delete $flat_args->{recognizer}; | |||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 1 | my $slr_class = 'Marpa::R3::Recognizer'; | |||||||||||||||||||||||||||
| 78 | 1 | ▶ | if ( not blessed $slr or not $slr->isa($slr_class) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
builtin::blessed($slr) and $slr->isa($slr_class)
MC/DC0%0/2
builtin::blessed($slr) and $slr->isa($slr_class)
builtin::blessed($slr)
$slr->isa($slr_class)
Truth table33%1/3
A and B
A= builtin::blessed($slr)B= $slr->isa($slr_class)
| |||||||||||||||||||||||||||||
| 79 | 0 | my $ref_type = ref $slr; | |||||||||||||||||||||||||||
| 80 | 0 | ▶ | my $desc = $ref_type ? "a ref to $ref_type" : 'not a ref'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 81 | 0 | Marpa::R3::exception( | |||||||||||||||||||||||||||
| 82 | qq{'recognizer' named argument to new() is $desc\n}, | ||||||||||||||||||||||||||||
| 83 | " It should be a ref to $slr_class\n" | ||||||||||||||||||||||||||||
| 84 | ); | ||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | 1 | ▶ | $asf->[Marpa::R3::Internal_ASF::TRACE_FILE_HANDLE] //= | ||||||||||||||||||||||||||
|
Condition33%1/3
$asf->[0] //= $slr->[3]
MC/DC0%0/2
$asf->[0] //= $slr->[3]
$asf->[0]
$slr->[3]
Truth table33%1/3
A //= B
A= $asf->[0]B= $slr->[3]
| |||||||||||||||||||||||||||||
| 88 | $slr->[Marpa::R3::Internal_R::TRACE_FILE_HANDLE]; | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | 1 | my $trace_file_handle = | |||||||||||||||||||||||||||
| 91 | $asf->[Marpa::R3::Internal_ASF::TRACE_FILE_HANDLE]; | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 1 | my $lua = $slr->[Marpa::R3::Internal_R::L]; | |||||||||||||||||||||||||||
| 94 | 1 | $asf->[Marpa::R3::Internal_ASF::L] = $lua; | |||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | my ( $regix ) = $slr->coro_by_tag( | ||||||||||||||||||||||||||||
| 97 | ( '@' . __FILE__ . ':' . __LINE__ ), | ||||||||||||||||||||||||||||
| 98 | { | ||||||||||||||||||||||||||||
| 99 | signature => 's', | ||||||||||||||||||||||||||||
| 100 | args => [$flat_args], | ||||||||||||||||||||||||||||
| 101 | handlers => { | ||||||||||||||||||||||||||||
| 102 | 0 | ▶ | trace => sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 103 | 0 | my ($msg) = @_; | |||||||||||||||||||||||||||
| 104 | 0 | say {$trace_file_handle} $msg; | |||||||||||||||||||||||||||
| 105 | 0 | return 'ok'; | |||||||||||||||||||||||||||
| 106 | }, | ||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||
| 108 | }, | ||||||||||||||||||||||||||||
| 109 | 1 | <<'END_OF_LUA'); | |||||||||||||||||||||||||||
| 110 | local slr, flat_args = ... | ||||||||||||||||||||||||||||
| 111 | _M.wrap(function () | ||||||||||||||||||||||||||||
| 112 | local asf = slr:asf_new(flat_args) | ||||||||||||||||||||||||||||
| 113 | if not asf then return 'ok', -1 end | ||||||||||||||||||||||||||||
| 114 | return 'ok', asf.regix | ||||||||||||||||||||||||||||
| 115 | end) | ||||||||||||||||||||||||||||
| 116 | END_OF_LUA | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | 1 | ▶ | return if $regix < 0; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 119 | 1 | $asf->[Marpa::R3::Internal_ASF::REGIX] = $regix; | |||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | 1 | ▶ | $asf->[Marpa::R3::Internal_ASF::FACTORING_MAX] //= 42; | ||||||||||||||||||||||||||
|
Condition50%1/2
$asf->[5] //= 42
MC/DC0%0/1
$asf->[5] //= 42
$asf->[5]
Truth table50%1/2
A
A= $asf->[5]
| |||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | 1 | return $asf; | |||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | } ## end sub Marpa::R3::ASF::new | ||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | 1 | ▶ | sub Marpa::R3::ASF::DESTROY { | ||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 128 | # say STDERR "In Marpa::R3::ASF::DESTROY before test"; | ||||||||||||||||||||||||||||
| 129 | 1 | my $asf = shift; | |||||||||||||||||||||||||||
| 130 | 1 | my $lua = $asf->[Marpa::R3::Internal_ASF::L]; | |||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | # If we are destroying the Perl interpreter, then all the Marpa | ||||||||||||||||||||||||||||
| 133 | # objects will be destroyed, including Marpa's Lua interpreter. | ||||||||||||||||||||||||||||
| 134 | # We do not need to worry about cleaning up the | ||||||||||||||||||||||||||||
| 135 | # recognizer is an orderly manner, because the Lua interpreter | ||||||||||||||||||||||||||||
| 136 | # containing the recognizer will be destroyed. | ||||||||||||||||||||||||||||
| 137 | # In fact, the Lua interpreter may already have been destroyed, | ||||||||||||||||||||||||||||
| 138 | # so this test is necessary to avoid a warning message. | ||||||||||||||||||||||||||||
| 139 | 1 | ▶ | return if not $lua; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 140 | # say STDERR "In Marpa::R3::ASF::DESTROY after test"; | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | 1 | my $regix = $asf->[Marpa::R3::Internal_ASF::REGIX]; | |||||||||||||||||||||||||||
| 143 | 1 | $asf->call_by_tag( | |||||||||||||||||||||||||||
| 144 | ('@' . __FILE__ . ':' . __LINE__), | ||||||||||||||||||||||||||||
| 145 | <<'END_OF_LUA', ''); | ||||||||||||||||||||||||||||
| 146 | local asf = ... | ||||||||||||||||||||||||||||
| 147 | local regix = asf.regix | ||||||||||||||||||||||||||||
| 148 | _M.unregister(_M.registry, regix) | ||||||||||||||||||||||||||||
| 149 | END_OF_LUA | ||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | # not to be documented | ||||||||||||||||||||||||||||
| 153 | 1 | ▶ | sub Marpa::R3::ASF::call_by_tag { | ||||||||||||||||||||||||||
|
Subroutine
call_by_tag: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 154 | 1 | my ( $asf, $tag, $codestr, $signature, @args ) = @_; | |||||||||||||||||||||||||||
| 155 | 1 | my $lua = $asf->[Marpa::R3::Internal_ASF::L]; | |||||||||||||||||||||||||||
| 156 | 1 | my $regix = $asf->[Marpa::R3::Internal_ASF::REGIX]; | |||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | 1 | my @results; | |||||||||||||||||||||||||||
| 159 | my $eval_error; | ||||||||||||||||||||||||||||
| 160 | 1 | my $eval_ok; | |||||||||||||||||||||||||||
| 161 | { | ||||||||||||||||||||||||||||
| 162 | 1 | local $@; | |||||||||||||||||||||||||||
| 163 | 1 | $eval_ok = eval { | |||||||||||||||||||||||||||
| 164 | 1 | @results = | |||||||||||||||||||||||||||
| 165 | $lua->call_by_tag( $regix, $tag, $codestr, $signature, @args ); | ||||||||||||||||||||||||||||
| 166 | 1 | return 1; | |||||||||||||||||||||||||||
| 167 | }; | ||||||||||||||||||||||||||||
| 168 | 1 | $eval_error = $@; | |||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||
| 170 | 1 | ▶ | if ( not $eval_ok ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 171 | 0 | Marpa::R3::exception($eval_error); | |||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||
| 173 | 1 | return @results; | |||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | # not to be documented | ||||||||||||||||||||||||||||
| 177 | 1 | ▶ | sub Marpa::R3::ASF::coro_by_tag { | ||||||||||||||||||||||||||
|
Subroutine
coro_by_tag: called CC=13 SCAR=38.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 178 | 1 | my ( $asf, $tag, $args, $codestr ) = @_; | |||||||||||||||||||||||||||
| 179 | 1 | my $lua = $asf->[Marpa::R3::Internal_ASF::L]; | |||||||||||||||||||||||||||
| 180 | 1 | my $regix = $asf->[Marpa::R3::Internal_ASF::REGIX]; | |||||||||||||||||||||||||||
| 181 | 1 | ▶ | my $handler = $args->{handlers} // {}; | ||||||||||||||||||||||||||
|
Condition50%1/2
$args->{"handlers"} // {}
MC/DC0%0/1
$args->{"handlers"} // {}
$args->{"handlers"}
Truth table50%1/2
A
A= $args->{"handlers"}
| |||||||||||||||||||||||||||||
| 182 | 1 | my $resume_tag = $tag . '[R]'; | |||||||||||||||||||||||||||
| 183 | 1 | ▶ | my $signature = $args->{signature} // ''; | ||||||||||||||||||||||||||
|
Condition50%1/2
$args->{"signature"} // ""
MC/DC0%0/1
$args->{"signature"} // ""
$args->{"signature"}
Truth table50%1/2
A
A= $args->{"signature"}
| |||||||||||||||||||||||||||||
| 184 | 1 | ▶ | my $p_args = $args->{args} // []; | ||||||||||||||||||||||||||
|
Condition50%1/2
$args->{"args"} // []
MC/DC0%0/1
$args->{"args"} // []
$args->{"args"}
Truth table50%1/2
A
A= $args->{"args"}
| |||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||
| 186 | 1 | my @results; | |||||||||||||||||||||||||||
| 187 | my $eval_error; | ||||||||||||||||||||||||||||
| 188 | 1 | my $eval_ok; | |||||||||||||||||||||||||||
| 189 | { | ||||||||||||||||||||||||||||
| 190 | 1 | local $@; | |||||||||||||||||||||||||||
| 191 | 1 | $eval_ok = eval { | |||||||||||||||||||||||||||
| 192 | 1 | $lua->call_by_tag( $regix, $tag, $codestr, $signature, @{$p_args} ); | |||||||||||||||||||||||||||
| 193 | 1 | my @resume_args = (''); | |||||||||||||||||||||||||||
| 194 | 1 | my $signature = 's'; | |||||||||||||||||||||||||||
| 195 | 1 | CORO_CALL: while (1) { | |||||||||||||||||||||||||||
| 196 | 1 | my ( $cmd, $yield_data ) = | |||||||||||||||||||||||||||
| 197 | $lua->call_by_tag( $regix, $resume_tag, | ||||||||||||||||||||||||||||
| 198 | 'local asf, resume_arg = ...; return _M.resume(resume_arg)', | ||||||||||||||||||||||||||||
| 199 | $signature, @resume_args ) ; | ||||||||||||||||||||||||||||
| 200 | 1 | ▶ | if (not $cmd) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 201 | 1 | @results = @{$yield_data}; | |||||||||||||||||||||||||||
| 202 | 1 | return 1; | |||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||
| 204 | 0 | my $handler = $handler->{$cmd}; | |||||||||||||||||||||||||||
| 205 | 0 | ▶ | Marpa::R3::exception(qq{No coro handler for "$cmd"}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 206 | if not $handler; | ||||||||||||||||||||||||||||
| 207 | 0 | ▶ | $yield_data //= []; | ||||||||||||||||||||||||||
|
Condition0%0/2
$yield_data //= []
MC/DC0%0/1
$yield_data //= []
$yield_data
Truth table0%0/2
A
A= $yield_data
| |||||||||||||||||||||||||||||
| 208 | 0 | my ($handler_cmd, $new_resume_args) = $handler->(@{$yield_data}); | |||||||||||||||||||||||||||
| 209 | 0 | ▶ | Marpa::R3::exception(qq{Undefined return command from handler for "$cmd"}) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 210 | if not defined $handler_cmd; | ||||||||||||||||||||||||||||
| 211 | 0 | ▶ | if ($handler_cmd eq 'ok') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 212 | 0 | $signature = 's'; | |||||||||||||||||||||||||||
| 213 | 0 | @resume_args = ($new_resume_args); | |||||||||||||||||||||||||||
| 214 | 0 | ▶ | if (scalar @resume_args < 1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 215 | 0 | @resume_args = (''); | |||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||
| 217 | 0 | next CORO_CALL; | |||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||
| 219 | 0 | ▶ | if ($handler_cmd eq 'sig') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 220 | 0 | @resume_args = @{$new_resume_args}; | |||||||||||||||||||||||||||
| 221 | 0 | $signature = shift @resume_args; | |||||||||||||||||||||||||||
| 222 | 0 | next CORO_CALL; | |||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||
| 224 | 0 | Marpa::R3::exception(qq{Bad return command ("$handler_cmd") from handler for "$cmd"}) | |||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||
| 226 | 0 | return 1; | |||||||||||||||||||||||||||
| 227 | }; | ||||||||||||||||||||||||||||
| 228 | 1 | $eval_error = $@; | |||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||
| 230 | 1 | ▶ | if ( not $eval_ok ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 231 | # if it's an object, just die | ||||||||||||||||||||||||||||
| 232 | 0 | ▶ | die $eval_error if ref $eval_error; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 233 | 0 | Marpa::R3::exception($eval_error); | |||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||
| 235 | 1 | return @results; | |||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | 0 | ▶ | sub Marpa::R3::ASF::ambiguity_level { | ||||||||||||||||||||||||||
|
Subroutine
ambiguity_level: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 239 | 0 | my ($asf) = @_; | |||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | 0 | my ($metric) = $asf->call_by_tag( | |||||||||||||||||||||||||||
| 242 | ('@' . __FILE__ . ':' . __LINE__), | ||||||||||||||||||||||||||||
| 243 | <<'END__OF_LUA', '>*' ); | ||||||||||||||||||||||||||||
| 244 | local asf = ... | ||||||||||||||||||||||||||||
| 245 | return asf:ambiguity_level() | ||||||||||||||||||||||||||||
| 246 | END__OF_LUA | ||||||||||||||||||||||||||||
| 247 | 0 | return $metric; | |||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||
| 250 | 1 | ▶ | sub Marpa::R3::ASF::peak { | ||||||||||||||||||||||||||
|
Subroutine
peak: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 251 | 1 | my ($asf) = @_; | |||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | 1 | my ($peak) = Marpa::R3::Internal_Glade::peak($asf); | |||||||||||||||||||||||||||
| 254 | 1 | return $peak; | |||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||
| 257 | 0 | ▶ | sub Marpa::R3::ASF::dump { | ||||||||||||||||||||||||||
|
Subroutine
dump: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 258 | 0 | my ($asf) = @_; | |||||||||||||||||||||||||||
| 259 | 0 | my ($dump) = $asf->call_by_tag( | |||||||||||||||||||||||||||
| 260 | ('@' . __FILE__ . ':' . __LINE__), | ||||||||||||||||||||||||||||
| 261 | <<'END__OF_LUA', '>*' ); | ||||||||||||||||||||||||||||
| 262 | local asf = ... | ||||||||||||||||||||||||||||
| 263 | return asf:dump() | ||||||||||||||||||||||||||||
| 264 | END__OF_LUA | ||||||||||||||||||||||||||||
| 265 | 0 | return $dump; | |||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | 0 | ▶ | sub Marpa::R3::ASF::g1_pos { | ||||||||||||||||||||||||||
|
Subroutine
g1_pos: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 269 | 0 | my ( $asf ) = @_; | |||||||||||||||||||||||||||
| 270 | 0 | my ($g1_pos) = $asf->call_by_tag( | |||||||||||||||||||||||||||
| 271 | ('@' . __FILE__ . ':' . __LINE__), | ||||||||||||||||||||||||||||
| 272 | <<'END__OF_LUA', '>*' ); | ||||||||||||||||||||||||||||
| 273 | local asf = ... | ||||||||||||||||||||||||||||
| 274 | return asf:g1_pos() | ||||||||||||||||||||||||||||
| 275 | END__OF_LUA | ||||||||||||||||||||||||||||
| 276 | 0 | return $g1_pos; | |||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||
| 279 | # not to be documented | ||||||||||||||||||||||||||||
| 280 | 0 | ▶ | sub Marpa::R3::ASF::regix { | ||||||||||||||||||||||||||
|
Subroutine
regix: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 281 | 0 | my ( $asf ) = @_; | |||||||||||||||||||||||||||
| 282 | 0 | my $regix = $asf->[Marpa::R3::Internal_ASF::REGIX]; | |||||||||||||||||||||||||||
| 283 | 0 | return $regix; | |||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||
| 286 | 104 | 1; | |||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||
| 288 | # vim: expandtab shiftwidth=4: | ||||||||||||||||||||||||||||