line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dallycot::AST::Any; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:JSMITH'; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# ABSTRACT: Return true iff any expression evaluates true |
5
|
|
|
|
|
|
|
|
6
|
23
|
|
|
23
|
|
11761
|
use strict; |
|
23
|
|
|
|
|
37
|
|
|
23
|
|
|
|
|
774
|
|
7
|
23
|
|
|
23
|
|
94
|
use warnings; |
|
23
|
|
|
|
|
34
|
|
|
23
|
|
|
|
|
588
|
|
8
|
|
|
|
|
|
|
|
9
|
23
|
|
|
23
|
|
129
|
use utf8; |
|
23
|
|
|
|
|
32
|
|
|
23
|
|
|
|
|
97
|
|
10
|
23
|
|
|
23
|
|
437
|
use parent 'Dallycot::AST::LoopBase'; |
|
23
|
|
|
|
|
36
|
|
|
23
|
|
|
|
|
97
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub simplify { |
13
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
return bless [ map { $_->simplify } @$self ] => __PACKAGE__; |
|
0
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub to_rdf { |
19
|
0
|
|
|
0
|
0
|
|
my($self, $model) = @_; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# |
22
|
|
|
|
|
|
|
# node -> expression_set -> [ ... ] |
23
|
|
|
|
|
|
|
# |
24
|
0
|
|
|
|
|
|
return $model -> apply( |
25
|
|
|
|
|
|
|
$model -> meta_uri('loc:any-true'), |
26
|
|
|
|
|
|
|
[ @$self ], |
27
|
|
|
|
|
|
|
{} |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
# my $bnode = $model->bnode(); |
30
|
|
|
|
|
|
|
# |
31
|
|
|
|
|
|
|
# $model -> add_type($bnode, 'loc:AnyTrue'); |
32
|
|
|
|
|
|
|
# |
33
|
|
|
|
|
|
|
# foreach my $expr (@$self) { |
34
|
|
|
|
|
|
|
# $model -> add_expression($bnode, $expr); |
35
|
|
|
|
|
|
|
# } |
36
|
|
|
|
|
|
|
# return $bnode; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub process_loop { |
40
|
0
|
|
|
0
|
0
|
|
my ( $self, $engine, $d, @expressions ) = @_; |
41
|
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
|
if ( !@expressions ) { |
43
|
0
|
|
|
|
|
|
$d->resolve( $engine->FALSE ); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
else { |
46
|
|
|
|
|
|
|
$engine->execute( shift @expressions, ['Boolean'] )->done( |
47
|
|
|
|
|
|
|
sub { |
48
|
0
|
0
|
|
0
|
|
|
if ( $_[0]->value ) { |
49
|
0
|
|
|
|
|
|
$d->resolve( $engine->TRUE ); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
else { |
52
|
0
|
|
|
|
|
|
$self->process_loop( $engine, $d, @expressions ); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
}, |
55
|
|
|
|
|
|
|
sub { |
56
|
0
|
|
|
0
|
|
|
$d->reject(@_); |
57
|
|
|
|
|
|
|
} |
58
|
0
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
|
return; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |