| 1 | package Logic::Relational::Goal::EndCall; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 15 | ▶ | use v5.38; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 15 | ▶ | use experimental 'signatures'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 15 | ▶ | use parent 'Logic::Relational::Goal'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | =head1 NAME | ||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | Logic::Relational::Goal::EndCall - Internal marker goal popping an active ancestor call frame. | ||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | =head1 DESCRIPTION | ||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | C<Logic::Relational::Goal::EndCall> is an internal continuation marker inserted | ||||||||||||||||||||
| 14 | after a rule body expansion by L<Logic::Relational::Goal::Call>. When reached, it | ||||||||||||||||||||
| 15 | pops the completed call from the search state's active C<ancestors> stack so that | ||||||||||||||||||||
| 16 | subsequent sibling goals are not treated as recursive descendants of the completed call. | ||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | =head1 METHODS | ||||||||||||||||||||
| 19 | |||||||||||||||||||||
| 20 | =head2 new | ||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | Constructs a new C<EndCall> marker goal. | ||||||||||||||||||||
| 23 | |||||||||||||||||||||
| 24 | =head2 expand | ||||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | Pops the most recent ancestor from the state's ancestor stack and advances to the | ||||||||||||||||||||
| 27 | remaining goals. | ||||||||||||||||||||
| 28 | |||||||||||||||||||||
| 29 | =head2 freshen | ||||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | Returns the marker unchanged (no logical variables are stored in the marker). | ||||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | =cut | ||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | 107 | ▶ | sub new ($class) { | ||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 36 | 107 | return bless {}, $class; | |||||||||||||||||||
| 37 | } | ||||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | 140 | ▶ | sub expand ( $self, %args ) { | ||||||||||||||||||
|
Subroutine
expand: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||
| 40 | 140 | my $state = $args{state}; | |||||||||||||||||||
| 41 | 140 | my $remaining = $args{remaining}; | |||||||||||||||||||
| 42 | 140 | my @anc = @{ $state->ancestors }; | |||||||||||||||||||
| 43 | 140 | pop @anc; | |||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | my $succ = $state->derive( | ||||||||||||||||||||
| 46 | substitution => $args{substitution}, | ||||||||||||||||||||
| 47 | 140 | goals => $remaining, | |||||||||||||||||||
| 48 | ancestors => \@anc, | ||||||||||||||||||||
| 49 | ); | ||||||||||||||||||||
| 50 | 140 | ▶ | return $succ // (); | ||||||||||||||||||
|
Condition33%1/3
$succ // ()
MC/DC0%0/2
$succ // ()
$succ
()
Truth table33%1/3
A // B
A= $succB= ()
| |||||||||||||||||||||
| 51 | } | ||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | 0 | ▶ | sub freshen ( $self, $var_map ) { | ||||||||||||||||||
|
Subroutine
freshen: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 54 | 0 | return $self; | |||||||||||||||||||
| 55 | } | ||||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | 15 | 1; | |||||||||||||||||||