| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Dallycot::AST::BuildRange; |
|
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:JSMITH'; |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# ABSTRACT: Create open or closed range |
|
5
|
|
|
|
|
|
|
|
|
6
|
23
|
|
|
23
|
|
12566
|
use strict; |
|
|
23
|
|
|
|
|
33
|
|
|
|
23
|
|
|
|
|
701
|
|
|
7
|
23
|
|
|
23
|
|
90
|
use warnings; |
|
|
23
|
|
|
|
|
31
|
|
|
|
23
|
|
|
|
|
495
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
23
|
|
|
23
|
|
101
|
use utf8; |
|
|
23
|
|
|
|
|
33
|
|
|
|
23
|
|
|
|
|
107
|
|
|
10
|
23
|
|
|
23
|
|
457
|
use parent 'Dallycot::AST'; |
|
|
23
|
|
|
|
|
39
|
|
|
|
23
|
|
|
|
|
114
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub to_rdf { |
|
13
|
0
|
|
|
0
|
0
|
|
my($self, $model) = @_; |
|
14
|
|
|
|
|
|
|
|
|
15
|
0
|
0
|
|
|
|
|
if(@$self > 1) { |
|
16
|
0
|
|
|
|
|
|
return $model -> apply( |
|
17
|
|
|
|
|
|
|
$model -> meta_uri('loc:range'), |
|
18
|
|
|
|
|
|
|
[ |
|
19
|
|
|
|
|
|
|
$self->[0], $self -> [1] |
|
20
|
|
|
|
|
|
|
] |
|
21
|
|
|
|
|
|
|
); |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
else { |
|
24
|
0
|
|
|
|
|
|
return $model -> apply( |
|
25
|
|
|
|
|
|
|
$model -> meta_uri('loc:upfrom'), |
|
26
|
|
|
|
|
|
|
[ $self -> [0] ] |
|
27
|
|
|
|
|
|
|
); |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
# my $bnode = $model -> bnode; |
|
30
|
|
|
|
|
|
|
# $model -> add_type($bnode, 'loc:Range'); |
|
31
|
|
|
|
|
|
|
# $model -> add_first($bnode, $self->[0]); |
|
32
|
|
|
|
|
|
|
# if(@$self > 1) { |
|
33
|
|
|
|
|
|
|
# $model -> add_last($bnode, $self->[1]); |
|
34
|
|
|
|
|
|
|
# } |
|
35
|
|
|
|
|
|
|
# return $bnode; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub execute { |
|
39
|
0
|
|
|
0
|
0
|
|
my ( $self, $engine ) = @_; |
|
40
|
|
|
|
|
|
|
|
|
41
|
0
|
0
|
0
|
|
|
|
if ( @$self == 1 || !defined( $self->[1] ) ) { # semi-open range |
|
42
|
|
|
|
|
|
|
return $engine->execute( $self->[0] )->then( |
|
43
|
|
|
|
|
|
|
sub { |
|
44
|
0
|
|
|
0
|
|
|
bless [@_] => 'Dallycot::Value::OpenRange'; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
0
|
|
|
|
|
|
); |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
else { |
|
49
|
|
|
|
|
|
|
return $engine->collect(@$self)->then( |
|
50
|
|
|
|
|
|
|
sub { |
|
51
|
0
|
|
|
0
|
|
|
my ( $left_value, $right_value ) = @_; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
$left_value->is_less( $engine, $right_value )->then( |
|
54
|
|
|
|
|
|
|
sub { |
|
55
|
0
|
|
|
|
|
|
my ($f) = @_; |
|
56
|
|
|
|
|
|
|
|
|
57
|
0
|
0
|
|
|
|
|
bless [ $left_value, $right_value, $f ? 1 : -1 ] => 'Dallycot::Value::ClosedRange'; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
0
|
|
|
|
|
|
); |
|
60
|
|
|
|
|
|
|
} |
|
61
|
0
|
|
|
|
|
|
); |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |