-
Notifications
You must be signed in to change notification settings - Fork 2
/
Do.pm
37 lines (27 loc) · 817 Bytes
/
Do.pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package Template::TT3::Element::Command::Do;
use Template::TT3::Class
version => 3.00,
debug => 0,
base => 'Template::TT3::Element::Command',
constants => ':elem_slots :eval_args',
alias => {
text => \&value,
values => \&value,
};
sub as_expr {
my ($self, $token, $scope, $prec, $force) = @_;
# operator precedence
return undef
if $prec && ! $force && $self->[META]->[LPREC] <= $prec;
# advance token reference
$self->accept($token);
# skip past keyword and parse block following
$self->[EXPR] = $$token->as_block($token, $scope)
|| return $self->missing( block => $token );
return $self;
}
sub value {
my @values = $_[SELF]->[EXPR]->values($_[CONTEXT]);
return pop @values;
}
1;