App-Music-ChordPro

 view release on metacpan or  search on metacpan

lib/ChordPro/Song.pm  view on Meta::CPAN

#!/usr/bin/perl

use utf8;

package main;

our $options;
our $config;

package ChordPro::Song;

use strict;
use warnings;

use ChordPro;
use ChordPro::Files;
use ChordPro::Paths;
use ChordPro::Utils;
use ChordPro::Chords;
use ChordPro::Chords::Appearance;
use ChordPro::Chords::Parser;
use ChordPro::Chords::Transpose;
use ChordPro::Output::Common;
use ChordPro::Symbols qw( is_strum );

use Carp;
use List::Util qw(any);
use Storable qw(dclone);
use feature 'state';
use Text::ParseWords qw(quotewords);
use Ref::Util qw( is_arrayref is_hashref );

my $backend;			# backend tag

# Parser context.
my $def_context = "";
my $in_context = $def_context;
my $skip_context = 0;
my $grid_arg;			# also used for grilles?
my $grid_cells;			# also used for grilles?
my $grid_type = 0;		# 0 = chords, 1,2 = strums
my @grille;

# Transposition.
# We have the following transpositions:
# - outer, from cli or settings
# - capo (if decapo this is just another transpose)
# - inner, from transpose directives
# outer and inner control the print
# outer, inner and capo control the sound.
# Transpositions are applied in the order inner, capo, outer.
our $xpose;			# accumulated {transpose} directives.
# This is the composite of {transpose} directives and CLI transpose.
my $capo;

# Used chords, in order of appearance.
# Note that the key is not a chord.
my @used_chords;

# Chorus lines, if any.
my @chorus;
my $chorus_xpose = 0;	# xpose_base when chorus was defined

# Memorized chords.
my $cctag;			# current cc name
my %memchords;			# all sections
my $memchords;			# current section
my $memcrdinx;			# chords tally
my $memorizing;			# if memorizing (a.o.t. recalling)

# Keep track of unknown chords, to avoid dup warnings.
my %warned_chords;

our $re_chords;			# for chords
my $propitems_re = propitems_re();
my $intervals;			# number of note intervals
my @labels;			# labels used

# Normally, transposition and subtitutions are handled by the parser.
my $decapo;
my $no_transpose;		# NYI
my $xcmov;			# transcode to movable system
my $no_substitute;

# Stack for properties like textsize.
my %propstack;

my $diag;			# for diagnostics
my @diag;			# keep track of includes
my $lineinfo;			# keep lineinfo
my $assetid = "001";		# for assets



( run in 0.723 second using v1.01-cache-2.11-cpan-ceb78f64989 )