Marpa-R2
view release on metacpan or search on metacpan
pod/Glade.pod view on Meta::CPAN
Marpa::R2::Internal::ASF::ambiguities_show( $asf, \@ambiguities );
=for Marpa::R2::Display::End
Returns a string which contains a description of the ambiguities in its arguments.
Takes two arguments, both required.
The first is an ASF, and the second is a reference to an array of ambiguities,
in the format returned by L<the ambiguities() method|/"ambiguities()">.
Major applications will often have their own
customized ambiguity formatting routine, one which can formulate
error messages based, not just on the names of the rules and symbols,
but on knowledge of the role that
the rules and symbols play in
the application.
This method is intended for applications which do not have
their own customized ambiguity handling.
For those which do, it can be used
as a fallback for handling those reports that the customized method does not recognize
or that do not need special handling.
The format of the returned string
my $latest_earley_set = $recce->latest_earley_set();
my $max_size = $recce->earley_set_size($latest_earley_set);
TOKEN: while ( $i++ < $length ) {
$recce->read( 'a', 'a' );
$latest_earley_set = $recce->latest_earley_set();
my $size = $recce->earley_set_size($latest_earley_set);
$max_size = $size > $max_size ? $size : $max_size;
} ## end while ( $i++ < $length )
# Note that the length formula only works
# beginning with Earley set c, for some small
# constant c
my $expected_size = $leo_flag ? 9 : ( $length - 1 ) * 4 + 8;
Marpa::R2::Test::is( $max_size, $expected_size,
"Leo flag $leo_flag, size $max_size" );
my $value_ref = $recce->value();
my $value = $value_ref ? ${$value_ref} : 'No parse';
Marpa::R2::Test::is( $value, 'a' x $length, 'Leo p166 parse' );
t/leo_cycle.t view on Meta::CPAN
my $latest_earley_set = $recce->latest_earley_set();
my $max_size = $recce->earley_set_size($latest_earley_set);
TOKEN: while ( $i++ < $length ) {
$recce->read( 'a', 'a' );
$latest_earley_set = $recce->latest_earley_set();
my $size = $recce->earley_set_size($latest_earley_set);
$max_size = $size > $max_size ? $size : $max_size;
} ## end while ( $i++ < $length )
# Note that the length formula only works
# beginning with Earley set c, for some small
# constant c
my $expected_size = 14;
Marpa::R2::Test::is( $max_size, $expected_size, "size $max_size" );
my $show_earley_sets_output = do {
local $RS = undef;
## no critic(Subroutines::ProhibitCallsToUndeclaredSubs)
<DATA>;
};
( run in 0.636 second using v1.01-cache-2.11-cpan-26ccb49234f )