Permalink
Browse files

Simplify input, work old note handling code into new match loop.

  • Loading branch information...
1 parent 1e422a3 commit ffafa4bc817a7cefb5418d47dfd81c238d8fd606 @LastOfTheCarelessMen LastOfTheCarelessMen committed Jan 6, 2010
Showing with 19 additions and 24 deletions.
  1. +19 −24 dg-check.pl
View
@@ -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.