line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Repl::Core::MacroRepo;
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Pragma's.
|
4
|
1
|
|
|
1
|
|
4
|
use strict;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
30
|
|
5
|
1
|
|
|
1
|
|
3
|
use warnings;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# Uses.
|
8
|
1
|
|
|
1
|
|
4
|
use Carp;
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
236
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new
|
11
|
|
|
|
|
|
|
{
|
12
|
1
|
|
|
1
|
0
|
2
|
my $invocant = shift;
|
13
|
1
|
|
33
|
|
|
5
|
my $class = ref($invocant) || $invocant;
|
14
|
|
|
|
|
|
|
# Initialize the token instance.
|
15
|
1
|
|
|
|
|
2
|
my $self = {};
|
16
|
1
|
|
|
|
|
2
|
$self->{REPO} = {};
|
17
|
1
|
|
|
|
|
5
|
return bless($self, $class);
|
18
|
|
|
|
|
|
|
}
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub registerMacro
|
21
|
|
|
|
|
|
|
{
|
22
|
0
|
|
|
0
|
0
|
0
|
my ($self, $name, $command) = @_;
|
23
|
0
|
0
|
0
|
|
|
0
|
if(!$command || !($command->can("transform")))
|
24
|
|
|
|
|
|
|
{
|
25
|
0
|
|
|
|
|
0
|
confess "A macro needs to have an transform method.";
|
26
|
|
|
|
|
|
|
}
|
27
|
0
|
|
|
|
|
0
|
$self->{REPO}->{$name=>$command};
|
28
|
|
|
|
|
|
|
}
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub hasMacro
|
31
|
|
|
|
|
|
|
{
|
32
|
121
|
|
|
121
|
0
|
180
|
my ($self, $name) = @_;
|
33
|
121
|
|
|
|
|
455
|
return exists $self->{REPO}->{$name};
|
34
|
|
|
|
|
|
|
}
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub getMacro
|
37
|
|
|
|
|
|
|
{
|
38
|
0
|
|
|
0
|
0
|
|
my ($self, $name) = @_;
|
39
|
0
|
|
|
|
|
|
return $self->{REPO}->{$name};
|
40
|
|
|
|
|
|
|
}
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1;
|