line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
18
|
|
|
18
|
|
108
|
use strict; |
|
18
|
|
|
|
|
32
|
|
|
18
|
|
|
|
|
678
|
|
2
|
18
|
|
|
18
|
|
99
|
use warnings FATAL => 'all'; |
|
18
|
|
|
|
|
37
|
|
|
18
|
|
|
|
|
832
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package MarpaX::Database::Terminfo::Grammar::Actions; |
5
|
18
|
|
|
18
|
|
12967
|
use MarpaX::Database::Terminfo::Grammar::Regexp qw/%TOKENSRE/; |
|
18
|
|
|
|
|
71
|
|
|
18
|
|
|
|
|
4367
|
|
6
|
18
|
|
|
18
|
|
14958
|
use MarpaX::Database::Terminfo::Constants qw/:types/; |
|
18
|
|
|
|
|
55
|
|
|
18
|
|
|
|
|
3505
|
|
7
|
18
|
|
|
18
|
|
119
|
use Carp qw/carp/; |
|
18
|
|
|
|
|
35
|
|
|
18
|
|
|
|
|
1060
|
|
8
|
18
|
|
|
18
|
|
18618
|
use Log::Any qw/$log/; |
|
18
|
|
|
|
|
48711
|
|
|
18
|
|
|
|
|
140
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: Terminfo grammar actions |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our $VERSION = '0.010'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
2
|
|
|
2
|
1
|
13653
|
my $class = shift; |
18
|
2
|
|
|
|
|
12
|
my $self = {_terminfo => [undef]}; |
19
|
2
|
|
|
|
|
11
|
bless($self, $class); |
20
|
2
|
|
|
|
|
7
|
return $self; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub value { |
25
|
2
|
|
|
2
|
1
|
64
|
my ($self) = @_; |
26
|
|
|
|
|
|
|
# |
27
|
|
|
|
|
|
|
# Remove the last that was undef |
28
|
|
|
|
|
|
|
# |
29
|
2
|
|
|
|
|
6
|
pop(@{$self->{_terminfo}}); |
|
2
|
|
|
|
|
4
|
|
30
|
|
|
|
|
|
|
|
31
|
2
|
|
|
|
|
7
|
return $self->{_terminfo}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub endTerminfo { |
36
|
2
|
|
|
2
|
1
|
78
|
my ($self) = @_; |
37
|
2
|
|
|
|
|
4
|
push(@{$self->{_terminfo}}, undef); |
|
2
|
|
|
|
|
10
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _getTerminfo { |
41
|
171
|
|
|
171
|
|
238
|
my ($self) = @_; |
42
|
|
|
|
|
|
|
|
43
|
171
|
100
|
|
|
|
480
|
if (! defined($self->{_terminfo}->[-1])) { |
44
|
2
|
|
|
|
|
17
|
$self->{_terminfo}->[-1] = {alias => [], longname => '', feature => []}; |
45
|
|
|
|
|
|
|
} |
46
|
171
|
|
|
|
|
411
|
return $self->{_terminfo}->[-1]; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub _pushFeature { |
50
|
164
|
|
|
164
|
|
456
|
my ($self, $type, $name, $value) = @_; |
51
|
|
|
|
|
|
|
|
52
|
164
|
|
|
|
|
381
|
my $terminfo = $self->_getTerminfo; |
53
|
|
|
|
|
|
|
|
54
|
164
|
|
|
|
|
218
|
foreach (@{$terminfo->{feature}}) { |
|
164
|
|
|
|
|
367
|
|
55
|
7171
|
50
|
|
|
|
15842
|
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
|
|
|
|
|
260
|
push(@{$terminfo->{feature}}, {type => $type, name => $name, value => $value}); |
|
164
|
|
|
|
|
1058
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub longname { |
65
|
2
|
|
|
2
|
1
|
93
|
my ($self, $longname) = @_; |
66
|
2
|
|
|
|
|
9
|
$self->_getTerminfo->{longname} = $longname; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub alias { |
71
|
5
|
|
|
5
|
1
|
2964
|
my ($self, $alias) = @_; |
72
|
5
|
|
|
|
|
10
|
push(@{$self->_getTerminfo->{alias}}, $alias); |
|
5
|
|
|
|
|
19
|
|
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub boolean { |
77
|
8
|
|
|
8
|
1
|
337
|
my ($self, $boolean) = @_; |
78
|
|
|
|
|
|
|
# |
79
|
|
|
|
|
|
|
# If boolean ends with '@' then it is explicitely false |
80
|
|
|
|
|
|
|
# |
81
|
8
|
50
|
|
|
|
44
|
return $self->_pushFeature(TERMINFO_BOOLEAN, $boolean, substr($boolean, -1, 1) eq '@' ? 0 : 1); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub numeric { |
86
|
10
|
|
|
10
|
1
|
415
|
my ($self, $numeric) = @_; |
87
|
|
|
|
|
|
|
|
88
|
10
|
|
|
|
|
150
|
$numeric =~ /$TOKENSRE{NUMERIC}/; |
89
|
10
|
|
|
|
|
71
|
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
|
5875
|
my ($self, $string) = @_; |
95
|
|
|
|
|
|
|
|
96
|
146
|
|
|
|
|
1923
|
$string =~ /$TOKENSRE{STRING}/; |
97
|
146
|
|
|
|
|
884
|
return $self->_pushFeature(TERMINFO_STRING, substr($string, $-[2], $+[2] - $-[2]), substr($string, $-[3], $+[3] - $-[3])); |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1; |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
__END__ |