| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#! perl |
|
2
|
|
|
|
|
|
|
|
|
3
|
90
|
|
|
90
|
|
1581
|
use v5.26; |
|
|
90
|
|
|
|
|
365
|
|
|
4
|
90
|
|
|
90
|
|
642
|
use feature qw( signatures ); |
|
|
90
|
|
|
|
|
189
|
|
|
|
90
|
|
|
|
|
15855
|
|
|
5
|
90
|
|
|
90
|
|
903
|
no warnings qw( experimental::signatures ); |
|
|
90
|
|
|
|
|
231
|
|
|
|
90
|
|
|
|
|
5452
|
|
|
6
|
90
|
|
|
90
|
|
655
|
use utf8; |
|
|
90
|
|
|
|
|
233
|
|
|
|
90
|
|
|
|
|
799
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package ChordPro::Symbols; |
|
9
|
|
|
|
|
|
|
|
|
10
|
90
|
|
|
90
|
|
5605
|
use Exporter qw(import); |
|
|
90
|
|
|
|
|
209
|
|
|
|
90
|
|
|
|
|
6930
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @EXPORT; |
|
13
|
|
|
|
|
|
|
our @EXPORT_OK; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $symbols; |
|
16
|
|
|
|
|
|
|
|
|
17
|
90
|
|
|
90
|
|
637
|
use List::Util qw( any ); |
|
|
90
|
|
|
|
|
199
|
|
|
|
90
|
|
|
|
|
9031
|
|
|
18
|
90
|
|
|
90
|
|
756
|
use Ref::Util qw( is_arrayref ); |
|
|
90
|
|
|
|
|
260
|
|
|
|
90
|
|
|
|
|
162264
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub import { |
|
21
|
190
|
100
|
|
190
|
|
1186
|
$symbols || _build(); |
|
22
|
190
|
|
|
|
|
87149
|
goto &Exporter::import; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _build { |
|
26
|
|
|
|
|
|
|
|
|
27
|
90
|
|
|
90
|
|
2675
|
my @a = split( /\s+/, <
|
|
28
|
|
|
|
|
|
|
u \x{2190} arrow-up |
|
29
|
|
|
|
|
|
|
up \x{2190} arrow-up |
|
30
|
|
|
|
|
|
|
ua \x{2191} arrow-up-with-arpeggio |
|
31
|
|
|
|
|
|
|
us \x{2192} arrow-up-with-staccato |
|
32
|
|
|
|
|
|
|
u+ \x{2193} arrow-up-with-accent |
|
33
|
|
|
|
|
|
|
up+ \x{2193} arrow-up-with-accent |
|
34
|
|
|
|
|
|
|
ua+ \x{2194} arrow-up-with-accent-and-arpeggio |
|
35
|
|
|
|
|
|
|
us+ \x{2195} arrow-up-with-accent-and-staccato |
|
36
|
|
|
|
|
|
|
ux \x{2196} arrow-up-muted |
|
37
|
|
|
|
|
|
|
uxa \x{2197} arrow-up-muted-with-arpeggio |
|
38
|
|
|
|
|
|
|
uxs \x{2198} arrow-up-muted-with-staccato |
|
39
|
|
|
|
|
|
|
ux+ \x{2199} arrow-up-muted-with-accent |
|
40
|
|
|
|
|
|
|
uxa+ \x{219a} arrow-up-muted-with-accent-and-arpeggio |
|
41
|
|
|
|
|
|
|
uxs+ \x{219b} arrow-up-muted-with-accent-and-staccato |
|
42
|
|
|
|
|
|
|
uxa+ \x{219a} arrow-up-muted-with-accent-and-arpeggio |
|
43
|
|
|
|
|
|
|
uxs+ \x{219b} arrow-up-muted-with-accent-and-staccato |
|
44
|
|
|
|
|
|
|
d \x{21a0} arrow-down |
|
45
|
|
|
|
|
|
|
dn \x{21a0} arrow-down |
|
46
|
|
|
|
|
|
|
da \x{21a1} arrow-down-with-arpeggio |
|
47
|
|
|
|
|
|
|
ds \x{21a2} arrow-down-with-staccato |
|
48
|
|
|
|
|
|
|
d+ \x{21a3} arrow-down-with-accent |
|
49
|
|
|
|
|
|
|
dn+ \x{21a3} arrow-down-with-accent |
|
50
|
|
|
|
|
|
|
da+ \x{21a4} arrow-down-with-accent-and-arpeggio |
|
51
|
|
|
|
|
|
|
ds+ \x{21a5} arrow-down-with-accent-and-staccato |
|
52
|
|
|
|
|
|
|
dx \x{21a6} arrow-down-muted |
|
53
|
|
|
|
|
|
|
dxa \x{21a7} arrow-down-muted-with-arpeggio |
|
54
|
|
|
|
|
|
|
dxs \x{21a8} arrow-down-muted-with-staccato |
|
55
|
|
|
|
|
|
|
dx+ \x{21a9} arrow-down-muted-with-accent |
|
56
|
|
|
|
|
|
|
dxa+ \x{21aa} arrow-down-muted-with-accent-and-arpeggio |
|
57
|
|
|
|
|
|
|
dxs+ \x{21ab} arrow-down-muted-with-accent-and-staccato |
|
58
|
|
|
|
|
|
|
dxa+ \x{21aa} arrow-down-muted-with-accent-and-arpeggio |
|
59
|
|
|
|
|
|
|
dxs+ \x{21ab} arrow-down-muted-with-accent-and-staccato |
|
60
|
|
|
|
|
|
|
x \x{21b0} arrow-mute |
|
61
|
|
|
|
|
|
|
EOD |
|
62
|
|
|
|
|
|
|
|
|
63
|
90
|
|
|
|
|
449
|
while ( @a ) { |
|
64
|
2970
|
|
|
|
|
4890
|
my $code = shift(@a); |
|
65
|
2970
|
|
|
|
|
4638
|
my $glyph = shift(@a); |
|
66
|
2970
|
|
|
|
|
4578
|
my $name = shift(@a); |
|
67
|
2970
|
|
|
|
|
7663
|
$symbols->{"strum_$code"} = $glyph; |
|
68
|
2970
|
|
|
|
|
6626
|
$symbols->{$name} = $glyph; |
|
69
|
2970
|
|
|
|
|
7148
|
$name =~ s/muted/mut/; |
|
70
|
2970
|
|
|
|
|
9686
|
$name =~ s/accent/acc/; |
|
71
|
2970
|
|
|
|
|
7155
|
$name =~ s/arpeggio/arp/; |
|
72
|
2970
|
|
|
|
|
7066
|
$name =~ s/staccato/stc/; |
|
73
|
2970
|
|
|
|
|
13347
|
$name =~ s/-(and|with)-/-/g; |
|
74
|
2970
|
|
|
|
|
9953
|
$symbols->{$name} = $glyph; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
90
|
|
|
|
|
397
|
my $start = ord("!"); |
|
78
|
|
|
|
|
|
|
# Something peculiar happening here... |
|
79
|
|
|
|
|
|
|
# If repeat-end-start1 maps to ' it cannot be used (comes out as undefined glyph). |
|
80
|
|
|
|
|
|
|
$symbols->{$_} = sprintf("%c", $start++ ) |
|
81
|
90
|
|
|
|
|
2190
|
for qw( flat natural sharp delta |
|
82
|
|
|
|
|
|
|
repeat-start repeat-end repeat-end-start1 repeat-colon repeat1 repeat2 repeat-end-start ); |
|
83
|
|
|
|
|
|
|
|
|
84
|
90
|
|
|
|
|
230
|
$start = ord(":"); |
|
85
|
|
|
|
|
|
|
$symbols->{$_} = sprintf("%c", $start++ ) |
|
86
|
90
|
|
|
|
|
1316
|
for qw( bar double-bar end-bar start-bar thick-bar double-thick-bar ); |
|
87
|
|
|
|
|
|
|
|
|
88
|
90
|
|
|
|
|
2203
|
$symbols->{"circle-$_"} = $_ for "0".."9"; |
|
89
|
90
|
|
|
|
|
3660
|
$symbols->{"circle-$_"} = $_ for "A".."Z"; |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
} |
|
92
|
|
|
|
|
|
|
|
|
93
|
40
|
|
|
40
|
0
|
100
|
sub symbols() { |
|
|
40
|
|
|
|
|
106
|
|
|
94
|
40
|
|
|
|
|
240
|
$symbols; |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
push( @EXPORT_OK, qw( symbols ) ); |
|
98
|
|
|
|
|
|
|
|
|
99
|
0
|
|
|
0
|
0
|
|
sub symbol($sym) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
$symbols->{$sym}; |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
push( @EXPORT_OK, qw( symbol ) ); |
|
104
|
|
|
|
|
|
|
|
|
105
|
0
|
|
|
0
|
0
|
|
sub is_symbol( $name ) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
106
|
0
|
|
|
|
|
|
exists( $symbols->{$name} ); |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
push( @EXPORT, qw( is_symbol ) ); |
|
110
|
|
|
|
|
|
|
|
|
111
|
0
|
|
|
0
|
0
|
|
sub strum( $code ) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
# Allow override by config. |
|
113
|
|
|
|
|
|
|
exists($::config->{gridstrum}->{symbols}->{$code}) |
|
114
|
|
|
|
|
|
|
? $::config->{gridstrum}->{symbols}->{$code} |
|
115
|
0
|
0
|
|
|
|
|
: $symbols->{"strum_$code"}; |
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
push( @EXPORT, qw( strum ) ); |
|
119
|
|
|
|
|
|
|
|
|
120
|
0
|
|
|
0
|
0
|
|
sub is_strum( $code ) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
# In case of settings.notenames, prevent arrow codes from hiding |
|
122
|
|
|
|
|
|
|
# lowercase note names. |
|
123
|
0
|
0
|
|
|
|
|
if ( $::config->{settings}->{notenames} ) { |
|
124
|
|
|
|
|
|
|
return |
|
125
|
0
|
|
|
0
|
|
|
if any { $_ eq $code } |
|
126
|
0
|
0
|
|
|
|
|
map { is_arrayref($_) ? ( map{lc}@$_ ) : lc($_) } |
|
|
0
|
|
|
|
|
|
|
|
127
|
0
|
|
|
|
|
|
@{ $::config->{notes}->{flat} }, |
|
128
|
0
|
0
|
|
|
|
|
@{ $::config->{notes}->{sharp} }; |
|
|
0
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
} |
|
130
|
|
|
|
|
|
|
|
|
131
|
0
|
|
|
|
|
|
exists( $symbols->{"strum_$code"} ); |
|
132
|
|
|
|
|
|
|
} |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
push( @EXPORT, qw( is_strum ) ); |
|
135
|
|
|
|
|
|
|
|
|
136
|
0
|
|
|
0
|
0
|
|
sub as_json() { |
|
|
0
|
|
|
|
|
|
|
|
137
|
0
|
|
|
|
|
|
my $ret = "{\n"; |
|
138
|
0
|
|
|
|
|
|
for ( sort keys %$symbols ) { |
|
139
|
0
|
|
|
|
|
|
$ret .= qq{ "$_" : }; |
|
140
|
0
|
|
|
|
|
|
my $s = $symbols->{$_}; |
|
141
|
0
|
0
|
0
|
|
|
|
if ( $s ge "!" && $s le "}" ) { |
|
142
|
0
|
|
|
|
|
|
$ret .= qq{"$s"}; |
|
143
|
|
|
|
|
|
|
} |
|
144
|
|
|
|
|
|
|
else { |
|
145
|
0
|
|
|
|
|
|
$ret .= sprintf(qq{"\\u%04x"}, ord($s) ); |
|
146
|
|
|
|
|
|
|
} |
|
147
|
0
|
|
|
|
|
|
$ret .= ",\n"; |
|
148
|
|
|
|
|
|
|
} |
|
149
|
0
|
|
|
|
|
|
$ret =~ s/,\n$/\n/; |
|
150
|
0
|
|
|
|
|
|
$ret .= "}\n"; |
|
151
|
|
|
|
|
|
|
} |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
push( @EXPORT_OK, qw( as_json ) ); |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
1; |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
unless ( caller ) { |
|
158
|
|
|
|
|
|
|
$symbols || _build(); |
|
159
|
|
|
|
|
|
|
print as_json(); |
|
160
|
|
|
|
|
|
|
} |