Skip to content

Commit

Permalink
Simplify input, work old note handling code into new match loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
LastOfTheCarelessMen committed Jan 6, 2010
1 parent 1e422a3 commit ffafa4b
Showing 1 changed file with 19 additions and 24 deletions.
43 changes: 19 additions & 24 deletions dg-check.pl
Expand Up @@ -3,31 +3,26 @@
BEGIN { push @*INC, "lib" }
use ABC;

regex between { \v+ }
regex file { \s* <ABC::tune> ** <between> }

my $abcs = $*IN.lines.join("\n");
my @matches = $abcs.comb(m/ <ABC::tune> /, :match);
my @matches = $*IN.lines.join("\n").comb(m/ <ABC::tune> /, :match);

for @matches {
my %header = header_hash(.<ABC::tune><header>);
say %header<T>;
}
say %header<T> ~ ":";

my @notes = gather for .<ABC::tune><music><line_of_music> -> $line
{
for $line<bar> -> $bar
{
for $bar<element>
{
when .<broken_rhythm> { take .<broken_rhythm><note>[0]; take .<broken_rhythm><note>[1]; }
when .<note> { take .<note>; }
}
}
}

#
# my @notes = gather for $match<ABC::tune><music><line_of_music> -> $line
# {
# for $line<bar> -> $bar
# {
# for $bar<element>
# {
# when .<broken_rhythm> { take .<broken_rhythm><note>[0]; take .<broken_rhythm><note>[1]; }
# when .<note> { take .<note>; }
# }
# }
# }
#
# my %header = header_hash($match<ABC::tune><header>);
# my %key_signature = key_signature(%header<K>);
#
# @notes.map({say .<pitch> ~ " => " ~ apply_key_signature(%key_signature, .<pitch>)});
my %header = header_hash(.<ABC::tune><header>);
my %key_signature = key_signature(%header<K>);

@notes.map({say .<pitch> ~ " => " ~ apply_key_signature(%key_signature, .<pitch>)});
}

0 comments on commit ffafa4b

Please sign in to comment.