line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
18
|
|
|
18
|
|
65
|
use strict; |
|
18
|
|
|
|
|
22
|
|
|
18
|
|
|
|
|
475
|
|
2
|
18
|
|
|
18
|
|
59
|
use warnings FATAL => 'all'; |
|
18
|
|
|
|
|
19
|
|
|
18
|
|
|
|
|
688
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package MarpaX::Database::Terminfo::Grammar::Actions; |
5
|
18
|
|
|
18
|
|
6665
|
use MarpaX::Database::Terminfo::Grammar::Regexp qw/%TOKENSRE/; |
|
18
|
|
|
|
|
39
|
|
|
18
|
|
|
|
|
3399
|
|
6
|
18
|
|
|
18
|
|
9105
|
use MarpaX::Database::Terminfo::Constants qw/:types/; |
|
18
|
|
|
|
|
30
|
|
|
18
|
|
|
|
|
1937
|
|
7
|
18
|
|
|
18
|
|
85
|
use Carp qw/carp/; |
|
18
|
|
|
|
|
20
|
|
|
18
|
|
|
|
|
932
|
|
8
|
18
|
|
|
18
|
|
7984
|
use Log::Any qw/$log/; |
|
18
|
|
|
|
|
158725
|
|
|
18
|
|
|
|
|
97
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: Terminfo grammar actions |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.012'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
2
|
|
|
2
|
1
|
7990
|
my $class = shift; |
18
|
2
|
|
|
|
|
8
|
my $self = {_terminfo => [undef]}; |
19
|
2
|
|
|
|
|
10
|
bless($self, $class); |
20
|
2
|
|
|
|
|
6
|
return $self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub value { |
25
|
2
|
|
|
2
|
1
|
45
|
my ($self) = @_; |
26
|
|
|
|
|
|
|
# |
27
|
|
|
|
|
|
|
# Remove the last that was undef |
28
|
|
|
|
|
|
|
# |
29
|
2
|
|
|
|
|
4
|
pop(@{$self->{_terminfo}}); |
|
2
|
|
|
|
|
5
|
|
30
|
|
|
|
|
|
|
|
31
|
2
|
|
|
|
|
5
|
return $self->{_terminfo}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub endTerminfo { |
36
|
2
|
|
|
2
|
1
|
57
|
my ($self) = @_; |
37
|
2
|
|
|
|
|
3
|
push(@{$self->{_terminfo}}, undef); |
|
2
|
|
|
|
|
8
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _getTerminfo { |
41
|
171
|
|
|
171
|
|
123
|
my ($self) = @_; |
42
|
|
|
|
|
|
|
|
43
|
171
|
100
|
|
|
|
293
|
if (! defined($self->{_terminfo}->[-1])) { |
44
|
2
|
|
|
|
|
10
|
$self->{_terminfo}->[-1] = {alias => [], longname => '', feature => []}; |
45
|
|
|
|
|
|
|
} |
46
|
171
|
|
|
|
|
216
|
return $self->{_terminfo}->[-1]; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub _pushFeature { |
50
|
164
|
|
|
164
|
|
253
|
my ($self, $type, $name, $value) = @_; |
51
|
|
|
|
|
|
|
|
52
|
164
|
|
|
|
|
195
|
my $terminfo = $self->_getTerminfo; |
53
|
|
|
|
|
|
|
|
54
|
164
|
|
|
|
|
127
|
foreach (@{$terminfo->{feature}}) { |
|
164
|
|
|
|
|
270
|
|
55
|
7171
|
50
|
|
|
|
9244
|
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
|
|
|
|
|
116
|
push(@{$terminfo->{feature}}, {type => $type, name => $name, value => $value}); |
|
164
|
|
|
|
|
593
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub longname { |
65
|
2
|
|
|
2
|
1
|
52
|
my ($self, $longname) = @_; |
66
|
2
|
|
|
|
|
5
|
$self->_getTerminfo->{longname} = $longname; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub alias { |
71
|
5
|
|
|
5
|
1
|
1590
|
my ($self, $alias) = @_; |
72
|
5
|
|
|
|
|
3
|
push(@{$self->_getTerminfo->{alias}}, $alias); |
|
5
|
|
|
|
|
14
|
|
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub boolean { |
77
|
8
|
|
|
8
|
1
|
180
|
my ($self, $boolean) = @_; |
78
|
|
|
|
|
|
|
# |
79
|
|
|
|
|
|
|
# If boolean ends with '@' then it is explicitely false |
80
|
|
|
|
|
|
|
# |
81
|
8
|
50
|
|
|
|
22
|
return $self->_pushFeature(TERMINFO_BOOLEAN, $boolean, substr($boolean, -1, 1) eq '@' ? 0 : 1); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub numeric { |
86
|
10
|
|
|
10
|
1
|
295
|
my ($self, $numeric) = @_; |
87
|
|
|
|
|
|
|
|
88
|
10
|
|
|
|
|
111
|
$numeric =~ /$TOKENSRE{NUMERIC}/; |
89
|
10
|
|
|
|
|
52
|
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
|
3645
|
my ($self, $string) = @_; |
95
|
|
|
|
|
|
|
|
96
|
146
|
|
|
|
|
1319
|
$string =~ /$TOKENSRE{STRING}/; |
97
|
146
|
|
|
|
|
564
|
return $self->_pushFeature(TERMINFO_STRING, substr($string, $-[2], $+[2] - $-[2]), substr($string, $-[3], $+[3] - $-[3])); |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
__END__ |