line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
18
|
|
|
18
|
|
62
|
use strict; |
|
18
|
|
|
|
|
23
|
|
|
18
|
|
|
|
|
418
|
|
2
|
18
|
|
|
18
|
|
55
|
use warnings FATAL => 'all'; |
|
18
|
|
|
|
|
23
|
|
|
18
|
|
|
|
|
652
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package MarpaX::Database::Terminfo::Grammar::Actions; |
5
|
18
|
|
|
18
|
|
6737
|
use MarpaX::Database::Terminfo::Grammar::Regexp qw/%TOKENSRE/; |
|
18
|
|
|
|
|
41
|
|
|
18
|
|
|
|
|
2983
|
|
6
|
18
|
|
|
18
|
|
8742
|
use MarpaX::Database::Terminfo::Constants qw/:types/; |
|
18
|
|
|
|
|
29
|
|
|
18
|
|
|
|
|
1910
|
|
7
|
18
|
|
|
18
|
|
84
|
use Carp qw/carp/; |
|
18
|
|
|
|
|
24
|
|
|
18
|
|
|
|
|
839
|
|
8
|
18
|
|
|
18
|
|
7809
|
use Log::Any qw/$log/; |
|
18
|
|
|
|
|
162221
|
|
|
18
|
|
|
|
|
93
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: Terminfo grammar actions |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.011'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
2
|
|
|
2
|
1
|
8056
|
my $class = shift; |
18
|
2
|
|
|
|
|
9
|
my $self = {_terminfo => [undef]}; |
19
|
2
|
|
|
|
|
12
|
bless($self, $class); |
20
|
2
|
|
|
|
|
6
|
return $self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub value { |
25
|
2
|
|
|
2
|
1
|
46
|
my ($self) = @_; |
26
|
|
|
|
|
|
|
# |
27
|
|
|
|
|
|
|
# Remove the last that was undef |
28
|
|
|
|
|
|
|
# |
29
|
2
|
|
|
|
|
3
|
pop(@{$self->{_terminfo}}); |
|
2
|
|
|
|
|
6
|
|
30
|
|
|
|
|
|
|
|
31
|
2
|
|
|
|
|
4
|
return $self->{_terminfo}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub endTerminfo { |
36
|
2
|
|
|
2
|
1
|
59
|
my ($self) = @_; |
37
|
2
|
|
|
|
|
3
|
push(@{$self->{_terminfo}}, undef); |
|
2
|
|
|
|
|
8
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _getTerminfo { |
41
|
171
|
|
|
171
|
|
127
|
my ($self) = @_; |
42
|
|
|
|
|
|
|
|
43
|
171
|
100
|
|
|
|
334
|
if (! defined($self->{_terminfo}->[-1])) { |
44
|
2
|
|
|
|
|
11
|
$self->{_terminfo}->[-1] = {alias => [], longname => '', feature => []}; |
45
|
|
|
|
|
|
|
} |
46
|
171
|
|
|
|
|
216
|
return $self->{_terminfo}->[-1]; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub _pushFeature { |
50
|
164
|
|
|
164
|
|
268
|
my ($self, $type, $name, $value) = @_; |
51
|
|
|
|
|
|
|
|
52
|
164
|
|
|
|
|
198
|
my $terminfo = $self->_getTerminfo; |
53
|
|
|
|
|
|
|
|
54
|
164
|
|
|
|
|
136
|
foreach (@{$terminfo->{feature}}) { |
|
164
|
|
|
|
|
255
|
|
55
|
7171
|
50
|
|
|
|
9324
|
if ($_->{name} eq $name) { |
56
|
0
|
|
0
|
|
|
0
|
$log->warnf('%s %s: feature %s overwriten', $terminfo->{alias} || [], $terminfo->{longname} || '', $name); |
|
|
|
0
|
|
|
|
|
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
164
|
|
|
|
|
124
|
push(@{$terminfo->{feature}}, {type => $type, name => $name, value => $value}); |
|
164
|
|
|
|
|
640
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub longname { |
65
|
2
|
|
|
2
|
1
|
55
|
my ($self, $longname) = @_; |
66
|
2
|
|
|
|
|
6
|
$self->_getTerminfo->{longname} = $longname; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub alias { |
71
|
5
|
|
|
5
|
1
|
1675
|
my ($self, $alias) = @_; |
72
|
5
|
|
|
|
|
6
|
push(@{$self->_getTerminfo->{alias}}, $alias); |
|
5
|
|
|
|
|
15
|
|
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub boolean { |
77
|
8
|
|
|
8
|
1
|
281
|
my ($self, $boolean) = @_; |
78
|
|
|
|
|
|
|
# |
79
|
|
|
|
|
|
|
# If boolean ends with '@' then it is explicitely false |
80
|
|
|
|
|
|
|
# |
81
|
8
|
50
|
|
|
|
36
|
return $self->_pushFeature(TERMINFO_BOOLEAN, $boolean, substr($boolean, -1, 1) eq '@' ? 0 : 1); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub numeric { |
86
|
10
|
|
|
10
|
1
|
344
|
my ($self, $numeric) = @_; |
87
|
|
|
|
|
|
|
|
88
|
10
|
|
|
|
|
127
|
$numeric =~ /$TOKENSRE{NUMERIC}/; |
89
|
10
|
|
|
|
|
68
|
return $self->_pushFeature(TERMINFO_NUMERIC, substr($numeric, $-[2], $+[2] - $-[2]), substr($numeric, $-[3], $+[3] - $-[3])); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub string { |
94
|
146
|
|
|
146
|
1
|
3908
|
my ($self, $string) = @_; |
95
|
|
|
|
|
|
|
|
96
|
146
|
|
|
|
|
1406
|
$string =~ /$TOKENSRE{STRING}/; |
97
|
146
|
|
|
|
|
612
|
return $self->_pushFeature(TERMINFO_STRING, substr($string, $-[2], $+[2] - $-[2]), substr($string, $-[3], $+[3] - $-[3])); |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
__END__ |